|
|
|
|
|
|
using System; |
|
|
|
using MLAPI; |
|
|
|
using UnityEngine; |
|
|
|
using Cinemachine; |
|
|
|
|
|
|
|
|
|
|
m_NetState = this.transform.parent.gameObject.GetComponent<NetworkCharacterState>(); |
|
|
|
m_NetState.DoActionEventClient += this.PerformActionFX; |
|
|
|
m_NetState.NetworkLifeState.OnValueChanged += OnLifeStateChanged; |
|
|
|
|
|
|
|
//we want to follow our parent on a spring, which means it can't be directly in the transform hierarchy.
|
|
|
|
m_Parent = transform.parent; |
|
|
|
|
|
|
{ |
|
|
|
//TODO: [GOMPS-13] break this method out into its own class, so we can drive multi-frame graphical effects.
|
|
|
|
//FIXME: [GOMPS-13] hook this up to information in the ActionDescription.
|
|
|
|
m_ClientVisualsAnimator.SetInteger("AttackID", 1); |
|
|
|
m_ClientVisualsAnimator.SetTrigger("BeginAttack"); |
|
|
|
|
|
|
|
switch (data.ActionTypeEnum) |
|
|
|
{ |
|
|
|
case ActionType.TANK_BASEATTACK: |
|
|
|
m_ClientVisualsAnimator.SetInteger("AttackID", 1); |
|
|
|
m_ClientVisualsAnimator.SetTrigger("BeginAttack"); |
|
|
|
break; |
|
|
|
case ActionType.ARCHER_BASEATTACK: |
|
|
|
break; |
|
|
|
case ActionType.GENERAL_CHASE: |
|
|
|
break; |
|
|
|
case ActionType.GENERAL_REVIVE: |
|
|
|
m_ClientVisualsAnimator.SetTrigger("Action - Revive"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new ArgumentOutOfRangeException(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void OnLifeStateChanged(LifeState previousValue, LifeState newValue) |
|
|
|
{ |
|
|
|
switch (newValue) |
|
|
|
{ |
|
|
|
case LifeState.ALIVE: |
|
|
|
m_ClientVisualsAnimator.SetTrigger("StandUp"); |
|
|
|
break; |
|
|
|
case LifeState.FAINTED: |
|
|
|
m_ClientVisualsAnimator.SetTrigger("FallDown"); |
|
|
|
break; |
|
|
|
case LifeState.DEAD: |
|
|
|
m_ClientVisualsAnimator.SetTrigger("Dead"); |
|
|
|
break; |
|
|
|
default: |
|
|
|
throw new ArgumentOutOfRangeException(nameof(newValue), newValue, null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Update() |
|
|
|