上海苏宁宝丽嘉酒店,2020.11.17 15:30改为单机版本,以后合成单机版本可以以此版本为模板
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.
 
 
 
 

79 lines
2.3 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;
}
return data;
}
}
public class IntData
{
public int value;
public IntData(int initValue)
{
value = initValue;
}
public void Clear()
{
value = 0;
}
}