Browse Source

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

develop
杨栋梁 4 years ago
parent
commit
8bb70dd403
  1. 2
      Assets/MscPublic/Assets/Scripts/MainScene/FloorControlModule/UIFloor.cs
  2. 12
      Assets/Scripts/Common/Disasters/Wound_Trapped/TrappedMoveFree.cs
  3. 19
      Assets/Scripts/DongYouLiQing/4GMap/FourthGCamCtrl.cs
  4. 11
      Assets/Scripts/DongYouLiQing/4GMap/QuadCamera.cs
  5. 19
      Assets/Scripts/DongYouLiQing/BaseCommander/WaterFightFire/FireFightNormal.cs
  6. 20
      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()

12
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);
@ -872,9 +872,9 @@ public class TrappedMoveFree : MonoBehaviour
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)
{ {
@ -1025,7 +1025,7 @@ public class TrappedMoveFree : MonoBehaviour
{ {
return; return;
} }
if (nav.enabled==false) if (nav.enabled == false)
{ {
return; return;
} }

19
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,13 +75,13 @@ 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;
@ -103,9 +105,10 @@ public class FourthGCamCtrl : MonoBehaviour {
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)
{ {

11
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()
{ {
@ -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;
@ -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);

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

@ -60,7 +60,7 @@ 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;
@ -98,6 +98,20 @@ public class FireFightNormal : MonoBehaviour
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);
}
}
}
} }
} }
@ -124,7 +138,7 @@ 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);
} }
} }

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

@ -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)
{ {
@ -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]);
@ -162,21 +162,21 @@ public class SpreadFireController : MonoBehaviour
{ {
//该火堆中每个火的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;
@ -190,7 +190,8 @@ public class SpreadFireController : MonoBehaviour
} }
//如果可以控制住 //如果可以控制住
if (waterControlArea >= fireArea)
if (waterControlArea > fireArea)
{ {
mainfire.GetComponent<FireSpreadCtrl>().BeController = true; mainfire.GetComponent<FireSpreadCtrl>().BeController = true;
@ -199,6 +200,7 @@ public class SpreadFireController : MonoBehaviour
{ {
mainfire.GetComponent<FireSpreadCtrl>().BeController = false; mainfire.GetComponent<FireSpreadCtrl>().BeController = false;
} }
} }
} }
} }

Loading…
Cancel
Save