Browse Source

同步改动调整楼层切换视角

develop
杨栋梁 4 years ago
parent
commit
8bb70dd403
  1. 2
      Assets/MscPublic/Assets/Scripts/MainScene/FloorControlModule/UIFloor.cs
  2. 18
      Assets/Scripts/Common/Disasters/Wound_Trapped/TrappedMoveFree.cs
  3. 41
      Assets/Scripts/DongYouLiQing/4GMap/FourthGCamCtrl.cs
  4. 23
      Assets/Scripts/DongYouLiQing/4GMap/QuadCamera.cs
  5. 29
      Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/FireFightNormal.cs
  6. 32
      Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/SpreadFireController.cs

2
Assets/MscPublic/Assets/Scripts/MainScene/FloorControlModule/UIFloor.cs

@ -28,7 +28,7 @@ public class UIFloor : BaseToggle
public GameObject HasChild;//显示该建筑(区域)下的所有楼层 public GameObject HasChild;//显示该建筑(区域)下的所有楼层
public Transform MyTarget; public Transform MyTarget;
//private CameraManager cameraManager; //private CameraManager cameraManager;
private float FollowCameraDistance = 100f; private float FollowCameraDistance = 250f;
private CameraManager cameraManager; private CameraManager cameraManager;
private Transform P_AllParent; private Transform P_AllParent;
private void Start() private void Start()

18
Assets/Scripts/Common/Disasters/Wound_Trapped/TrappedMoveFree.cs

@ -186,7 +186,7 @@ public class TrappedMoveFree : MonoBehaviour
public void OnEnable() public void OnEnable()
{ {
//MessageDispatcher.AddListener("SetGuidpathIndex", AddGuidIndex); //MessageDispatcher.AddListener("SetGuidpathIndex", AddGuidIndex);
MessageDispatcher.AddListener("MOVE_MAN_COMMAND", MoveExcute); // MessageDispatcher.AddListener("MOVE_MAN_COMMAND", MoveExcute);
MessageDispatcher.AddListener("GUIDANCE_MAN_COMMAND", GuidanceTrapped); MessageDispatcher.AddListener("GUIDANCE_MAN_COMMAND", GuidanceTrapped);
MessageDispatcher.AddListener("FRISTAID_MAN_COMMAND", FristAidTrapped); MessageDispatcher.AddListener("FRISTAID_MAN_COMMAND", FristAidTrapped);
MessageDispatcher.AddListener("TRAPPED_MOVE_FOLLOW_GUIDE_POINT_COMMAND", MoveFollowGuidPoint); MessageDispatcher.AddListener("TRAPPED_MOVE_FOLLOW_GUIDE_POINT_COMMAND", MoveFollowGuidPoint);
@ -203,7 +203,7 @@ public class TrappedMoveFree : MonoBehaviour
public void OnDestroy() public void OnDestroy()
{ {
// MessageDispatcher.RemoveListener("SetGuidpathIndex", AddGuidIndex); // MessageDispatcher.RemoveListener("SetGuidpathIndex", AddGuidIndex);
MessageDispatcher.RemoveListener("MOVE_MAN_COMMAND", MoveExcute); //MessageDispatcher.RemoveListener("MOVE_MAN_COMMAND", MoveExcute);
MessageDispatcher.RemoveListener("GUIDANCE_MAN_COMMAND", GuidanceTrapped); MessageDispatcher.RemoveListener("GUIDANCE_MAN_COMMAND", GuidanceTrapped);
MessageDispatcher.RemoveListener("FRISTAID_MAN_COMMAND", FristAidTrapped); MessageDispatcher.RemoveListener("FRISTAID_MAN_COMMAND", FristAidTrapped);
MessageDispatcher.RemoveListener("TRAPPED_MOVE_FOLLOW_GUIDE_POINT_COMMAND", MoveFollowGuidPoint); MessageDispatcher.RemoveListener("TRAPPED_MOVE_FOLLOW_GUIDE_POINT_COMMAND", MoveFollowGuidPoint);
@ -219,7 +219,7 @@ public class TrappedMoveFree : MonoBehaviour
public void OnDisable() public void OnDisable()
{ {
//MessageDispatcher.RemoveListener("SetGuidpathIndex", AddGuidIndex); //MessageDispatcher.RemoveListener("SetGuidpathIndex", AddGuidIndex);
MessageDispatcher.RemoveListener("MOVE_MAN_COMMAND", MoveExcute); // MessageDispatcher.RemoveListener("MOVE_MAN_COMMAND", MoveExcute);
MessageDispatcher.RemoveListener("GUIDANCE_MAN_COMMAND", GuidanceTrapped); MessageDispatcher.RemoveListener("GUIDANCE_MAN_COMMAND", GuidanceTrapped);
MessageDispatcher.RemoveListener("FRISTAID_MAN_COMMAND", FristAidTrapped); MessageDispatcher.RemoveListener("FRISTAID_MAN_COMMAND", FristAidTrapped);
MessageDispatcher.RemoveListener("TRAPPED_MOVE_FOLLOW_GUIDE_POINT_COMMAND", MoveFollowGuidPoint); MessageDispatcher.RemoveListener("TRAPPED_MOVE_FOLLOW_GUIDE_POINT_COMMAND", MoveFollowGuidPoint);
@ -869,12 +869,12 @@ public class TrappedMoveFree : MonoBehaviour
//引导 //引导
if (Guidance) if (Guidance)
{ {
if (guidPoint.Count == 1 /*&& Vector3.Distance(transform.position, guidPoint[0]) < 2*/) if (guidPoint.Count == 1 /*&& Vector3.Distance(transform.position, guidPoint[0]) < 2*/)
{ {
if (TargetPosition!=guidPoint[0]) if (TargetPosition != guidPoint[0])
{ {
Debug.Log("<color=#00aa00ff>" + "sssssssss"+ "</color>"); Debug.Log("<color=#00aa00ff>" + "sssssssss" + "</color>");
TargetPosition = guidPoint[0]; TargetPosition = guidPoint[0];
if (CurrentUserInfo.room != null && CurrentUserInfo.mySelf.Id == CurrentUserInfo.room.Owner.UserInfo.Id) if (CurrentUserInfo.room != null && CurrentUserInfo.mySelf.Id == CurrentUserInfo.room.Owner.UserInfo.Id)
{ {
@ -913,7 +913,7 @@ public class TrappedMoveFree : MonoBehaviour
} }
else if (guidPoint.Count > 1) else if (guidPoint.Count > 1)
{ {
if (!guidPoint.Contains(TargetPosition)) if (!guidPoint.Contains(TargetPosition))
{ {
AddGuidIndex(); AddGuidIndex();
} }
@ -1021,11 +1021,11 @@ public class TrappedMoveFree : MonoBehaviour
void AniamtorSet() void AniamtorSet()
{ {
if (Haemal <= 50) if (Haemal <= 50)
{ {
return; return;
} }
if (nav.enabled==false) if (nav.enabled == false)
{ {
return; return;
} }

41
Assets/Scripts/DongYouLiQing/4GMap/FourthGCamCtrl.cs

@ -4,7 +4,8 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class FourthGCamCtrl : MonoBehaviour { public class FourthGCamCtrl : MonoBehaviour
{
public Vector3 QuaterView = Vector3.zero; public Vector3 QuaterView = Vector3.zero;
public float InitY; public float InitY;
private static FourthGCamCtrl instance; private static FourthGCamCtrl instance;
@ -26,15 +27,16 @@ public class FourthGCamCtrl : MonoBehaviour {
private Transform target; private Transform target;
private Vector3 preTargetPosition; private Vector3 preTargetPosition;
private bool lookOver = false; private bool lookOver = false;
private float height = 3; //查看人员模式下,摄像机高度 private float height = 1.5f; //查看人员模式下,摄像机高度
private float distance = 2; //查看人员模式下,人与摄像机之间的距离 private float distance = 2; //查看人员模式下,人与摄像机之间的距离
private float dampTrace = 20.0f; //查看人员模式下,摄像机平滑追踪的变量 private float dampTrace = 20.0f; //查看人员模式下,摄像机平滑追踪的变量
private float lookingAtHeight = 3.5f; private float lookingAtHeight = 2f;
private float lookingAtDistance = 5; private float lookingAtDistance = 5;
private bool isQuading = false; private bool isQuading = false;
// Use this for initialization // Use this for initialization
void Start () { void Start()
{
MessageDispatcher.AddListener("OpenFourthG", EnableCamera); MessageDispatcher.AddListener("OpenFourthG", EnableCamera);
MessageDispatcher.AddListener("QuadrupleMode", DisableCamera); MessageDispatcher.AddListener("QuadrupleMode", DisableCamera);
MessageDispatcher.AddListener("4GNobodySelected", NobodySelected); MessageDispatcher.AddListener("4GNobodySelected", NobodySelected);
@ -73,16 +75,16 @@ public class FourthGCamCtrl : MonoBehaviour {
{ {
var value = (bool)obj.Data; var value = (bool)obj.Data;
//如果打开了4G图传,又处于四分屏模式,则此相机禁用 //如果打开了4G图传,又处于四分屏模式,则此相机禁用
if(value ==true && isQuading == true) if (value == true && isQuading == true)
{ {
this.enabled = false; this.enabled = false;
cam.enabled = false; cam.enabled = false;
} }
//如果打开了4G图传,未处于四分屏模式,则此相机激活 //如果打开了4G图传,未处于四分屏模式,则此相机激活
else if(value==true && isQuading == false) else if (value == true && isQuading == false)
{ {
this.enabled = true; this.enabled = true;
cam.enabled = true; cam.enabled = true;
} }
//如果关闭了4G图传,则禁用此相机 //如果关闭了4G图传,则禁用此相机
else else
@ -100,26 +102,27 @@ public class FourthGCamCtrl : MonoBehaviour {
var value = (bool)obj.Data; var value = (bool)obj.Data;
isQuading = value; isQuading = value;
this.enabled = !value; this.enabled = !value;
cam.enabled = !value; cam.enabled = !value;
} }
// Update is called once per frame // Update is called once per frame
void Update () { void Update()
{
//有目标人员并且相机激活时才执行 //有目标人员并且相机激活时才执行
if (target != null && cam.enabled==true) if (target != null && cam.enabled == true)
{ {
if (!lookOver) if (!lookOver)
{ {
transform.position = new Vector3(target.position.x, transform.position.y, target.position.z); transform.position = new Vector3(target.position.x, transform.position.y, target.position.z);
} }
else else
{ {
//相机的位置,在人员胸前 //相机的位置,在人员胸前
transform.position = Vector3.Lerp(transform.position, target.position + (target.forward * distance) + (Vector3.up * height), Time.deltaTime * dampTrace); transform.position = Vector3.Lerp(transform.position, target.position + (target.forward * distance) + (Vector3.up * height), Time.deltaTime * dampTrace);
//transform.LookAt(target.position); //transform.LookAt(target.position);
transform.LookAt(target.position + (target.forward * lookingAtDistance) + (Vector3.up * lookingAtHeight)); transform.LookAt(target.position + (target.forward * lookingAtDistance) + (Vector3.up * lookingAtHeight));
} }
} }
} }
/// <summary> /// <summary>
/// 查看人员视角 /// 查看人员视角
/// </summary> /// </summary>
@ -127,7 +130,7 @@ public class FourthGCamCtrl : MonoBehaviour {
private void LookOverTarget(IMessage obj) private void LookOverTarget(IMessage obj)
{ {
var targetInfo = (CloneGameObjInfo)obj.Data; var targetInfo = (CloneGameObjInfo)obj.Data;
target = EntitiesManager.Instance.GetEntityByID(targetInfo.gameObjID).transform; target = EntitiesManager.Instance.GetEntityByID(targetInfo.gameObjID).transform;
GetComponent<Camera>().orthographic = false; //改为透视视角 GetComponent<Camera>().orthographic = false; //改为透视视角
lookOver = true; lookOver = true;
} }
@ -141,7 +144,7 @@ public class FourthGCamCtrl : MonoBehaviour {
transform.eulerAngles = QuaterView; transform.eulerAngles = QuaterView;
transform.position = new Vector3(transform.position.x, InitY, transform.position.z); transform.position = new Vector3(transform.position.x, InitY, transform.position.z);
GetComponent<Camera>().orthographic = true; //改回正交视角 GetComponent<Camera>().orthographic = true; //改回正交视角
lookOver = false; lookOver = false;
} }
/// <summary> /// <summary>
/// 在4G图传中有人员被选中,相机跟随该人员 /// 在4G图传中有人员被选中,相机跟随该人员
@ -150,7 +153,7 @@ public class FourthGCamCtrl : MonoBehaviour {
public void SetTarget(Transform tar) public void SetTarget(Transform tar)
{ {
target = tar; target = tar;
} }
/// <summary> /// <summary>
/// 没有人员被选中,取消地图相机跟随 /// 没有人员被选中,取消地图相机跟随
/// </summary> /// </summary>
@ -158,6 +161,6 @@ public class FourthGCamCtrl : MonoBehaviour {
void NobodySelected(IMessage obj) void NobodySelected(IMessage obj)
{ {
//preTargetPosition = target.position; //preTargetPosition = target.position;
target = null; target = null;
} }
} }

23
Assets/Scripts/DongYouLiQing/4GMap/QuadCamera.cs

@ -4,14 +4,15 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
public class QuadCamera : MonoBehaviour { public class QuadCamera : MonoBehaviour
{
public CloneGameObjInfo info; public CloneGameObjInfo info;
public Transform target; public Transform target;
private Camera myCam; private Camera myCam;
private float height = 3; //查看人员模式下,摄像机高度 private float height = 1.5f; //查看人员模式下,摄像机高度
private float distance = 2; //查看人员模式下,人与摄像机之间的距离 private float distance = 2; //查看人员模式下,人与摄像机之间的距离
private float dampTrace = 20.0f; //查看人员模式下,摄像机平滑追踪的变量 private float dampTrace = 20.0f; //查看人员模式下,摄像机平滑追踪的变量
private float lookingAtHeight = 3.5f; private float lookingAtHeight = 2f;
private float lookingAtDistance = 5; private float lookingAtDistance = 5;
void Awake() void Awake()
{ {
@ -22,14 +23,14 @@ public class QuadCamera : MonoBehaviour {
this.info = info; this.info = info;
MessageDispatcher.AddListener("CancelQuadDisplay", DeleteThisCamera); MessageDispatcher.AddListener("CancelQuadDisplay", DeleteThisCamera);
MessageDispatcher.AddListener("OpenFourthG", DisableCameraOpenTransfer); MessageDispatcher.AddListener("OpenFourthG", DisableCameraOpenTransfer);
MessageDispatcher.AddListener("QuadrupleMode", DisableCamera); MessageDispatcher.AddListener("QuadrupleMode", DisableCamera);
target = EntitiesManager.Instance.GetEntityByID(info.gameObjID).transform; target = EntitiesManager.Instance.GetEntityByID(info.gameObjID).transform;
} }
void OnDestroy() void OnDestroy()
{ {
MessageDispatcher.RemoveListener("CancelQuadDisplay", DeleteThisCamera); MessageDispatcher.RemoveListener("CancelQuadDisplay", DeleteThisCamera);
MessageDispatcher.RemoveListener("OpenFourthG", DisableCameraOpenTransfer); MessageDispatcher.RemoveListener("OpenFourthG", DisableCameraOpenTransfer);
MessageDispatcher.RemoveListener("QuadrupleMode", DisableCamera); MessageDispatcher.RemoveListener("QuadrupleMode", DisableCamera);
} }
/// <summary> /// <summary>
/// 关闭四分屏模式,或四分屏模式下关闭4G图传窗口,则禁用四分屏相机,减少性能消耗 /// 关闭四分屏模式,或四分屏模式下关闭4G图传窗口,则禁用四分屏相机,减少性能消耗
@ -37,7 +38,7 @@ public class QuadCamera : MonoBehaviour {
/// <param name="obj"></param> /// <param name="obj"></param>
private void DisableCamera(IMessage obj) private void DisableCamera(IMessage obj)
{ {
var value = (bool)obj.Data; var value = (bool)obj.Data;
this.enabled = value; this.enabled = value;
myCam.enabled = value; myCam.enabled = value;
} }
@ -53,7 +54,7 @@ public class QuadCamera : MonoBehaviour {
return; return;
} }
//打开图传面板时,在四分屏模式,则相机和此脚本开启 //打开图传面板时,在四分屏模式,则相机和此脚本开启
if (value==true && QuadrupleMode.quadingMode == true) if (value == true && QuadrupleMode.quadingMode == true)
{ {
this.enabled = true; this.enabled = true;
myCam.enabled = true; myCam.enabled = true;
@ -69,13 +70,13 @@ public class QuadCamera : MonoBehaviour {
var deleteInfo = (CloneGameObjInfo)obj.Data; var deleteInfo = (CloneGameObjInfo)obj.Data;
if (deleteInfo.gameObjID == info.gameObjID) if (deleteInfo.gameObjID == info.gameObjID)
{ {
Destroy(gameObject); Destroy(gameObject);
} }
else else
{ {
StartCoroutine(UpdateName()); StartCoroutine(UpdateName());
} }
} }
IEnumerator UpdateName() IEnumerator UpdateName()
{ {
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
@ -84,7 +85,7 @@ public class QuadCamera : MonoBehaviour {
void LateUpdate() void LateUpdate()
{ {
//有目标人员并且相机当前激活 //有目标人员并且相机当前激活
if (target && myCam.enabled==true) if (target && myCam.enabled == true)
{ {
//相机的位置,在人员胸前 //相机的位置,在人员胸前
transform.position = Vector3.Lerp(transform.position, target.position + (target.forward * distance) + (Vector3.up * height), Time.deltaTime * dampTrace); transform.position = Vector3.Lerp(transform.position, target.position + (target.forward * distance) + (Vector3.up * height), Time.deltaTime * dampTrace);

29
Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/FireFightNormal.cs

@ -60,14 +60,14 @@ public class FireFightNormal : MonoBehaviour
//将该火加入到对应的火堆字典中 //将该火加入到对应的火堆字典中
//因为蔓延火是在演练开始后才开始蔓延,所以能加进去 //因为蔓延火是在演练开始后才开始蔓延,所以能加进去
//只加蔓延火 //只加蔓延火
if (baseinfo.gameObjType==CloneObjType.SpreadedFire&& if (baseinfo.gameObjType == CloneObjType.SpreadedFire &&
GetComponent<SpreadedFireCtrl>()) GetComponent<SpreadedFireCtrl>())
{ {
long mainFireId = GetComponent<SpreadedFireCtrl>().fireGameObjID; long mainFireId = GetComponent<SpreadedFireCtrl>().fireGameObjID;
SpreadFireController.fireStruckContainDic[mainFireId].Add(this); SpreadFireController.fireStruckContainDic[mainFireId].Add(this);
} }
} }
void OnDisable() void OnDisable()
{ {
if (GameSettings.othersSettings.isStartDrill) if (GameSettings.othersSettings.isStartDrill)
{ {
@ -78,7 +78,7 @@ public class FireFightNormal : MonoBehaviour
{ {
SpreadFireController.fireStruckContainDic[baseinfo.gameObjID].Remove(this); SpreadFireController.fireStruckContainDic[baseinfo.gameObjID].Remove(this);
} }
} }
//主火(普通火)只隐藏不删除 //主火(普通火)只隐藏不删除
Straightwater.Clear(); Straightwater.Clear();
@ -93,14 +93,28 @@ public class FireFightNormal : MonoBehaviour
GetComponent<SpreadedFireCtrl>()) GetComponent<SpreadedFireCtrl>())
{ {
long mainFireId = GetComponent<SpreadedFireCtrl>().fireGameObjID; long mainFireId = GetComponent<SpreadedFireCtrl>().fireGameObjID;
if (SpreadFireController.fireStruckContainDic.ContainsKey(mainFireId)) if (SpreadFireController.fireStruckContainDic.ContainsKey(mainFireId))
{ {
if (SpreadFireController.fireStruckContainDic[mainFireId].Contains(this)) if (SpreadFireController.fireStruckContainDic[mainFireId].Contains(this))
{ {
SpreadFireController.fireStruckContainDic[mainFireId].Remove(this); SpreadFireController.fireStruckContainDic[mainFireId].Remove(this);
if (SpreadFireController.fireStruckContainDic[mainFireId].Count < 1)
{
EntitiesManager.Instance.DeleteObj(EntitiesManager.Instance.GetEntityByID(mainFireId));
if (GameSettings.othersSettings.mode != Mode.DisasterManagement)
{
if (CurrentUserInfo.room != null && CurrentUserInfo.mySelf.Id == CurrentUserInfo.room.Owner.UserInfo.Id)
{
BaseNetworkSyncDate arg = new BaseNetworkSyncDate();
arg.SendUserID = CurrentUserInfo.mySelf.Id;
arg.gameObjID = mainFireId;
NetworkManager.Default.SendAsync("OBJ_DELECT_SYNC", arg);
}
}
}
} }
} }
} }
Straightwater.Clear(); Straightwater.Clear();
FrothList.Clear(); FrothList.Clear();
@ -123,8 +137,8 @@ public class FireFightNormal : MonoBehaviour
void OnParticleCollision(GameObject other) void OnParticleCollision(GameObject other)
{ {
if (CurrentUserInfo.room!=null&&CurrentUserInfo.mySelf.Id == CurrentUserInfo.room.Owner.UserInfo.Id) if (CurrentUserInfo.room != null && CurrentUserInfo.mySelf.Id == CurrentUserInfo.room.Owner.UserInfo.Id)
{ {
if (baseinfo.gameObjType == CloneObjType.fireNormal) if (baseinfo.gameObjType == CloneObjType.fireNormal)
{ {
@ -187,6 +201,7 @@ public class FireFightNormal : MonoBehaviour
transform.GetChild(i).gameObject.SetActive(false); transform.GetChild(i).gameObject.SetActive(false);
} }
GetComponent<Collider>().enabled = false; GetComponent<Collider>().enabled = false;
SpreadFireController.fireStruckContainDic[baseinfo.gameObjID].Remove(this);
} }
} }

32
Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/SpreadFireController.cs

@ -20,7 +20,7 @@ public class SpreadFireController : MonoBehaviour
/// <summary> /// <summary>
/// 火堆字典,每个火堆对应几个火,key为火堆(主火id),list为这堆火由哪几个火组成 /// 火堆字典,每个火堆对应几个火,key为火堆(主火id),list为这堆火由哪几个火组成
/// </summary> /// </summary>
public static Dictionary<long, List<FireFightNormal>> fireStruckContainDic = new Dictionary<long, List<FireFightNormal>>(); public static Dictionary<long, List<FireFightNormal>> fireStruckContainDic = new Dictionary<long, List<FireFightNormal>>();
// Use this for initialization // Use this for initialization
void Start() void Start()
{ {
@ -45,17 +45,17 @@ public class SpreadFireController : MonoBehaviour
{ {
if (GameSettings.othersSettings.isStartDrill) if (GameSettings.othersSettings.isStartDrill)
{ {
if (flag==false) if (flag == false)
{ {
GetFireStruckList(); GetFireStruckList();
GetfireStruckContainDic(); GetfireStruckContainDic();
flag = true; flag = true;
} }
if (CurrentUserInfo.mySelf==null||CurrentUserInfo.room==null) if (CurrentUserInfo.mySelf == null || CurrentUserInfo.room == null)
{ {
return; return;
} }
if (CurrentUserInfo.mySelf.Id==CurrentUserInfo.room.Owner.UserInfo.Id) if (CurrentUserInfo.mySelf.Id == CurrentUserInfo.room.Owner.UserInfo.Id)
{ {
if (p_FireNormal.childCount > 0) if (p_FireNormal.childCount > 0)
{ {
@ -111,7 +111,7 @@ public class SpreadFireController : MonoBehaviour
if (baseinfo.gameObjType == CloneObjType.fireNormal) if (baseinfo.gameObjType == CloneObjType.fireNormal)
{ {
if (!fireNormalStruckList.Contains(baseinfo.gameObjID)) if (!fireNormalStruckList.Contains(baseinfo.gameObjID))
{ {
fireNormalStruckList.Add(baseinfo.gameObjID); fireNormalStruckList.Add(baseinfo.gameObjID);
} }
} }
@ -138,7 +138,7 @@ public class SpreadFireController : MonoBehaviour
{ {
for (int i = 0; i < fireNormalStruckList.Count; i++) for (int i = 0; i < fireNormalStruckList.Count; i++)
{ {
if (fireStruckContainDic[fireNormalStruckList[i]].Count<1) if (fireStruckContainDic[fireNormalStruckList[i]].Count < 1)
{ {
fireStruckContainDic.Remove(fireNormalStruckList[i]); fireStruckContainDic.Remove(fireNormalStruckList[i]);
fireNormalStruckList.Remove(fireNormalStruckList[i]); fireNormalStruckList.Remove(fireNormalStruckList[i]);
@ -155,28 +155,28 @@ public class SpreadFireController : MonoBehaviour
float fireArea = 0;//该火堆的面积 float fireArea = 0;//该火堆的面积
float waterControlArea = 0;//该火堆总控火面积 float waterControlArea = 0;//该火堆总控火面积
GameObject mainfire = EntitiesManager.Instance.GetEntityByID(fireNormalStruckList[i]); GameObject mainfire = EntitiesManager.Instance.GetEntityByID(fireNormalStruckList[i]);
List<FireFightNormal> nowstruck = fireStruckContainDic[fireNormalStruckList[i]]; List<FireFightNormal> nowstruck = fireStruckContainDic[fireNormalStruckList[i]];
for (int j = 0; j < nowstruck.Count; j++) for (int j = 0; j < nowstruck.Count; j++)
{ {
//该火堆中每个火的baseinfo //该火堆中每个火的baseinfo
BaseGameObjInfo info = nowstruck[j].GetComponent<BaseGameObjInfo>(); BaseGameObjInfo info = nowstruck[j].GetComponent<BaseGameObjInfo>();
if (info.gameObjType==CloneObjType.fireNormal) if (info.gameObjType == CloneObjType.fireNormal)
{ {
fireArea += info.GetComponent<FireSpreadCtrl>().fireAttribute.initialSize; fireArea += info.GetComponent<FireSpreadCtrl>().fireAttribute.initialSize;
} }
if(info.gameObjType == CloneObjType.SpreadedFire) if (info.gameObjType == CloneObjType.SpreadedFire)
{ {
fireArea += 10; fireArea += 10;
} }
if (info.GetComponent<FireFightNormal>().Straightwater.Count>0) if (info.GetComponent<FireFightNormal>().Straightwater.Count > 0)
{ {
//作用在某个火的面积 //作用在某个火的面积
for (int k = 0; k < info.GetComponent<FireFightNormal>().Straightwater.Count; k++) for (int k = 0; k < info.GetComponent<FireFightNormal>().Straightwater.Count; k++)
{ {
WaterFightFire water = info.GetComponent<FireFightNormal>().Straightwater[k]; WaterFightFire water = info.GetComponent<FireFightNormal>().Straightwater[k];
if (water.GetComponentInParent<BaseGameObjInfo>().gameObjType == CloneObjType.fireman|| if (water.GetComponentInParent<BaseGameObjInfo>().gameObjType == CloneObjType.fireman ||
water.GetComponentInParent<BaseGameObjInfo>().gameObjType == CloneObjType.FirefightingRobot) water.GetComponentInParent<BaseGameObjInfo>().gameObjType == CloneObjType.FirefightingRobot)
{ {
waterControlArea += 50; waterControlArea += 50;
@ -188,17 +188,19 @@ public class SpreadFireController : MonoBehaviour
} }
} }
} }
//如果可以控制住 //如果可以控制住
if (waterControlArea >= fireArea)
if (waterControlArea > fireArea)
{ {
mainfire.GetComponent<FireSpreadCtrl>().BeController = true; mainfire.GetComponent<FireSpreadCtrl>().BeController = true;
} }
else else
{ {
mainfire.GetComponent<FireSpreadCtrl>().BeController = false; mainfire.GetComponent<FireSpreadCtrl>().BeController = false;
} }
} }
} }
} }

Loading…
Cancel
Save