天津23维预案
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.

47 lines
1.2 KiB

2 years ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OilSpread : MonoBehaviour {
// Use this for initialization
void Start () {
ranyou = this.gameObject;
capsule = this.GetComponent<CapsuleCollider>();
}
public bool oilSpred;//开始蔓延
/// <summary>
/// 蔓延速度
/// </summary>
[SerializeField]
private float SpreadSpeed = 0.05f;
[SerializeField]
private float scale = 1.2f;
void Update ()
{
if (oilSpred)
RanYouControl();
}
/// <summary>
/// 燃油
/// </summary>
private GameObject ranyou;
private float ranyouScale = 0;
private void RanYouControl()
{
if (ranyouScale < scale-0.1f)
{
// CapsuleRadius();
ranyouScale += Time.deltaTime * SpreadSpeed * (scale - ranyouScale);
ranyou.transform.localScale = new Vector3(ranyouScale, ranyou.transform.localScale.y, ranyouScale);
}
}
private CapsuleCollider capsule;
private void CapsuleRadius()
{
capsule.radius += Time.deltaTime * SpreadSpeed * (scale - ranyouScale) * 2;
}
}