private void OnEnable() { if (_isCustom) { return; } if (_unitCtrl == null) { _unitCtrl = transform.parent.GetComponent <UnitController>(); LogMessage.Log("UnitAnimation : UnitCtrl is NULL"); } if (_ani == null) { _ani = GetComponent <Animator>(); LogMessage.Log("UnitAnimation : Ani is NULL"); } _ani.SetFloat(_idAttackSpd, _unitCtrl.AttackSpeed); _ani.SetBool(_idAttack, false); if (_unitCtrl._status._equipedItems == null) { LogMessage.Log("UNitCtrl Status is null Error"); return; } UnitAnimationManager.Update(_unitCtrl._status._equipedItems[2], _unitCtrl._status._equipedItems[3], _ani); }
public static bool IsAbleToAct(this UnitEntityData unit) { UnitState state = unit.Descriptor.State; UnitAnimationManager animationManager = unit.View?.AnimationManager; bool isProne = state.Prone.Active; int exclusiveState = 0; state.Prone.Active = false; if (animationManager && ((exclusiveState = animationManager.GetExclusiveState()) == 1 || exclusiveState == 2)) { animationManager.SetExclusiveState(0); } bool result = (state.CanAct || state.CanMove) && !state.HasCondition(UnitCondition.Prone); state.Prone.Active = isProne; if (exclusiveState == 1 || exclusiveState == 2) { animationManager.SetExclusiveState(exclusiveState); } return(result); }
public static void SetExclusiveState(this UnitAnimationManager unitAnimationManager, int value) { typeof(UnitAnimationManager) .GetField("m_ExclusiveState", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(unitAnimationManager, value); }
public static int GetExclusiveState(this UnitAnimationManager unitAnimationManager) { return((int)typeof(UnitAnimationManager) .GetField("m_ExclusiveState", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(unitAnimationManager)); }