chenxin
2020-11-25 554eda43e00d5817cd3e06a60e39d4bd882ee584
Assets/Scripts/TowerDefense/Towers/TowerFireTrigger.cs
@@ -1,5 +1,3 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TowerDefense.Affectors;
@@ -14,28 +12,29 @@
    {
        public AttackAffector Affector;
        private bool isStart;
        // private bool isStart;
        private float duration;
        // private float duration;
        public void OnFire()
        {
            if (!isStart)
            {
                isStart = true;
            }
            else
            {
                Debug.Log($"--------------------- {duration} ---------------------");
                duration = 0;
            }
            // cx test
            // if (!isStart)
            // {
            //     isStart = true;
            // }
            // else
            // {
            //     Debug.Log($"--------------------- {duration} ---------------------");
            //     duration = 0;
            // }
            Affector.FireProjectile();
        }
        private void Update()
        {
            if (isStart)
                duration += Time.deltaTime;
        }
        // private void Update()
        // {
        //     if (isStart)
        //         duration += Time.deltaTime;
        // }
    }
}