上海杨浦大连路地铁站单机版电子沙盘
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.5 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireAlongWindCheck : MonoBehaviour {
WeatherSettingManager weatherMgr;
void Awake()
{
weatherMgr = GameObject.Find("Canvas").transform.Find("WeatherSettingPanel").GetComponent<WeatherSettingManager>();
AlongWindCheck.alongWindCheck += CheckHeadquaterPosition;
}
void OnDestroy()
{
AlongWindCheck.alongWindCheck -= CheckHeadquaterPosition;
}
/// <summary>
/// 检查指挥部是否设置在上风向或侧风向
/// </summary>
/// <param name="arg1"></param>
/// <param name="arg2"></param>
/// <returns></returns>
private IntData CheckHeadquaterPosition(Vector3 pos, IntData data)
{
Vector3 myPos = transform.position;
float dx = Mathf.Abs(myPos.x - pos.x);
float dz = Mathf.Abs(myPos.z - pos.z);
switch (weatherMgr.TianQiSettingData.fengxiang)
{
case FengXiang.:
if (dx < 10 && myPos.z < pos.z)
data.value++;
break;
case FengXiang.:
if (pos.x > myPos.x && pos.z > myPos.z)
data.value++;
break;
case FengXiang.:
if (dz < 10 && myPos.x < pos.x)
data.value++;
break;
case FengXiang.:
if (myPos.x < pos.x && myPos.z > pos.z)
data.value++;
break;
case FengXiang.:
if (dx < 10 && myPos.z > pos.z)
data.value++;
break;
case FengXiang.西:
if (myPos.x > pos.x && myPos.z > pos.z)
data.value++;
break;
case FengXiang.西:
if (dz < 10 && myPos.x > pos.x)
data.value++;
break;
case FengXiang.西:
if (myPos.z < pos.z && myPos.x > pos.x)
data.value++;
break;
default:
break;
}
if (weatherMgr.TianQiSettingData.fengli==FengLi.)
{
data.value = 0;
}
return data;
}
}
public class IntData
{
public int value;
public IntData(int initValue)
{
value = initValue;
}
public void Clear()
{
value = 0;
}
}