protected override void Trigger(GameEventData eventData) { SingleUnitData data = eventData.CastDataType <SingleUnitData>(); if (data == null) { return; } Unit unit = data.m_Unit; int value = unit.m_Data.GetStat(property); if (value > 0) { int negative = unit.m_Data.GetStat(UnitStatsProperty.Negative); int dur = unit.m_Data.GetStat(UnitStatsProperty.DUR); if (negative <= 0 && dur > 0) { value = -value; } data.m_Unit.m_Data.ChangeStats(UnitStatsProperty.DUR, value); } }
private void TriggerEvent() { SingleUnitData data = new SingleUnitData(); data.m_Unit = m_Owner; m_DestroyEvent.Trigger(m_Owner, data); }
private void WarriorDestroy(Unit unit) { if (unit.m_Data.IsWarrior) { SingleUnitData data = new SingleUnitData(); data.m_Unit = unit; m_WarriorDestroyEvent.Trigger(data); } }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //get current unit Unit unit = OrderManager.Instance.CurrentUnit; SingleUnitData data = new SingleUnitData(); data.m_Unit = unit; unitTurnEndEvent.Trigger(unit, data); unit = OrderManager.Instance.NextUnit(); NextState(animator, unit); }
private void UnitDestroy(GameEventData eventData) { //Debug.Log(this + " Receive Unit Destroy Event"); SingleUnitData data = eventData.CastDataType <SingleUnitData>(); if (data != null) { Unit unit = data.m_Unit; UnitToRemove.Add(unit); //Debug.Log(this + " chain "+ chain); m_UnitDestroyEvent.UnregisterListenner(unit, UnitDestroy); } RemoveListenner(); }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { //get current unit Unit unit = OrderManager.Instance.CurrentUnit; if (unit == null) { animator.SetTrigger(gameEndTrigger); return; } SingleUnitData data = new SingleUnitData(); data.m_Unit = unit; unitTurnStartEvent.Trigger(unit, data); NextState(animator, unit); }
void Display(GameEventData data) { if (data == null) { gameObject.SetActive(true); text.text = endText.ToString(); } else { SingleUnitData unitData = data.CastDataType <SingleUnitData>(); if (unitData == null) { return; } PlayerID loseId = unitData.m_Unit.m_PlayerID; TextProperty word = loseId == PlayerManager.Instance.GetLocalPlayerID() ? loseText : winText; gameObject.SetActive(true); text.text = word.ToString(); } }