예제 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Time.timeSinceLevelLoad - lastEnemyTime > enemySpawnTime)
     {
         Vector2 d = new Vector2(Random.Range(0, 95), Random.Range(1, 60));
         lastEnemyTime = Time.timeSinceLevelLoad * Util.randomSpread();
         Enemy e = factory.spawnObject().GetComponent <Enemy>();
         e.gameObject.SetActive(true);
         e.transform.position = this.transform.position;
         e.destination        = d;
     }
 }
예제 #2
0
 public void makeDude()
 {
     foreach (Reqs req in requirements)
     {
         InventroyManager.instance.removeFromInventory(req.type, req.amount);
     }
     // call the spawn dude function
     if (unitSpawner != null)
     {
         unitSpawner.spawnObject();
         Debug.Log("Spawned a cutie");
     }
 }
    protected void buttonAction(int i)
    {
        if (tower == null)
        {
            tower = GameObject.FindObjectOfType <Tower>();
        }
        switch (i)
        {
        case 0:         //Golem 1
            if (InventroyManager.instance.getCount(Element.DIRT) >= DIRT_GOLEM_COST)
            {
                InventroyManager.instance.removeFromInventory(Element.DIRT, DIRT_GOLEM_COST);
                // make a CUTIE
                unitSpawner.spawnObject();
            }
            break;

        case 1:         //Golem 2

            break;

        case 2:         //Golem 3
                        //return ;
            break;

        case 3:         //Tower 1
            if (tower != null && InventroyManager.instance.getCount(Element.DIRT) >= DIRT_TOWER_COST)
            {
                InventroyManager.instance.removeFromInventory(Element.DIRT, DIRT_TOWER_COST);
                tower.increaseHeight();
            }
            break;

        case 4:         //Tower 2
                        //
            break;

        case 5:         //Tower 3
                        //
            break;
        }
    }