IEnumerator RunImmortality(ImmortalType immortalType) { SwitchColor(immortalType); yield return(new WaitForSeconds(immortalTime)); isImmortal = false; }
// Use this for initialization protected override void Initialize() { base.Initialize(); initialColor = renderers.Count > 0 ? renderers [0].color : Color.white; newColor = oldColor = initialColor; currentImmortalType = ImmortalType.INVALID; currentColorIndex = 0; }
public void ChangePlayerColor(ImmortalType immortalType, float duration) { currentImmortalType = immortalType; StartCoroutine("SwitchColor", duration); // switch (immortalType) // { // case ImmortalType.RECOVERING: // StartCoroutine ("Flashing", duration); // break; // case ImmortalType.ITEM: // StartCoroutine ("SwitchColor", duration); // break; // } }
protected virtual void SwitchColor(ImmortalType immortalType) { }
protected override void EndOfSwitching() { ApplyColor(initialColor); currentImmortalType = ImmortalType.INVALID; currentColorIndex = 0; }
protected override void SwitchColor(ImmortalType immortalType) { colorChanger.ChangePlayerColor(immortalType, immortalTime); }