예제 #1
0
 // Use this for initialization
 void Start()
 {
     actionRate = ACTIONRATE_NOMAL;
     level      = Const.GAME_LEVEL_NOMAL;
     if (GameMaster.Instance.mode == GameMaster.GameMode.EndlessMode)
     {
         level = Const.GAME_LEVEL_NOMAL;
     }
     if (GameMaster.Instance.mode == GameMaster.GameMode.OnePlayerMode)
     {
         level = EncryptedPlayerPrefs.LoadInt(Const.KEY_LEVEL, Const.GAME_LEVEL_NOMAL);
     }
     prevAction = PlayerInfo.Action.None;
     if (level == Const.GAME_LEVEL_EASY)
     {
         actionRate = ACTIONRATE_EASY;
     }
     else if (level == Const.GAME_LEVEL_NOMAL)
     {
         actionRate = ACTIONRATE_NOMAL;
     }
     else if (level == Const.GAME_LEVEL_HEARD)
     {
         actionRate = ACTIONRATE_HEARD;
     }
 }
예제 #2
0
    public void Init(PlayerInfo.PlayerType type)
    {
        playerInfo.playerType = type;
        gameObject.layer      = LayerMask.NameToLayer("Player");
        action = PlayerInfo.Action.None;
        if (playerInfo.playerType == PlayerInfo.PlayerType.Player1)
        {
            playerInfo.charaType = GameMaster.Instance.charaType1;
        }
        else
        {
            playerInfo.charaType = GameMaster.Instance.charaType2;
        }

        if (GameMaster.Instance.mode == GameMaster.GameMode.TwoPlayerMode)
        {
            playerInfo.humanType = PlayerInfo.HumanType.Human;
            GetComponent <EnemyAi> ().enabled = false;
        }
        else
        {
            if (GameMaster.Instance.ctrPos == GameMaster.CtrLeft)
            {
                //左ならCOMは右
                if (playerInfo.playerType == PlayerInfo.PlayerType.Player1)
                {
                    GetComponent <EnemyAi> ().enabled = false;
                    playerInfo.humanType = PlayerInfo.HumanType.Human;
                }
                else
                {
                    humanPlayer          = GameObject.Find("Player1");
                    playerInfo.humanType = PlayerInfo.HumanType.Com;
                    GetComponent <EnemyAi> ().enabled = true;
                    enemyAi = GetComponent <EnemyAi> ();
                }
            }
            else
            {
                //右ならCOMは左
                if (playerInfo.playerType == PlayerInfo.PlayerType.Player1)
                {
                    humanPlayer          = GameObject.Find("Player2");
                    playerInfo.humanType = PlayerInfo.HumanType.Com;
                    GetComponent <EnemyAi> ().enabled = true;
                    enemyAi = GetComponent <EnemyAi> ();
                }
                else
                {
                    GetComponent <EnemyAi> ().enabled = false;
                    playerInfo.humanType = PlayerInfo.HumanType.Human;
                }
            }
        }
    }
예제 #3
0
    private PlayerInfo.Action RandomAttack()
    {
        PlayerInfo.Action action = PlayerInfo.Action.None;
        int rand = Random.Range(0, 10);

        if (rand == 0)
        {
            //1/10でしょうゆーけん
            action = PlayerInfo.Action.Special;
        }
        else if (rand == 1 || rand == 2)
        {
            //2/10でパンチ
            action = PlayerInfo.Action.Punch;
        }
        else if (rand == 3 || rand == 4)
        {
            //2/10でキック
            action = PlayerInfo.Action.Kick;
        }
        return(action);
    }
예제 #4
0
 void Controller(int type)
 {
     if (playerInfo.humanType == PlayerInfo.HumanType.Human)
     {
         if (CrossPlatformInputManager.GetButton("Guard" + type))
         {
             action = PlayerInfo.Action.Guard;
         }
         else if (CrossPlatformInputManager.GetButtonDown("Attack" + type))
         {
             action = PlayerInfo.Action.Punch;
         }
         else if (CrossPlatformInputManager.GetButtonDown("Kick" + type))
         {
             action = PlayerInfo.Action.Kick;
         }
         else if (CrossPlatformInputManager.GetButtonDown("Special" + type))
         {
             action = PlayerInfo.Action.Special;
         }
         else if (CrossPlatformInputManager.GetButtonDown("SS" + type))
         {
             action = PlayerInfo.Action.SS;
         }
         else
         {
             action = PlayerInfo.Action.None;
         }
     }
             #if UNITY_EDITOR
     if (Input.GetKeyDown(KeyCode.Space))
     {
         action = PlayerInfo.Action.SS;
     }
             #endif
 }
예제 #5
0
    public PlayerInfo.Action GetAction(PlayerInfo info, string humanTag)
    {
        if (!isPlay)
        {
            return(PlayerInfo.Action.None);
        }

        int rate = 0;

        if (info.charaType == PlayerInfo.BLACKKOHAKU)
        {
            rate = -15;
        }

        if (PerAction(actionRate + rate))
        {
            if (prevAction == PlayerInfo.Action.Guard)
            {
                return(prevAction);
            }

            return(PlayerInfo.Action.None);
        }

        PlayerInfo.Action action = PlayerInfo.Action.None;


        // キャラごとにパターンを少し変える
        switch (humanTag)
        {
        case Const.TAG_PLAYER:
        {
            //相手:Idle
            int rand = Random.Range(0, 15);
            if (info.charaType == PlayerInfo.KOHAKU)
            {
                if (rand == 0 || rand == 1 || rand == 2)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 3 || rand == 4)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 5)
                {
                    action = PlayerInfo.Action.Special;
                }
                else if (rand == 6 || rand == 7)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
                else if (rand == 8 || rand == 9 || rand == 10 || rand == 11 || rand == 12)
                {
                    action = PlayerInfo.Action.Guard;
                }
            }
            else if (info.charaType == PlayerInfo.YUKO)
            {
                if (info.life < 30)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 3)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 5 || rand == 4 || rand == 11)
                    {
                        action = PlayerInfo.Action.Special;
                    }
                    else if (rand == 6 || rand == 7 || rand == 2 || rand == 12)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                    else if (rand == 8 || rand == 9 || rand == 10)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                }
                else
                {
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 3 || rand == 4)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 5 || rand == 12)
                    {
                        action = PlayerInfo.Action.Special;
                    }
                    else if (rand == 6 || rand == 7)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                    else if (rand == 8 || rand == 9 || rand == 10 || rand == 11)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                }
            }
            else if (info.charaType == PlayerInfo.MISAKI)
            {
                if (info.life < 30)
                {
                    if (rand == 0 || rand == 1 || rand == 11 || rand == 12)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 3 || rand == 4)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 5)
                    {
                        action = PlayerInfo.Action.Special;
                    }
                    else if (rand == 6 || rand == 7)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                    else if (rand == 8 || rand == 9 || rand == 10)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                }
                else
                {
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 3 || rand == 4)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 5)
                    {
                        action = PlayerInfo.Action.Special;
                    }
                    else if (rand == 6 || rand == 7)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                    else if (rand == 8 || rand == 9 || rand == 10 || rand == 11 || rand == 12)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                }
            }
            else if (info.charaType == PlayerInfo.BLACKKOHAKU)
            {
                if (rand == 0 || rand == 1 || rand == 2)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 3 || rand == 4)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 5)
                {
                    action = PlayerInfo.Action.Special;
                }
                else if (rand == 6 || rand == 7)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
                else if (rand == 8 || rand == 9 || rand == 10)
                {
                    action = PlayerInfo.Action.Guard;
                }
            }
            break;
        }

        case Const.TAG_PUNCH:
        {
            //相手:パンチ
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                int rand = Random.Range(0, 15);
                if (info.charaType == PlayerInfo.KOHAKU)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11 || rand == 9)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
                else if (info.charaType == PlayerInfo.YUKO)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11 || rand == 9)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
                else if (info.charaType == PlayerInfo.MISAKI)
                {
                    if (rand == 0 || rand == 1 || rand == 9)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11 || rand == 9)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
                else if (info.charaType == PlayerInfo.BLACKKOHAKU)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11 || rand == 9)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
            }
            break;
        }

        case Const.TAG_KICK:
        {
            //相手:キック
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                int rand = Random.Range(0, 15);
                if (info.charaType == PlayerInfo.KOHAKU)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2 || rand == 3)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8 || rand == 9)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
                else if (info.charaType == PlayerInfo.YUKO)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2 || rand == 3)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8 || rand == 9)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
                else if (info.charaType == PlayerInfo.MISAKI)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2 || rand == 3)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8 || rand == 9)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
                else if (info.charaType == PlayerInfo.BLACKKOHAKU)
                {
                    if (rand == 0 || rand == 1)
                    {
                        action = PlayerInfo.Action.Punch;
                    }
                    else if (rand == 2 || rand == 3)
                    {
                        action = PlayerInfo.Action.Kick;
                    }
                    else if (rand == 4 || rand == 5 || rand == 6 ||
                             rand == 10 || rand == 11)
                    {
                        action = PlayerInfo.Action.Guard;
                    }
                    else if (rand == 7 || rand == 8 || rand == 9)
                    {
                        if (info.sGage >= Const.MAX_S_GAGE)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
            }
            break;
        }

        case Const.TAG_SOLT:
        {
            //相手:回転キック
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                int rand = Random.Range(0, 15);
                if (rand == 0 || rand == 1)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 2 || rand == 3)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 4 || rand == 5 || rand == 6)
                {
                    action = PlayerInfo.Action.Guard;
                }
                else if (rand == 7 || rand == 8 || rand == 9)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
            }
            break;
        }

        case Const.TAG_SPECIAL_START:
        {
            //相手:しょーゆーけん(開始)
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                if (prevAction == PlayerInfo.Action.Guard)
                {
                    action = PlayerInfo.Action.Guard;
                }
                else
                {
                    int rand = Random.Range(0, 10);
                    if (info.charaType == PlayerInfo.KOHAKU)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else if (rand == 1 || rand == 2)
                        {
                            action = RandomAttack();
                        }
                        else if (rand == 7)
                        {
                            if (info.sGage >= Const.MAX_S_GAGE)
                            {
                                action = PlayerInfo.Action.SS;
                            }
                        }
                    }
                    else if (info.charaType == PlayerInfo.YUKO)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else if (rand == 1 || rand == 2)
                        {
                            action = RandomAttack();
                        }
                        else if (rand == 7)
                        {
                            if (info.sGage >= Const.MAX_S_GAGE)
                            {
                                action = PlayerInfo.Action.SS;
                            }
                        }
                    }
                    else if (info.charaType == PlayerInfo.MISAKI)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else if (rand == 1 || rand == 2)
                        {
                            action = RandomAttack();
                        }
                        else if (rand == 7)
                        {
                            if (info.sGage >= Const.MAX_S_GAGE)
                            {
                                action = PlayerInfo.Action.SS;
                            }
                        }
                    }
                    else if (info.charaType == PlayerInfo.BLACKKOHAKU)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else if (rand == 1 || rand == 2)
                        {
                            action = RandomAttack();
                        }
                        else if (rand == 7)
                        {
                            if (info.sGage >= Const.MAX_S_GAGE)
                            {
                                action = PlayerInfo.Action.SS;
                            }
                        }
                    }
                }
            }
            break;
        }

        case Const.TAG_SPECIAL:
        {
            //相手:しょーゆーけん
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                if (info.charaType == PlayerInfo.KOHAKU)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        int rand = Random.Range(0, 10);
                        if (rand == 0 || rand == 1 || rand == 2)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                        else if (rand == 3)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else if (info.charaType == PlayerInfo.YUKO)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        int rand = Random.Range(0, 10);
                        if (rand == 0 || rand == 1 || rand == 2)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                        else if (rand == 3)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else if (info.charaType == PlayerInfo.MISAKI)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        int rand = Random.Range(0, 10);
                        if (rand == 0 || rand == 1 || rand == 2)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                        else if (rand == 3)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else if (info.charaType == PlayerInfo.BLACKKOHAKU)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        int rand = Random.Range(0, 10);
                        if (rand == 0 || rand == 1 || rand == 2)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                        else if (rand == 3 || rand == 4)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
            }
            break;
        }

        case Const.TAG_SPECIAL_UPPER:
        {
            //相手:しょーゆーけん(上昇中)
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                if (info.charaType == PlayerInfo.KOHAKU)
                {
                }
                else if (info.charaType == PlayerInfo.YUKO)
                {
                }
                else if (info.charaType == PlayerInfo.MISAKI)
                {
                }
                else if (info.charaType == PlayerInfo.BLACKKOHAKU)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        int rand = Random.Range(0, 10);
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.SS;
                        }
                    }
                }
            }
            break;
        }

        case Const.TAG_SPECIAL_FALL:
        {
            if (info.charaType == PlayerInfo.KOHAKU)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else if (info.charaType == PlayerInfo.YUKO)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else if (info.charaType == PlayerInfo.MISAKI)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else if (info.charaType == PlayerInfo.BLACKKOHAKU)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }

            break;
        }

        case Const.TAG_HADOUKEN:
        {
            //相手:はどーけん
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                if (prevAction == PlayerInfo.Action.Guard)
                {
                    action = PlayerInfo.Action.Guard;
                }
                else
                {
                    int rand = Random.Range(0, 10);
                    if (info.charaType == PlayerInfo.KOHAKU)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else
                        {
                            action = RandomAttack();
                        }
                    }
                    else if (info.charaType == PlayerInfo.YUKO)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else
                        {
                            action = RandomAttack();
                        }
                    }
                    else if (info.charaType == PlayerInfo.MISAKI)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else
                        {
                            action = RandomAttack();
                        }
                    }
                    else if (info.charaType == PlayerInfo.BLACKKOHAKU)
                    {
                        if (rand == 0)
                        {
                            action = PlayerInfo.Action.Guard;
                        }
                        else
                        {
                            action = RandomAttack();
                        }
                    }
                }
            }
            break;
        }

        case Const.TAG_LITE_DAMAGE:
        {
            //相手:小ダメージ
            if (info.charaType == PlayerInfo.KOHAKU)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else if (info.charaType == PlayerInfo.YUKO)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else if (info.charaType == PlayerInfo.MISAKI)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else if (info.charaType == PlayerInfo.BLACKKOHAKU)
            {
                if (info.sGage >= Const.MAX_S_GAGE)
                {
                    int rand = Random.Range(0, 10);
                    if (rand == 0 || rand == 1 || rand == 2)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                    else
                    {
                        action = RandomAttack();
                    }
                }
                else
                {
                    action = RandomAttack();
                }
            }
            break;
        }

        case Const.TAG_MIDDLE_DAMAGE:
        {
            //相手:中ダメージ
            if (info.sGage >= Const.MAX_S_GAGE)
            {
                int rand = Random.Range(0, 10);
                if (rand == 0 || rand == 1 || rand == 2)
                {
                    action = PlayerInfo.Action.SS;
                }
                else
                {
                    action = RandomAttack();
                }
            }
            else
            {
                action = RandomAttack();
            }
            break;
        }

        case Const.TAG_DOWN:
        {
            //相手:ダウン
            break;
        }

        case Const.TAG_HEADSPRING:
        {
            //相手:起き上がり中
            if (gameObject.tag == Const.TAG_GUARD)
            {
                action = PlayerInfo.Action.Guard;
            }
            else
            {
                int rand = Random.Range(0, 10);
                if (rand == 0)
                {
                    action = PlayerInfo.Action.SS;
                }
                else if (rand == 1)
                {
                    action = RandomAttack();
                }
            }
            break;
        }

        case Const.TAG_GUARD:
        {
            //相手:ガード
            int guardRate = 25;
            if (level == Const.GAME_LEVEL_HEARD)
            {
                guardRate = 55;
            }
            int rand = Random.Range(0, guardRate);
            if (info.charaType == PlayerInfo.KOHAKU)
            {
                if (rand == 0 || rand == 1 || rand == 2 || rand == 3)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 4)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 6)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
            }
            else if (info.charaType == PlayerInfo.YUKO)
            {
                if (rand == 0 || rand == 1 || rand == 2 || rand == 3)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 4)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 6)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
            }
            else if (info.charaType == PlayerInfo.MISAKI)
            {
                if (rand == 0 || rand == 1 || rand == 2 || rand == 3)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 4)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 6)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
            }
            else if (info.charaType == PlayerInfo.BLACKKOHAKU)
            {
                if (rand == 0 || rand == 1 || rand == 2 || rand == 3)
                {
                    action = PlayerInfo.Action.Punch;
                }
                else if (rand == 4)
                {
                    action = PlayerInfo.Action.Kick;
                }
                else if (rand == 6)
                {
                    if (info.sGage >= Const.MAX_S_GAGE)
                    {
                        action = PlayerInfo.Action.SS;
                    }
                }
            }
            break;
        }
        }
        prevAction = action;
        return(action);
    }
예제 #6
0
    void FixedUpdate()
    {
        if (playerInfo.life <= 0)
        {
            return;
        }

        if (GameMaster.Instance.state != GameMaster.GameState.Start)
        {
            return;
        }

        if (playerInfo.humanType == PlayerInfo.HumanType.Com)
        {
            action = enemyAi.GetAction(playerInfo, humanPlayer.tag);
        }

        AnimatorStateInfo state = animator.GetCurrentAnimatorStateInfo(0);

        if (isDamage || gameObject.tag == Const.TAG_NOMOVE || gameObject.tag == Const.TAG_NODAMAGE ||
            state.IsName("Solt") ||
            state.IsName("BigDamage") ||
            gameObject.tag == Const.TAG_SPECIAL_START ||
            gameObject.tag == Const.TAG_SPECIAL ||
            gameObject.tag == Const.TAG_SPECIAL_FALL ||
            gameObject.tag == Const.TAG_SPECIAL_UPPER ||
            gameObject.tag == Const.TAG_HADOUKEN ||
            gameObject.tag == Const.TAG_MIDDLE_DAMAGE ||
            gameObject.tag == Const.TAG_DOWN ||
            isHadouken ||
            specialMove ||
            gameObject.tag == Const.TAG_DEAD)
        {
            return;
        }

        if (!firstPunch && !special && !specialMove && action == PlayerInfo.Action.Special)
        {
            special = true;
            Invoke("SpecialOff", 0.5f);
            animator.SetBool("Special", true);
        }
        else if (!firstPunch && action == PlayerInfo.Action.Punch)
        {
            firstPunch = true;
            Invoke("PuchOff", 0.4f);
            animator.SetBool("Jab", true);
        }
        else if (firstKick && action == PlayerInfo.Action.Kick)
        {
            animator.SetBool("Solt", true);
        }
        else if (!firstKick && !state.IsName("Hikick") && action == PlayerInfo.Action.Kick)
        {
            firstKick = true;
            Invoke("KickOff", 0.6f);
            animator.SetBool("Hikick", true);
        }
        else if (action == PlayerInfo.Action.Guard)
        {
            animator.SetBool("Guard", true);
            return;
        }
        else if (action == PlayerInfo.Action.SS)
        {
            if (playerInfo.sGage >= Const.MAX_S_GAGE)
            {
                animator.SetBool("Hadouken", true);
            }
        }
        else
        {
            animator.SetBool("Guard", false);
        }

        action = PlayerInfo.Action.None;
    }