public void ProcessAction( ActionTypeName currentAction) { ProcessEffects (); if (m_actionReceiverEntity != null) { currentController = m_actionReceiverEntity.gameObject.GetComponent<AniStateController> (); } switch (currentAction) { case ActionTypeName.DealDamage: { if (m_actionReceiverEntity != null) { m_actionReceiverEntity.ApplyDamage(_damageAmount); Debug.Log ("Damage Dealt to: " + _actionReceiver.name); if ( currentController != null ) { currentController.StartCoroutine("TakeHit", 0.25f ); } } break; } case ActionTypeName.AddHealth: { if (m_actionCasterEntity != null) { m_actionCasterEntity.AddHealth(_healAmount); Debug.Log ("Health added to: " + _actionCaster.name); } break; } case ActionTypeName.AddArmor: { if (m_actionCasterEntity != null) { m_actionCasterEntity.AddArmor(_armorAdd); Debug.Log ("Armor added to: " + _actionCaster.name); } break; } case ActionTypeName.DetractArmor: { if (m_actionReceiverEntity != null) { m_actionReceiverEntity.DetractArmor(_armorDetract); if ( currentController != null ) { currentController.StartCoroutine("TakeHit", 0.25f ); } } break; } } }
void Start() { _target = FindObjectOfType<HeroController> ().gameObject; _actionToPassCombat = _autoAction; _EntityController = this.gameObject.GetComponent<EntityMain> (); m_aniController = gameObject.GetComponent<AniStateController> (); if (m_aniController == null) Debug.LogWarning ("No Animation Controller on Enemy!"); }
/// <summary> /// Update /// </summary> public override void Update(float time, AniStateController controller) { if (Input.GetKeyDown(KeyCode.A)) { controller.SetAniState(SetState(enumAniState.Attack1)); } if (Input.GetKeyDown(KeyCode.S)) { controller.SetAniState(SetState(enumAniState.Attack2)); } }
/// <summary> /// Update /// </summary> public override void Update(float time, AniStateController controller) { updateTime += time; if (updateTime > 0.8f) { controller.SetAniState(SetState(_reserveState)); } else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S)) { switch (currentAniState) { case enumAniState.Attack1: _reserveState = enumAniState.Attack2; break; case enumAniState.Attack2: _reserveState = enumAniState.Attack3; break; } } }
public abstract void Update(float time, AniStateController controller);
// Use this for initialization void Start() { Animator anim = gameObject.GetComponent <Animator>(); controller = new AniStateController(anim); }