Ejemplo n.º 1
0
    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);
        }
    }
    public override void SelectTrigger(GameEventData eventData)
    {
        //Debug.Log("Select");
        CardPreviewData data = eventData.CastDataType <CardPreviewData>();

        if (data == null)
        {
            return;
        }

        //Debug.Log("Check Select");
        GameObject cardPreview = data.m_Card;

        if (!m_CanRepeat && m_selectedCardPreviewList.Contains(cardPreview))
        {
            //Debug.Log("Repeat Select");
            UnselectTarget(cardPreview);
            return;
        }

        if (numberLeft <= 0)
        {
            return;
        }

        //Debug.Log("Confirm Select");
        m_selectedCardPreviewList.Add(cardPreview);

        HighlightTarget(cardPreview);

        numberLeft--;

        DisplayInfo();
    }
Ejemplo n.º 3
0
    public void Show(GameEventData eventData)
    {
        //Debug.Log("Card Selection Triggered");
        CardSelectOptionsData data = eventData.CastDataType <CardSelectOptionsData>();

        if (data == null)
        {
            return;
        }

        if (data.m_Switch)
        {
            if (!data.isCondition)
            {
                m_Display.DisplayOptions(data.unitDatas);
            }
            else
            {
                m_Display.DisplayOptions(data.conditions);
            }
        }
        else
        {
            m_Display.Hide();
        }
    }
    public void Display(GameEventData eventData)
    {
        //Debug.Log("Received");
        UnitStatsChangeData data = eventData.CastDataType <UnitStatsChangeData>();

        if (data == null)
        {
            return;
        }

        Unit   unit     = data.m_Unit;
        int    delta    = data.m_Delta;
        string property = data.m_ChangedStats.ToString();

        string op   = delta > 0 ? " +" : " ";
        string text = property + op + delta;

        Color color = m_NeutralColor;

        if (delta < 0)
        {
            color = m_NegativeColor;
        }
        else if (delta > 0)
        {
            color = m_PositiveColor;
        }

        GameObject go = m_Pool.Get(true);

        go.transform.SetParent(this.transform);
        go.GetComponent <EffectText>().Display(unit.transform.position, text, color);

        StartCoroutine(Hide(go));
    }
Ejemplo n.º 5
0
    void ChangeSelect(GameEventData eventData)
    {
        CardPreviewData data = eventData.CastDataType <CardPreviewData>();

        m_SelectedSpirit = data.m_UnitData;

        Invoke("Display", 0.1f);
    }
Ejemplo n.º 6
0
    void ChangeCondition(GameEventData eventData)
    {
        CardPreviewData data = eventData.CastDataType <CardPreviewData>();

        UnitData unit = data.m_UnitData;

        RankUpCondition condition = GetCondition(unit, m_SelectedSpirit);

        displayCondition.Display(condition);
    }
Ejemplo n.º 7
0
    public override void TakeEffect(Unit unit, int power = 0, GameEventData eventData = null)
    {
        base.TakeEffect(unit, power, eventData);

        EffectData data = eventData.CastDataType <EffectData>();

        if (data == null)
        {
            return;
        }

        data.m_TriggeredEffect.m_TargetDelta += value;
    }
    public virtual void SelectTrigger(GameEventData eventData)
    {
        SingleBlockData data = eventData.CastDataType <SingleBlockData>();

        if (data == null)
        {
            return;
        }

        if (m_AvaliableBlocks.Contains(data.m_Block))
        {
            Select(data.m_Block);
        }
    }
Ejemplo n.º 9
0
    public void Trigger(GameEventData eventData)
    {
        TooltipData data = eventData.CastDataType <TooltipData>();

        if (data == null)
        {
            return;
        }

        if (data.m_Switch && !m_active)
        {
            Display(data.m_Message);
        }

        SetActive(data.m_Switch);
    }
Ejemplo n.º 10
0
    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();
    }
Ejemplo n.º 11
0
    protected override void Trigger(GameEventData eventData)
    {
        EffectData data = eventData.CastDataType <EffectData>();

        if (data == null)
        {
            return;
        }

        int breaker = data.m_Source.m_Data.GetStat(property);

        if (breaker > 0)
        {
            data.m_TriggeredEffect.m_SourceDelta += breaker;
        }
    }
Ejemplo n.º 12
0
    protected override void Trigger(GameEventData eventData)
    {
        EffectData data = eventData.CastDataType <EffectData>();

        if (data == null)
        {
            return;
        }

        int value = data.m_CurrentTarget.m_Data.GetStat(property);

        if (value > 0)
        {
            data.m_TriggeredEffect.m_TargetDelta -= value;
        }
    }
Ejemplo n.º 13
0
        public void StartPlay(GameEventData eventData)
        {
            //Debug.Log("Start Play");
            StateChangeData data = eventData.CastDataType <StateChangeData>();

            if (data == null)
            {
                return;
            }

            //Debug.Log("Start Play2");
            if (data.currentStates.Contains(StateID.EnemyTurn))
            {
                AIManager.Instance.UseAction();
            }
            //Debug.Log("Start Play3");
        }
    protected virtual void StateChange(GameEventData eventData)
    {
        //Debug.Log("Receive State Change Event");
        StateChangeData data = eventData.CastDataType <StateChangeData>();

        if (data == null)
        {
            return;
        }

        bool check  = CheckState(data.currentStates);
        bool active = gameObject.activeSelf;

        if (check ^ active)
        {
            gameObject.SetActive(!active);
        }
    }
Ejemplo n.º 15
0
    public void Trigger(GameEventData eventData)
    {
        //Debug.Log("Receive Trigger");
        CardInfoData data = eventData.CastDataType <CardInfoData>();

        if (data == null)
        {
            return;
        }

        SetActive(data.m_Switch);

        if (m_active)
        {
            m_Display.Display(data.m_Data);
        }

        //Debug.Log("Active" + m_active);
        //Debug.Log("Data" + data.m_Data);
    }
    protected override void StateChange(GameEventData eventData)
    {
        if (m_ControlledComponent == null)
        {
            return;
        }

        StateChangeData data = eventData.CastDataType <StateChangeData>();

        if (data == null)
        {
            return;
        }

        bool check  = CheckState(data.currentStates);
        bool active = m_ControlledComponent.enabled;

        if (check ^ active)
        {
            m_ControlledComponent.enabled = !active;
        }
    }
Ejemplo n.º 17
0
    protected virtual void TrySummon(GameEventData eventData)
    {
        SummonData data = eventData.CastDataType <SummonData>();

        if (data == null)
        {
            return;
        }

        Unit       unit  = data.m_Unit;
        FieldBlock block = data.m_Block;

        if (!CheckSummonAvaliability(data, unit, block))
        {
            return;
        }

        int cost = unit.m_Data.GetStat(UnitStatsProperty.Cost);

        m_Mana.Cost(cost);

        SummonManager.Summon(unit, block);
    }
Ejemplo n.º 18
0
    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();
        }
    }
Ejemplo n.º 19
0
    private void CheckDUR(GameEventData eventData)
    {
        //Debug.Log("Check DUR");
        UnitStatsChangeData data = eventData.CastDataType <UnitStatsChangeData>();

        if (data == null)
        {
            return;
        }

        if (data.m_ChangedStats == UnitStatsProperty.DUR)
        {
            bool negative = m_Owner.m_Data.GetStat(UnitStatsProperty.Negative) > 0;

            if (negative && data.m_AfterChange >= 0)
            {
                Destroy();
            }
            else if (!negative && data.m_AfterChange <= 0)
            {
                Destroy();
            }
        }
    }
Ejemplo n.º 20
0
    public void Trigger(GameEventData eventData)
    {
        if (busy)
        {
            return;
        }

        data = eventData.CastDataType <RankUpData>();
        if (data == null)
        {
            return;
        }

        //Debug.Log("Receive");

        List <RankUpCondition> conditions = RankUpManagerCheckPhase.GetAllConditions(data.data1, data.data2, data.block);

        if (conditions.Count <= 0)
        {
            GameMessage.Instance.Display(Text_NoOption.ToString());
            return;
        }

        //Debug.Log("Get Choice");
        //foreach(RankUpCondition rankUpCondition in conditions)
        //{
        //    Debug.Log("\t" + rankUpCondition.name);
        //}

        EnterPhase();

        DisplayOptions(conditions);

        coroutine = GetPlayerChoice();
        StartCoroutine(coroutine);
    }
Ejemplo n.º 21
0
    public void Show(GameEventData eventData)
    {
        RankUpConditionData data = eventData.CastDataType <RankUpConditionData>();

        if (data == null)
        {
            return;
        }

        if (data.m_Switch)
        {
            gameObject.SetActive(true);

            //Debug.Log("Condtion Receive ["+data.m_Condition+"]");
            //Debug.Log("String 1 : [" + data.m_Condition.GetStringOfCondition1() + "]");
            //Debug.Log("String 2 : [" + data.m_Condition.GetStringOfCondition2() + "]");
            m_condition1Text.text = data.m_Condition.GetStringOfCondition1();
            m_condition2Text.text = data.m_Condition.GetStringOfCondition2();
        }
        else
        {
            gameObject.SetActive(false);
        }
    }