Exemple #1
0
 public void OnSummon()
 {
     if (m_SummonEvent != null)
     {
         m_SummonEvent.Trigger(this);
     }
 }
 protected void TriggerBeforeReceiveEffectEvent(Unit unit)
 {
     if (m_BeforeReceiveEffectEvent != null)
     {
         m_BeforeReceiveEffectEvent.Trigger(unit, m_EventData);
     }
 }
 protected void TrigggerBeforeActionEvent(Unit unit)
 {
     if (m_BeforeActionEvent != null)
     {
         m_BeforeActionEvent.Trigger(unit, m_EventData);
     }
 }
    private void TriggerEvent()
    {
        SingleUnitData data = new SingleUnitData();

        data.m_Unit = m_Owner;

        m_DestroyEvent.Trigger(m_Owner, 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);
    }
Exemple #6
0
    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);
    }
Exemple #7
0
    /// <summary>
    /// Change unit's stats.
    /// </summary>
    /// <param name="stat">The field to change</param>
    /// <param name="amount">The value of change</param>
    /// <param name="set">True if replace original value with amount. False if original value += amount</param>
    /// <param name="force">True if add new field when needed</param>
    public void ChangeStats(UnitStatsProperty stat, int amount, bool set = false, bool force = false)
    {
        if (m_Owner == null)
        {
            return;
        }

        //Debug.Log(m_Owner + " " + stat + " : " + GetStat(stat));
        UnitStatsChangeData eventData = new UnitStatsChangeData();

        eventData.m_Unit         = m_Owner;
        eventData.m_ChangedStats = stat;

        eventData.m_BeforeChange = GetStat(stat);

        PrivateChangeStats(stat, amount, set, force);

        eventData.m_AfterChange = GetStat(stat);

        m_StatsChangedEventForDisplay.Trigger(eventData);
        m_StatsChangedEventForUnits.Trigger(m_Owner, eventData);
        //Debug.Log(m_Owner + " " + stat + " Change to: " + GetStat(stat));
    }