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.
162 lines
5.3 KiB
162 lines
5.3 KiB
using System; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
|
|
public class OilTankMessage : CloneGameObjInfo |
|
{ |
|
#region 罐体信息 |
|
[Rename("储物包括(原油、重油、柴油、汽油、液化气、有毒气体)")] |
|
public string MatterContainer = "原油";//储物 |
|
[Range(0, 1f)] |
|
[Rename("储量")] |
|
public float Reserves = 0.5f;//储量 |
|
public TankType MyType; |
|
[Rename("承受时间(分钟)")] |
|
public float TakeTime; |
|
[Rename("持续时间(分钟)")] |
|
public float DurationTime; |
|
[Rename("泄漏流速(㎥/s)")] |
|
public float FlowRate; |
|
[Range(0, 1f), Rename("沸溢机率")] |
|
public float BoilProb; |
|
[Rename("=固有高度*储量")] |
|
public float OutShowHeight; |
|
[Rename("罐体实际外壁直径")] |
|
public float Tank_D; |
|
[Rename("罐体实际高度")] |
|
public float TankHeight; |
|
#endregion |
|
public bool HasLeakeSet; |
|
|
|
public string GuanQuName; |
|
[HideInInspector] |
|
public OilTankBase MyBaseMessage; |
|
//[HideInInspector] |
|
//public float MyHeight = 1f;//自身罐体高度(本场景是Z) |
|
public float MyHeight = 1f;//自身罐体高度(本场景是Y) |
|
private Transform OilStandard; |
|
public float ReservesMeshHeight;//表示储量的绿色模型高度(Z轴上的) |
|
public float OilStandardAxis = 1f;//调整储量液面高度的参数 |
|
#region 爆炸参数 |
|
// 是否爆炸 |
|
public bool IsCanExplode = false; |
|
// 冷却爆炸时间 |
|
public int ExplodeTime = 0; |
|
// 爆炸死亡范围 |
|
public int ExplodeDeadRange = 0; |
|
// 爆炸受伤范围 |
|
public int ExplodeHurtRange = 0; |
|
// 是否可以喷溅沸溢 |
|
public bool IsCanBoilOver = false; |
|
// 喷溅时间 |
|
public int SplashTime = 0; |
|
// 发生喷溅几率 |
|
public int SplashProbability = 0; |
|
// 沸溢几率 |
|
public int BoilOverTime = 0; |
|
// 发生沸溢几率 |
|
public int BoilOverProbability = 0; |
|
// 喷溅死亡范围 |
|
public int BoilOverDeadRange = 0; |
|
// 罐体半径 11-20 |
|
public float OilTankRadius = 20f; |
|
#endregion |
|
|
|
|
|
void Awake() |
|
{ |
|
MyBaseMessage = GetComponent<OilTankBase>(); |
|
//if (MyType==TankType.外浮顶罐) |
|
//{ |
|
// ReservesMeshHeight = transform.Find("OilStandard").GetChild(0).GetComponent<MeshFilter>().mesh.bounds.size.y; |
|
//} |
|
//if (MyType==TankType.固定拱顶罐) |
|
//{ |
|
// ReservesMeshHeight = transform.Find("OilStandard").GetChild(0).GetComponent<MeshFilter>().mesh.bounds.size.z; |
|
//} |
|
//MatterContainer = "原油"; |
|
|
|
OilStandard = transform.Find("OilStandard"); |
|
//MyHeight = GetComponent<MeshFilter>().mesh.bounds.size.z * 0.85f; |
|
MyHeight = 1f; |
|
Reserves = 0.5f; |
|
OutShowHeight = MyHeight * Reserves; |
|
//MyBaseMessage = GetComponent<OilTankBase>(); |
|
|
|
//Tank_D = MyBaseMessage.Tank_D; |
|
//TankHeight = MyBaseMessage.TankHeight; |
|
|
|
//GuanQuName = MyBaseMessage.GuanQuName; |
|
if (OilStandard) |
|
SetOilStandard(); |
|
} |
|
// 设置爆炸数据 |
|
public void SetExplodeData(int explodeTime,int explodeDeadRange,int explodeHurtRange,bool isExplode) |
|
{ |
|
ExplodeTime = explodeTime; |
|
ExplodeDeadRange = explodeDeadRange; |
|
ExplodeHurtRange = explodeHurtRange; |
|
IsCanExplode = isExplode; |
|
} |
|
// 设置喷溅沸溢 |
|
public void SetBoilOverData(int splashTime, int splashProbability, int boilOverTime, int boilOverProbability, int boilOverDeadRange,bool isBoilOver) |
|
{ |
|
SplashTime = splashTime; |
|
SplashProbability = splashProbability; |
|
BoilOverTime = boilOverTime; |
|
BoilOverProbability = boilOverProbability; |
|
BoilOverDeadRange = boilOverDeadRange; |
|
IsCanBoilOver = isBoilOver; |
|
} |
|
public void SetOilTank(string chuwu, float chuliang) |
|
{ |
|
MatterContainer = chuwu; |
|
Reserves = chuliang; |
|
//给定碰撞到达罐体的储量位置 |
|
OutShowHeight = MyHeight * chuliang; |
|
SetOilStandard(); |
|
} |
|
public override void Start() |
|
{ |
|
base.Start(); |
|
} |
|
|
|
// Update is called once per frame |
|
void Update() |
|
{ |
|
|
|
} |
|
|
|
public void SetOilStandard() |
|
{ |
|
if (OilStandard) |
|
{ |
|
//OilStandard.transform.localScale = new Vector3(OilStandard.transform.localScale.x, OutShowHeight / 2, OilStandard.transform.localScale.z); |
|
//float offset = -(MyHeight - OutShowHeight) / 2; |
|
//OilStandard.localPosition = new Vector3(OilStandard.localPosition.x, OilStandard.localPosition |
|
// .y, offset - 1); |
|
|
|
if (CurrentUserInfo.role != Role.导调组 && CurrentUserInfo.mySelf.Roles[0].DisplayName != "灾情库管理员") |
|
{ |
|
OilStandard.gameObject.SetActive(false); |
|
} |
|
else |
|
{ |
|
OilStandard.gameObject.SetActive(true); |
|
} |
|
|
|
OilStandard.transform.localScale = new Vector3(OilStandard.transform.localScale.x, OutShowHeight* OilStandardAxis, OilStandard.transform.localScale.z); |
|
float offset = -(MyHeight - OutShowHeight) / 2; |
|
//OilStandard.localPosition = new Vector3(OilStandard.localPosition.x, OilStandard.localPosition |
|
// .y, offset - 1); |
|
} |
|
} |
|
} |
|
|
|
public enum TankType |
|
{ |
|
固定拱顶罐, |
|
内浮顶罐, |
|
外浮顶罐, |
|
} |