using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerBlink : MonoBehaviour { public bool isBlinking = false; public float currentTime = 0f; public float TimeAmount = 1f; public int BlinkTimes = 3; public int maxBlinks = 3; // Use this for initialization void Start () { } // Update is called once per frame void Update () { Blink(); } void Blink() { if (isBlinking) { if (BlinkTimes > 0) { if (currentTime < TimeAmount) { this.GetComponent().enabled = false; currentTime = currentTime + Time.deltaTime; } else { this.GetComponent().enabled = true; BlinkTimes -= 1; currentTime = 0; } } else { isBlinking = false; } } else { BlinkTimes = maxBlinks; } } }