コード例 #1
0
    protected virtual void Calculate()
    {
        if (this.m_Destination is TargetObject && ((TargetObject)this.m_Destination).Target != null)
        {
            HPBehavior hpBehavior = ((TargetObject)this.m_Destination).Target.GetComponent <HPBehavior>();
            hpBehavior.DecreaseHP(this.Damage, this.m_AttackCategory);

            this.PushCharacter(((TargetObject)this.m_Destination).Target);
        }
    }
コード例 #2
0
ファイル: BombBehavior.cs プロジェクト: KangLLL/century_war
    public override void Effect()
    {
        List <GameObject> targets = BattleSceneHelper.Instance.GetActors(this.DamageList, this.TargetType);

        foreach (GameObject target in targets)
        {
            HPBehavior hpBehavior = target.GetComponent <HPBehavior>();
            hpBehavior.DecreaseHP(this.Damage, this.AttackCategory);

            CharacterAI ai = target.GetComponent <CharacterAI>();
            ai.SetPush(this.m_PushTicks, this.m_PushVelocity, this.Property.AnchorTransform.position);
        }

        if (this.m_BombPrefab != null)
        {
            GameObject bomb = GameObject.Instantiate(this.m_BombPrefab) as GameObject;
            bomb.transform.position = this.Property.AnchorTransform.position;
            bomb.transform.parent   = this.ParentNode;
        }
        GameObject.Destroy(this.gameObject);
    }
コード例 #3
0
    public override void Effect()
    {
        if (this.m_CurrentTimes < this.m_TotalTimes)
        {
            if (!this.m_BombEffect.activeSelf)
            {
                this.m_BombEffect.SetActive(true);
            }

            List <GameObject> targets = BattleSceneHelper.Instance.GetActors(this.DamageList, this.TargetType);
            foreach (GameObject target in targets)
            {
                HPBehavior hpBehavior = target.GetComponent <HPBehavior>();
                hpBehavior.DecreaseHP(this.Damage, this.AttackCategory);
            }
            this.m_CurrentTimes++;
            if (this.m_CurrentTimes == this.m_TotalTimes)
            {
                GameObject.Destroy(this.gameObject);
            }
        }
    }