大连中石油电子沙盘
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.
 
 
 
 

64 lines
1.8 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OilSpread : MonoBehaviour
{
//private CapsuleCollider capsule;
public BoxCollider boxColider;
// Use this for initialization
void Start()
{
ranyou = this.gameObject;
//capsule = this.GetComponent<CapsuleCollider>();
//boxColider = GetComponent<BoxCollider>();
}
public bool oilSpred;//开始蔓延
/// <summary>
/// 蔓延速度
/// </summary>
[SerializeField]
private float SpreadSpeed = 0.05f;
[SerializeField]
public float scale = 1.2f;
void Update()
{
//if (oilSpred && capsule)
if (oilSpred && boxColider)
RanYouControl();
}
/// <summary>
/// 燃油
/// </summary>
private GameObject ranyou;
public float ranyouScale = 0;
private void RanYouControl()
{
if (ranyouScale < scale - 0.1f)
{
//CapsuleRadius();
BoxColiderController();
ranyouScale += Time.deltaTime * SpreadSpeed * (scale - ranyouScale) * ReplayManager.playSpeed;
ranyou.transform.localScale = new Vector3(ranyouScale, ranyou.transform.localScale.y, ranyouScale);
}
}
private void BoxColiderController()
{
float can = boxColider.size.x;
can += Time.deltaTime * SpreadSpeed * (scale - ranyouScale) * 4.5f * ReplayManager.playSpeed;
boxColider.size = new Vector3(can, 1.5f, can);
}
//private void CapsuleRadius()
//{
// capsule.radius += Time.deltaTime * SpreadSpeed * (scale - ranyouScale) * 2;
//}
public void DelaySet()
{
transform.localScale = new Vector3(1.1f, 0.7f, 1.1f);
Destroy(GetComponent<CapsuleCollider>());
transform.parent.GetComponent<SetFireDire>().SetRanYouPos();
}
}