コード例 #1
0
    IEnumerator Attack()
    {
        //disable this button
        btn.interactable = false;
        mm.PlayerID      = 1;

        FindObjectOfType <AudioManager>().Play("Click");

        //no longer player's turn
        ps.IsCharacterTurn = false;

        //if they're stunned
        if (ps.Stuntime > 0)
        {
            yield return(StartCoroutine(mm.Stunned(pc, ec)));
        }

        else
        {
            //declare the stun is worn off
            if (ps.Stuntime == 0)
            {
                mm.b1.interactable      = false;
                mm.b2.interactable      = false;
                mm.b3.interactable      = false;
                mm.b4.interactable      = false;
                mm.MoveBtn.interactable = false;
                yield return(StartCoroutine(mm.DisplayText(ps.name + " is no longer stunned!")));

                ps.Stuntime = -1;
            }

            //use the move
            yield return(StartCoroutine(mm.UseMove(moveID, pc, ec)));
        }


        //update all the stats
        es.ChipsText.text = "Chips X " + es.Chips.ToString();
        es.AtkText.text   = "Atk X " + es.Atk.ToString();
        es.DefText.text   = "Def X " + es.Def.ToString();
        // es.LvlText.text = "Lvl X " + es.Lvl.ToString();
        es.LuckText.text = "Luck X " + es.Luck.ToString();

        ps.ChipsText.text = "Chips X " + ps.Chips.ToString();
        ps.AtkText.text   = "Atk X " + ps.Atk.ToString();
        ps.DefText.text   = "Def X " + ps.Def.ToString();
        ps.LvlText.text   = "Lvl X " + ps.Lvl.ToString();
        ps.LuckText.text  = "Luck X " + ps.Luck.ToString();
        //////////

        yield return(null);
    }
コード例 #2
0
    private IEnumerator Out()
    {
        yield return(StartCoroutine(mm.DisplayText("Thank you for playing, your score is: " + ps.Chips + "!")));

        //set the highschore in the main menu
        if (ps.Chips > PlayerPrefs.GetInt("HighScore", 0))
        {
            PlayerPrefs.SetInt("HighScore", ps.Chips);
        }
        SceneManager.LoadScene(0);
        yield return(null);
    }
コード例 #3
0
    public override IEnumerator CheckDead()
    {
        // i do this alot because i really dont want the player hitting buttons when they shouldn't be
        mm.b1.interactable      = false;
        mm.b2.interactable      = false;
        mm.b3.interactable      = false;
        mm.b4.interactable      = false;
        mm.MoveBtn.interactable = false;


        //they died
        if (Chips <= 0)
        {
            FindObjectOfType <AudioManager>().Play("Lose");
            yield return(StartCoroutine(mm.DisplayText(name + " is out of chips!")));

            yield return(StartCoroutine(mm.DisplayText("Game Over!")));

            mm.PlayerID = 0;
            SceneManager.LoadScene(0);
        }

        yield return(null);
    }
コード例 #4
0
    IEnumerator Attack()
    {
        btn.interactable = false;
        mm.PlayerID      = 4;
        FindObjectOfType <AudioManager>().Play("Click");
        ps.IsCharacterTurn = false;
        if (ps.Stuntime > 0)
        {
            yield return(StartCoroutine(mm.Stunned(pc, ec)));
        }


        else
        {
            mm.b1.interactable      = false;
            mm.b2.interactable      = false;
            mm.b3.interactable      = false;
            mm.b4.interactable      = false;
            mm.MoveBtn.interactable = false;
            Debug.Log("testing");
            if (ps.Stuntime == 0)
            {
                yield return(StartCoroutine(mm.DisplayText(ps.name + " is no longer stunned!")));

                ps.Stuntime = -1;
            }
            yield return(StartCoroutine(mm.UseMove(moveID, pc, ec)));
        }



        es.ChipsText.text = "Chips X " + es.Chips.ToString();
        es.AtkText.text   = "Atk X " + es.Atk.ToString();
        es.DefText.text   = "Def X " + es.Def.ToString();
        // es.LvlText.text = "Lvl X " + es.Lvl.ToString();
        es.LuckText.text = "Luck X " + es.Luck.ToString();

        ps.ChipsText.text = "Chips X " + ps.Chips.ToString();
        ps.AtkText.text   = "Atk X " + ps.Atk.ToString();
        ps.DefText.text   = "Def X " + ps.Def.ToString();
        ps.LvlText.text   = "Lvl X " + ps.Lvl.ToString();
        ps.LuckText.text  = "Luck X " + ps.Luck.ToString();
        yield return(null);
    }
コード例 #5
0
ファイル: EnemyScr.cs プロジェクト: Abu262/MonsterCasino
    IEnumerator canAttack()
    {
        //if it's the character's turn
        if (IsCharacterTurn == true)
        {
            mm.b1.interactable      = false;
            mm.b2.interactable      = false;
            mm.b3.interactable      = false;
            mm.b4.interactable      = false;
            mm.MoveBtn.interactable = false;
            IsCharacterTurn         = false;

            //check the stun
            if (es.Stuntime > 0)
            {
                yield return(StartCoroutine(mm.Stunned(ec, pc)));
            }

            //else they can attack
            else
            {
                //declare if the stun timer is over
                if (es.Stuntime == 0)
                {
                    yield return(StartCoroutine(mm.DisplayText(es.name + " is no longer stunned!")));

                    es.Stuntime = -1;
                }


                //attack with a random move
                int move = Random.Range(1, 5);
                while (move == LastMoveID)
                {
                    move = Random.Range(1, 5);
                }


                if (move == 1)
                {
                    yield return(StartCoroutine(mm.UseMove(MoveId1, ec, pc)));
                }
                else if (move == 2)
                {
                    yield return(StartCoroutine(mm.UseMove(MoveId2, ec, pc)));
                }
                else if (move == 3)
                {
                    yield return(StartCoroutine(mm.UseMove(MoveId3, ec, pc)));
                }
                else if (move == 4)
                {
                    yield return(StartCoroutine(mm.UseMove(MoveId4, ec, pc)));
                }
                LastMoveID = move; //we save this so they dont do the same move twice in a row
                //            Player.IsCharacterTurn = true;
                es.ChipsText.text = "Chips X " + es.Chips.ToString();
                es.AtkText.text   = "Atk X " + es.Atk.ToString();
                es.DefText.text   = "Def X " + es.Def.ToString();
                // es.LvlText.text = "Lvl X " + es.Lvl.ToString();
                es.LuckText.text = "Luck X " + es.Luck.ToString();

                ps.ChipsText.text  = "Chips X " + ps.Chips.ToString();
                ps.AtkText.text    = "Atk X " + ps.Atk.ToString();
                ps.DefText.text    = "Def X " + ps.Def.ToString();
                ps.LvlText.text    = "Lvl X " + ps.Lvl.ToString();
                ps.LuckText.text   = "Luck X " + ps.Luck.ToString();
                Background.enabled = false;
                // Description.enabled = false;
                yield return(null);
            }
            Description.text       += "\nIt is your turn!";
            mm.b1.interactable      = true;
            mm.b2.interactable      = true;
            mm.b3.interactable      = true;
            mm.b4.interactable      = true;
            mm.MoveBtn.interactable = true;

            if (mm.PlayerID == 1)
            {
                mm.b1.interactable = false;
            }
            if (mm.PlayerID == 2)
            {
                mm.b2.interactable = false;
            }
            if (mm.PlayerID == 3)
            {
                mm.b3.interactable = false;
            }
            if (mm.PlayerID == 4)
            {
                mm.b4.interactable = false;
            }
            yield return(null);
        }
    }