网上演练贵港万达广场(人员密集)
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.
 
 
 

130 lines
4.6 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Leak1Data
{
public long ID;
public bool CatchFire;
public Vector3 BottomScale;
public BoxCollider BoxC;
public float NowScale;
public Transform BodyTransform;
public float ShapRadius;
}
public class Leak1Controller : MonoBehaviour
{
public long OilTankId;
public bool CatchFire;
private float timmer = 1;
private Leak1Data myData;
private KeyValuePair<long, object> Mydata;
void Start()
{
myData = new Leak1Data();
Mydata = new KeyValuePair<long, object>();
FireScaleValue.GetAllFireScales += addMyFireScale;
}
void Update()
{
timmer -= Time.deltaTime;
if (timmer <= 0)
{
if (!CheckFireArround())
{
timmer = 1;
}
}
//if (Input.GetKeyDown(KeyCode.T))
//{
// Mydata = PushData();
// Debug.Log("ttttt");
// Debug.Log(Mydata.Value);
//}
//if (Input.GetKeyDown(KeyCode.S))
//{
// PullData(Mydata);
// Debug.Log("ttttt1");
//}
}
void OnDestroy()
{
FireScaleValue.GetAllFireScales -= addMyFireScale;
}
private bool CheckFireArround()
{
bool hasFire = false;
return hasFire;
}
public void Initialize(Vector3 hitPoint, OilTankMessage TankMsg)
{
float dis = 0;
RaycastHit[] AllHit = Physics.RaycastAll(hitPoint, Vector3.down, 100f, LayerMask.NameToLayer("SoliderRoad"));
foreach (RaycastHit hit in AllHit)
{
Debug.Log(hit.transform.name + "down");
//if (hit.transform.name.Contains("DiMian"))
if (!hit.transform.parent.GetComponent<OilTankMessage>()
&& hit.transform.name.Contains("Floor"))
{
dis = Vector3.Distance(hit.point, hitPoint);
Debug.Log(dis);
}
}
TankMsg.HasLeakeSet = true;
///如果是导调组或者灾情管理员
if ((CurrentUserInfo.room!=null&&CurrentUserInfo.mySelf.Id==CurrentUserInfo.room.Owner.UserInfo.Id)
||GameSettings.othersSettings.mode==Mode.DisasterManagement)
{
if (OilSetManager.GetInstance.gameObject.activeSelf)
OilSetManager.GetInstance.ChuLiangSlider.GetComponent<Slider>().interactable = false;
}
transform.localScale = new Vector3(1, dis / 9, 1);
transform.Translate(Vector3.down * (dis / 2 - 0.4f));
Vector3 hitobjVec = TankMsg.transform.position;
transform.LookAt(new Vector3(hitobjVec.x, transform.position.y, hitobjVec.z));
}
/// <summary>
/// 泄露火,统计过火面积
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
private FloatData addMyFireScale(FloatData data)
{
int tempMaxFireArea = Mathf.RoundToInt(GetComponent<BoxCollider>().size.x)
* Mathf.RoundToInt(GetComponent<BoxCollider>().size.z);
data.value += tempMaxFireArea;
return data;
}
//public override KeyValuePair<long, object> PushData()
//{
// myData.ID = GetComponent<CloneGameObjInfo>().gameObjID;
// myData.BodyTransform = transform;
// myData.BoxC = GetComponent<BoxCollider>();
// myData.BottomScale = transform.Find("BottomOil").transform.localScale;
// myData.BodyTransform = transform;
// myData.NowScale = myData.BottomScale.x;
// myData.ShapRadius = transform.Find("FireBottom").GetComponent<ParticleControl>().NowShape;
// return new KeyValuePair<long, object>(myData.ID, myData);
//}
//public override void PullData(KeyValuePair<long, object> data)
//{
// if (data.Key != GetComponent<CloneGameObjInfo>().gameObjID)
// return;
// myData = (Leak1Data)data.Value;
// transform.localPosition = myData.BodyTransform.localPosition;
// transform.localScale = myData.BodyTransform.localScale;
// transform.localEulerAngles = myData.BodyTransform.localEulerAngles;
// transform.localRotation = myData.BodyTransform.localRotation;
// GetComponent<BoxCollider>().size = myData.BoxC.size;
// transform.Find("BottomOil").transform.localScale = myData.BottomScale;
// transform.Find("BottomOil").GetComponent<OilSpread>().ranyouScale = myData.NowScale;
// transform.Find("FireBottom/fire (8)").GetComponent<ParticleControl>().NowShape = myData.ShapRadius;
// transform.Find("FireBottom").GetComponent<ParticleControl>().NowShape = myData.ShapRadius;
//}
}