/// <summary> /// allow to initialise the object caracteristics /// </summary> /// <param name="pPV"> current HP </param> /// <param name="pMaxPV"> current max HP </param> /// <param name="pArmor"> the current Ar mor</param> /// <param name="pState"> the initialise state </param> public void SetCarac(int pPV, int pMaxPV, int pArmor = 0, TouchableState pState = TouchableState.normal) { _currentLife = pPV; _maxLife = pMaxPV; _armor = pArmor; _state = pState; }
/// <summary> /// allow to change the state of the object /// </summary> /// <param name="pState"> the next state of the object </param> public void SetTouchableState(TouchableState pState) { _state = pState; }
protected virtual void SetState(TouchableState _state) { State = _state; if (_state == TouchableState.Normal) { if (Image != null && NormalSprite != null) Image.sprite = NormalSprite; } else if (_state == TouchableState.Pressed) { if (Image != null && PressedSprite != null) Image.sprite = PressedSprite; } else if (_state == TouchableState.Disabled) { if (Image != null && DisabledSprite != null) Image.sprite = DisabledSprite; } if (Image != null && Image.type == Image.Type.Simple) Image.SetNativeSize(); }