コード例 #1
0
ファイル: BishopThornTrapSpell.cs プロジェクト: skarow/ChD
        public void Tick()
        {
            if (m_nDuratation > 0)
            {
                m_nDuratation--;
                GameObject objectAbove = pickEnemyOrFriend.GetObjectInPosition(touchedField.transform.position);
                if (objectAbove != null)
                {
                    int killChance = trapTalent.GetBonusPercentage();
                    var rollDice   = Random.Range(0, 100);
                    if (rollDice < killChance) // kill
                    {
                        BishopInstantDeathSpell.Activate(objectAbove);
                    }
                }
            }

            if (m_nDuratation == 0)
            {
                FxMgr.Instance.DeactivateTrapFX();
            }
        }
コード例 #2
0
ファイル: BishopPickEnemySpells.cs プロジェクト: skarow/ChD
        // Update is called once per frame
        void Update()
        {
            if (!bActivated)
            {
                return;
            }

            if (Camera.main == null)
            {
                Debug.Log("No MainCamera defined!");
                return;
            }

            touchedObject = enemyPick.GetTouchedObject();

            if (touchedObject == null)
            {
                return;
            }

            switch (m_playerSpell)
            {
            case EPlayerSpells.eBishopWithholdEnemy:
                BishopWithholdEnemySpell.Activate(touchedObject);
                break;

            case EPlayerSpells.eBishopEntangle:
            case EPlayerSpells.eBishopFreeze:     // as an upgrade to root/entangle
                BishopRootSpell.Activate(touchedObject);
                break;

            case EPlayerSpells.eBishopInstantDeath:
                BishopInstantDeathSpell.Activate(touchedObject);
                break;
            }
            bActivated = false;
        }