Beispiel #1
0
 private void Begin()
 {
     displayMessage.Display("Welcome to Hoarding Havoc!", canvas);
     Invoke("Intro", GlobalConstants.waitTime);
 }
    // Update is called once per frame
    void Update()
    {
        CanvasController.UpdateDistance(distance);
        CanvasController.UpdateMaxCapacity(p.H.TotalCapacity);
        p.H.UpdateHand();

        if (msgDone && p.H.CurrentCapacity > p.H.TotalCapacity)
        {
            GameObject.FindGameObjectWithTag("MenuNavigation").GetComponent <MenuNavigation> ().ToDeath();
        }

        if (distance <= 0)
        {
            GameObject.FindGameObjectWithTag("Score").GetComponent <Score> ().score = p.H.ClearHand();
            GameObject.FindGameObjectWithTag("MenuNavigation").GetComponent <MenuNavigation> ().ToVictory();
        }

        if (playerTurn == false)
        {
            playerTurn = true;
            Invoke("EnemyTurn", GlobalConstants.waitTime);
        }

        if (e == null && msgDone)
        {
            if (p.H.enabled)
            {
                p.H.DisableCards();
            }
//			e = new Enemy (EnemyDescriptions.goblin);
//			ccScript.AnEnemyAppears (e);
//			CanvasController.UpdateHealth (e.Health);
            moveDelay += Time.deltaTime;
            if (!i1.enabled && moveDelay >= GlobalConstants.baseTimePerMovem * ((float)p.H.CurrentCapacity / (float)p.H.TotalCapacity) * ((float)1 / (float)4))
            {
                i1.enabled = true;
            }

            if (!i2.enabled && moveDelay >= GlobalConstants.baseTimePerMovem * ((float)p.H.CurrentCapacity / (float)p.H.TotalCapacity) * ((float)1 / (float)2))
            {
                i2.enabled = true;
            }

            if (!i3.enabled && moveDelay >= GlobalConstants.baseTimePerMovem * ((float)p.H.CurrentCapacity / (float)p.H.TotalCapacity) * ((float)3 / (float)4))
            {
                i3.enabled = true;
            }

            if (moveDelay >= GlobalConstants.baseTimePerMovem * ((float)p.H.CurrentCapacity / (float)p.H.TotalCapacity))
            {
                moveDelay = 0;
                distance--;
                i1.enabled = false;
                i2.enabled = false;
                i3.enabled = false;
                CanvasController.UpdateDistance(distance);
            }

            eventDelay += Time.deltaTime;
            if (eventDelay >= GlobalConstants.eventDelayTime)
            {
                eventDelay = 0;
                if (Random.Range(0, 100) < GlobalConstants.enemyChance)
                {
                    while (true)
                    {
                        if (Random.Range(0, 100) < (int)SpawnChance.Goblin)
                        {
                            e = new Enemy(EnemyDescriptions.goblin);
                            ccScript.AnEnemyAppears(e);
                            CanvasController.UpdateHealth(e.Health);
                            displayMessage.Display("An enemy " + e.Name + " appears!", canvas, aControl.enemyAppear);
                            Invoke("StartPlayerTurn", GlobalConstants.waitTime);
                            return;
                        }
                        if (Random.Range(0, 100) < (int)SpawnChance.Troll)
                        {
                            e = new Enemy(EnemyDescriptions.troll);
                            ccScript.AnEnemyAppears(e);
                            CanvasController.UpdateHealth(e.Health);
                            displayMessage.Display("An enemy " + e.Name + " appears!", canvas, aControl.enemyAppear);
                            Invoke("StartPlayerTurn", GlobalConstants.waitTime);
                            return;
                        }
                        if (Random.Range(0, 100) < (int)SpawnChance.Rat)
                        {
                            e = new Enemy(EnemyDescriptions.rat);
                            ccScript.AnEnemyAppears(e);
                            CanvasController.UpdateHealth(e.Health);
                            displayMessage.Display("An enemy " + e.Name + " appears!", canvas, aControl.enemyAppear);
                            Invoke("StartPlayerTurn", GlobalConstants.waitTime);
                            return;
                        }
                        if (Random.Range(0, 100) < (int)SpawnChance.Minotaur)
                        {
                            e = new Enemy(EnemyDescriptions.minotaur);
                            ccScript.AnEnemyAppears(e);
                            CanvasController.UpdateHealth(e.Health);
                            displayMessage.Display("An enemy " + e.Name + " appears!", canvas, aControl.enemyAppear);
                            Invoke("StartPlayerTurn", GlobalConstants.waitTime);
                            return;
                        }
                        if (Random.Range(0, 100) < (int)SpawnChance.Wolf)
                        {
                            e = new Enemy(EnemyDescriptions.wolf);
                            ccScript.AnEnemyAppears(e);
                            CanvasController.UpdateHealth(e.Health);
                            displayMessage.Display("An enemy " + e.Name + " appears!", canvas, aControl.enemyAppear);
                            Invoke("StartPlayerTurn", GlobalConstants.waitTime);
                            return;
                        }
                    }
                }
                else if (Random.Range(0, 100) < GlobalConstants.eventChance)
                {
                    while (true)
                    {
                        if (Random.Range(0, 100) < (int)EventChance.FindLoot)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.FindLoot, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.Energize)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.Energize, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.SuperStrength)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.SuperStrength, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.Weaken)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.Weaken, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.ParalysingWeakness)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.ParalysingWeakness, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.Speed)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.Speed, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.Flash)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.Flash, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.Lost)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.Lost, this);
                            p.H.DisableCards();
                            return;
                        }
                        if (Random.Range(0, 100) < (int)EventChance.Bewildered)
                        {
                            msgDone = false;
                            Invoke("MsgDone", GlobalConstants.waitTime);
                            Events.DoEvent(EventName.Bewildered, this);
                            p.H.DisableCards();
                            return;
                        }
                    }
                }
            }
        }
    }
Beispiel #3
0
 void Results()
 {
     displayMessage.Display("You escaped with " + GameObject.FindGameObjectWithTag("Score").GetComponent <Score> ().score + " loot!", canvas, null, true);
 }
 void Results()
 {
     displayMessage.Display("Over burdened with loot you collapse...", canvas, null, true);
 }