// プレイヤーの移動
    public void PlayerControll()
    {
        //Debug.Log(player.GetComponent<santa>().JudgeTouchEnemy());
        EnemyInfo.Types AttackEnemyType = player.GetComponent <santa>().GetEnemyAttack();
        rigidbody = player.GetComponent <Rigidbody2D>();

        //敵と触れているかどうか
        if (AttackEnemyType == EnemyInfo.Types.NONE)
        {
            float PlayerSpeed = player.GetComponent <santa>().Get_PlayerSpeed();

            rigidbody.MovePosition(player.transform.position + new Vector3(PlayerSpeed, GameInfo.GRAVITY, 0.0f));
        }
        else if (AttackEnemyType == EnemyInfo.Types.BIRD)
        {
            rigidbody.MovePosition(player.transform.position + new Vector3(0.0f, GameInfo.GRAVITY, 0.0f));
        }
        else if (AttackEnemyType == EnemyInfo.Types.CAT)
        {
            rigidbody.MovePosition(player.transform.position + new Vector3(0.0f, 0.0f, 0.0f));
        }

        // プレイヤーが落ちているかどうかを確認する

        /*
         * Vector3 PlayerUpLeftPosition = player.GetComponent<santa>().Get_UpLeftPosition();
         *
         * if(camera.transform.position.y - 7.5f > PlayerUpLeftPosition.y){
         *  // SetCurrentGameState(GameState.GAMEOVER);
         * }
         */
    }
Exemple #2
0
    void TouchEnemy(EnemyInfo.Types type)
    {
        switch (type)
        {
        case EnemyInfo.Types.BIRD:
            SetEnemyAttack(EnemyInfo.Types.BIRD);
            SwitchSantaImage(2);
            // GameControllerにて移動を制御してる
            break;

        case EnemyInfo.Types.CAT:
            SetEnemyAttack(EnemyInfo.Types.CAT);
            StartCoroutine("TouchCat");
            break;
        }
    }
Exemple #3
0
 // ゲームの状態をセットする
 public void SetEnemyAttack(EnemyInfo.Types state)
 {
     EnemyAttack = state;
 }