Пример #1
0
    private void towerPartHandler()
    {
        myTowerScript       = transform.parent.GetComponent <Tower>();
        myTowerShieldScript = transform.parent.Find("TowerShield").GetComponent <TowerShield>();

        if (GameObject.FindWithTag("Enemy") != null)
        {
            myEnemy = GameObject.FindWithTag("Enemy").GetComponent <Enemy>();
        }

        if (!triggered)
        {
            switch (myType)
            {
            case PartType.Attack:
                attackEnemy();
                break;

            case PartType.Defense:
                myTowerShieldScript.armorUp(armor + myTowerScript.getDefenseBuffAmount());
                break;

            case PartType.Buff:
                myEnemy.addTimer(2);
                break;
            }
            triggered = true;
        }
    }
Пример #2
0
    public void addMaterial(int typeCode)
    {
        myObjectList.Add(typeCode);

        myEnemy.underAttack(addMaterialAttackAmount);

        myTowerShield.armorUp(addMaterialShieldAmount);
        // check two blocks below the current one
        int materialCount = 1;

        while (searchIndex < 2 && myObjectList.Count >= 3)
        {
            if (myObjectList[myObjectList.Count - searchIndex - 2] > 0 && myObjectList[myObjectList.Count - searchIndex - 2] <= 3)
            {
                ++materialCount;
            }
            else
            {
                myGameController.gameSuspended = false;
                myGameController.turnPassed();
                return;
            }
            ++searchIndex;
        }

        if (materialCount >= 2)
        {
            generatePart();
            //check the block below current part
            if (myObjectList.Count >= 6 && myObjectList[myObjectList.Count - 4] >= 4 && myObjectList[myObjectList.Count - 4] <= 6)
            {
                generateLevel();
            }

            searchIndex = 0;
        }

        myGameController.gameSuspended = false;
        myGameController.turnPassed();
    }
Пример #3
0
 public void addPermanentShieldAmount(int n)
 {
     permanentShieldAmount += n;
     myPermanentShield.armorUp(permanentShieldAmount);
 }