예제 #1
0
        public void Experiment()
        {
            HideActionPanel();

            // find empty lab table
            TableManager table = tables.Find(x => x.monster == null);

            // if there's no open table, can't experiment
            if (table == null)
            {
                alertManager.ShowMessage("You need an open lab table to conduct experiments!");
                return;
            }

            // assign monster to open lab table
            table.monster = focusedMonster.gameObject;

            // move position of monster sprite to lab table
            Vector3 newPos = table.gameObject.transform.position;

            newPos.y += .2f;
            focusedMonster.gameObject.transform.position = newPos;

            // deal damage and ++money
            StartCoroutine(focusedMonster.DealDamage(5f, 5, 1f));
            StartCoroutine(resources.GiveMoney(10f, 5, 1f));

            focusedMonster = null;             // monster no longer focused
        }
예제 #2
0
        public void AddMonster()
        {
            HideActionPanel();

            if (resources.money < monsterPrice)
            {
                alertManager.ShowMessage("You need more money to purchase a Monster.");
                return;
            }

            if (cages.Count <= monsterManagers.Count)
            {
                alertManager.ShowMessage("You need an empty cage before purchasing a new Monster.");
                return;
            }

            // find 1st empty cage
            CageManager emptyCageMgr = null;

            foreach (CageManager cm in cages)
            {
                if (cm.monster == null)
                {
                    emptyCageMgr = cm;
                    break;
                }
            }

            if (emptyCageMgr == null)
            {
                alertManager.ShowMessage("No empty cages available!");
                return;
            }

            // add monster to cage
            numberMonsters++;

            GameObject c = emptyCageMgr.gameObject;

            int x = (int)emptyCageMgr.gameObject.transform.position.x;
            int y = (int)emptyCageMgr.gameObject.transform.position.y;

            int        randomIndex   = Random.Range(0, (monsters.Length - 1));
            GameObject randomMonster = monsters[randomIndex];
            GameObject m             = Instantiate(randomMonster, new Vector3(x, y, -.05f), Quaternion.identity) as GameObject;

            m.transform.SetParent(c.transform);
            MonsterManager mm = m.GetComponent <MonsterManager>();

            mm.cageManager = emptyCageMgr.GetComponent <CageManager> ();
            monsterManagers.Add(mm);

            emptyCageMgr.monster = m;             // bookkeeping

            string msg = string.Format("Purchased 1 Monster for ${0}", monsterPrice);

            notifManager.ShowNotice(msg);
        }
예제 #3
0
        //Sets up the outer walls and floor (background) of the game board.
        void BoardSetup()
        {
            for (int y = 0; y < rows * 2; y = y + 2)
            {
                for (int x = 0; x < columns * 2; x = x + 2)
                {
                    GameObject instance = Instantiate(floorTile, new Vector3(x, y, 0f), Quaternion.identity) as GameObject;
                    instance.transform.SetParent(boardHolder);

                    // add cages to first few tiles
                    if (cages.Count < numberCages)
                    {
                        GameObject c = Instantiate(cage, new Vector3(x, y, -.1f), Quaternion.identity) as GameObject;
                        c.transform.SetParent(boardHolder);

                        // add monster to cage
                        CageManager cm = c.GetComponent <CageManager>();
                        if (monsterManagers.Count < numberMonsters)
                        {
                            int        randomIndex   = Random.Range(0, (monsters.Length - 1));
                            GameObject randomMonster = monsters[randomIndex];
                            GameObject m             = Instantiate(randomMonster, new Vector3(x, y, -.05f), Quaternion.identity) as GameObject;
                            m.transform.SetParent(c.transform);
                            MonsterManager mm = m.GetComponent <MonsterManager>();
                            mm.cageManager = cm;
                            monsterManagers.Add(mm);
                            cm.monster = m;                             // bookkeeping
                        }

                        // add cage to list
                        cages.Add(cm);
                    }
                }
            }

            HideActionPanel();
        }
예제 #4
0
        public void Water()
        {
            HideActionPanel();

            if (focusedMonster == null)
            {
                Debug.Log("No focused monster?");
                return;
            }

            if (resources.water > 0)
            {
                focusedMonster.Water();
                resources.water = (int)Mathf.Max(0f, resources.water - 1f);
                string msg = string.Format("Watered {0}. Water Remaining: {1}.", focusedMonster.monsterName, resources.water);
                notifManager.ShowNotice(msg);
            }
            else
            {
                alertManager.ShowMessage("No water left!");
            }

            focusedMonster = null;             // monster no longer focused
        }
예제 #5
0
        public void Feed()
        {
            HideActionPanel();

            if (focusedMonster == null)
            {
                Debug.Log("No focused monster?");
                return;
            }

            if (resources.food > 0)
            {
                focusedMonster.Feed();
                resources.food = (int)Mathf.Max(0f, resources.food - 1f);
                string msg = string.Format("Fed {0}. Food Remaining: {1}", focusedMonster.monsterName, resources.food);
                notifManager.ShowNotice(msg);
            }
            else
            {
                alertManager.ShowMessage("No food left!");
            }

            focusedMonster = null;             // monster no longer focused
        }
예제 #6
0
 public void SetMonsterFocus(MonsterManager monster)
 {
     focusedMonster = monsterManagers.Find(x => x == monster);
     Debug.Log("Focused Monster is: " + focusedMonster);
 }
예제 #7
0
        public void Water()
        {
            HideActionPanel ();

            if (focusedMonster == null) {
                Debug.Log ("No focused monster?");
                return;
            }

            if (resources.water > 0) {
                focusedMonster.Water();
                resources.water = (int) Mathf.Max (0f, resources.water - 1f);
                string msg = string.Format("Watered {0}. Water Remaining: {1}.", focusedMonster.monsterName, resources.water);
                notifManager.ShowNotice (msg);
            } else {
                alertManager.ShowMessage("No water left!");
            }

            focusedMonster = null; // monster no longer focused
        }
예제 #8
0
 public void SetMonsterFocus(MonsterManager monster)
 {
     focusedMonster = monsterManagers.Find (x => x == monster);
     Debug.Log ("Focused Monster is: " + focusedMonster);
 }
예제 #9
0
        public void Feed()
        {
            HideActionPanel ();

            if (focusedMonster == null) {
                Debug.Log ("No focused monster?");
                return;
            }

            if (resources.food > 0) {
                focusedMonster.Feed ();
                resources.food = (int) Mathf.Max (0f, resources.food - 1f);
                string msg = string.Format("Fed {0}. Food Remaining: {1}", focusedMonster.monsterName, resources.food);
                notifManager.ShowNotice (msg);
            } else {
                alertManager.ShowMessage("No food left!");
            }

            focusedMonster = null; // monster no longer focused
        }
예제 #10
0
        public void Experiment()
        {
            HideActionPanel ();

            // find empty lab table
            TableManager table = tables.Find (x => x.monster == null);

            // if there's no open table, can't experiment
            if (table == null) {
                alertManager.ShowMessage("You need an open lab table to conduct experiments!");
                return;
            }

            // assign monster to open lab table
            table.monster = focusedMonster.gameObject;

            // move position of monster sprite to lab table
            Vector3 newPos = table.gameObject.transform.position;
            newPos.y += .2f;
            focusedMonster.gameObject.transform.position = newPos;

            // deal damage and ++money
            StartCoroutine(focusedMonster.DealDamage (5f, 5, 1f));
            StartCoroutine(resources.GiveMoney (10f, 5, 1f));

            focusedMonster = null; // monster no longer focused
        }