Ejemplo n.º 1
0
    // Update is called once per frame
    public void UpdateVisualStates(Player.PlayerState State, Vector3 velocity, float height)
    {
        _velocity = velocity;
        _height   = height;

        switch (State)
        {
        case Player.PlayerState.WATER:
            UpdateWater();
            break;

        case Player.PlayerState.CLOUD:
            UpdateCloud();
            break;

        case Player.PlayerState.STEAM:
            UpdateSteam();
            break;

        case Player.PlayerState.RAIN:
            UpdateRain();
            break;

        case Player.PlayerState.FLOAT:
            UpdateFloat();
            break;
        }
    }
Ejemplo n.º 2
0
    //Called once when state switched
    public void StartVisualStates(Player.PlayerState State)
    {
        switch (State)
        {
        case Player.PlayerState.WATER:
            StartWater();
            break;

        case Player.PlayerState.CLOUD:
            StartCloud();
            break;

        case Player.PlayerState.STEAM:
            StartSteam();
            break;

        case Player.PlayerState.RAIN:
            StartRain();
            break;

        case Player.PlayerState.FLOAT:
            StartFloat();
            break;
        }
    }
Ejemplo n.º 3
0
        private void PlayerStateChanged(Player.PlayerState newState)
        {
            switch (newState)
            {
            case Player.PlayerState.Playing:
            case Player.PlayerState.Paused:
            {
                if (Template.FindName("Marquee", this) is MarqueeControl marquee)
                {
                    if (!marquee.IsStarted)
                    {
                        marquee.Start();
                    }
                }
            }
            break;

            case Player.PlayerState.NotLoaded:
            case Player.PlayerState.Stopped:
            {
                if (Template.FindName("Marquee", this) is MarqueeControl marquee)
                {
                    if (marquee.IsStarted)
                    {
                        marquee.Stop();
                    }
                }
            }
            break;

            default:
                Console.WriteLine("Unrecognized PlayerState: " + newState);
                break;
            }
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Called whenever a Player's state changes. If every player is at the same waiting state, Deck triggers the next step
    /// </summary>
    /// <param name="player">The Player </param>
    /// <param name="newState">The state the player was in</param>
    private void OnPlayerStateChanged(Player player, Player.PlayerState newState)
    {
        foreach (Player playercheck in players)
        {
            if (playercheck.State() != newState)
            {
                return;
            }
        }
        switch (newState)
        {
        case Player.PlayerState.WaitingToPlay:
            foreach (Player playerToPlay in players)
            {
                playerToPlay.PlayCard();
            }
            break;

        case Player.PlayerState.WaitingToDraw:
            UpdateText();
            foreach (Player playerToDraw in players)
            {
                playerToDraw.DrawCardPack();
            }
            break;

        case Player.PlayerState.WaitingForNextRound:
            FinishRound();
            break;
        }
    }
Ejemplo n.º 5
0
        //Player Listener
        private void PlayerStateChanged(Player.PlayerState playerState)
        {
            switch (playerState)
            {
            case Player.PlayerState.alive:

                CamMove.StartFollowing();
                CamZoom.ZoomToVelocity(player, defaultTransitionDuration);
                //CamShake.VelocityShake(player);
                CamRotation.VelocityRotation(player);     // currently deactivated in CamRotation
                break;

            case Player.PlayerState.dead:
                CamZoom.DeathZoom(Game.deathDelay);
                CamShake.DeathShake();
                CamRotation.RotateToDefault(Game.deathDelay);
                //CamRotation.DeathRotation(); //change to camshake
                //CamMove.StopFollowing();
                break;

            case Player.PlayerState.win:
                CamZoom.WinZoom(Game.deathDelay);
                CamRotation.RotateToDefault(Game.deathDelay);
                //CamRotation.DeathRotation(); //change to camshake
                //CamMove.StopFollowing();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 6
0
    public void ResolveCombat(Player.PlayerState playerAction)
    {
        if ((int)playerAction >= (int)(Enemy.AttackMove.NumOfMoves) || _inCombat == false || _enemyInCombat == null)
        {
            return;
        }

        if (_enemyInCombat == null)
        {
            return;
        }
        if (playerAction == Player.PlayerState.Special)
        {
            _enemyInCombat.Alive = false;
            return;
        }

        if ((int)playerAction == (int)_enemyInCombat.CurrentAttackMove)
        {
            _enemyInCombat.EndCombat(false);
            GameManager.Instance.EnemiesKilled(1);
            _enemiesHolder.Remove(_enemyInCombat);
        }
        else
        {
            EnemyExitCombat();
        }
    }
Ejemplo n.º 7
0
 public void ResetPlayerState(Player.PlayerState state)
 {
     Player.instance.SetState(state);
     if (listInGameObj != null && listInGameObj.Count > 0)
     {
         foreach (GameObject go in listInGameObj)
         {
             PhotonNetwork.Destroy(go);
         }
     }
     PopupManager.ShowText("Ending game...", 3f);
 }
 /// <summary>
 /// Shows the menu.
 /// </summary>
 private void ShowMenu()
 {
     this.startMenu.SetActive(this.state == GameState.Start);
     this.gameoverMenu.SetActive(this.state == GameState.Over);
     this.pauseMenu.SetActive(this.state == GameState.Pause);
     this.topMenu.SetActive(this.state == GameState.Playing);
     this.menuBg.SetActive(this.state == GameState.Start ||
                           this.state == GameState.Over ||
                           this.state == GameState.Pause
                           );
     Player.PlayerState playerState = (this.state == GameState.Playing) ? Player.PlayerState.Go : Player.PlayerState.Alive;
     this.mainPlayer.SetState(playerState);
 }
Ejemplo n.º 9
0
        private void PlayerStateChanged(Player.PlayerState p)
        {
            switch (p)
            {
            case Player.PlayerState.win:
                //GetComponent<ParticleSystem>().Clear();
                GetComponent <Animation>().Play("finishFadeOut");

                Debug.Log("PLAYFINISHPARTICLES");
                ps.gameObject.SetActive(true);
                ps.Play();
                //GetComponent<ParticleSystem>().Play();
                break;
            }
        }
Ejemplo n.º 10
0
        private void PlayerStateChanged(Player.PlayerState playerState)
        {
            switch (playerState)
            {
            case Player.PlayerState.alive:
                break;

            case Player.PlayerState.dead:
                break;

            case Player.PlayerState.win:
                break;

            default:
                break;
            }
        }
Ejemplo n.º 11
0
 //player go to special point
 IEnumerator gotoPoint(Player.PlayerState state, Vector3 point, string name, float speed)
 {
     _canInteractive    = false;
     player.Playerstate = state;
     if (point.x - player.transform.position.x < 0)
     {
         player.SetPlayerRotation(180);
     }
     else
     {
         player.SetPlayerRotation(0);
     }
     while (player.transform.position.x != point.x)
     {
         player.transform.position = Vector3.MoveTowards(player.transform.position, point, speed * Time.deltaTime);
         yield return(null);
     }
     //
     afterGoToPoint(name);
 }
Ejemplo n.º 12
0
        //Listener
        private void PlayerStateChanged(Player.PlayerState playerState)
        {
            switch (playerState)
            {
            case Player.PlayerState.alive:
                break;

            case Player.PlayerState.dead:
                soundPlayer.PlaySingle(deathSound);
                PlayWooshSound();
                break;

            case Player.PlayerState.win:
                soundPlayer.PlaySingle(winSound);
                soundPlayer.PlaySingle(achievementSound);
                //PlayWooshSound();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 13
0
    public void SetBuff(bool addBUff, Player.PlayerState state, bool addHp, bool NormalTrigger, bool ignoreEnemy, bool canEat, bool SetNormal)
    {
        //playerCom.ReIgnoreCollisionTrigger = true;

        if (addBUff)
        {   //切换player当前状态
            playerCom.currentPlayerState = state;
        }

        if (addHp)
        {   //是否加HP
            if (playerCom.HP < 6)
            {
                playerCom.HP++;
            }
            Debug.Log("Full HP");
        }

        //是否穿透(同时无视敌人)
        if (ignoreEnemy)
        {
            eye.tag = "Untagged";
        }

        //是否可以吃怪 canEat == true 时可以吃
        if (!canEat)
        {
            //eatPoint.gameObject.SetActive(false);
            GameObject.Destroy(eatPoint.GetComponent <Collider2D>());
            //Debug.Log("Destroy eatPoint BoxCollider2D");
        }

        //是否需要恢复默认状态
        if (SetNormal)
        {
            playerCom.setToNormalTrigger = NormalTrigger;
        }
    }
Ejemplo n.º 14
0
    void FixedUpdate()
    {
        // Drag velocities
        mRigidbody.velocity        = mRigidbody.velocity * 0.9f;
        mRigidbody.angularVelocity = mRigidbody.angularVelocity * 0.9f;

        // Apply force if velocity is not maximum
        if (mRigidbody.velocity.sqrMagnitude < maxSpeed * maxSpeed)
        {
            Vector3 force = new Vector3(0.0f, 0.0f, 0.0f);

            // Find target type
            Player.PlayerState target = Player.PlayerState.SQUARE;
            switch (gameObject.tag)
            {
            case "Square":
                target = Player.PlayerState.SQUARE;
                break;

            case "Triangle":
                target = Player.PlayerState.TRIANGLE;
                break;

            case "Star":
                target = Player.PlayerState.STAR;
                break;

            default:
                target = Player.PlayerState.SQUARE;
                break;
            }
            // Check if user still exists
            if (player != null && (player.transform.position - transform.position).sqrMagnitude < 625.0f &&
                !player.GetComponent <Player>().invisible)
            {
                // Force by eletrical charge with player
                // If same state, gets attracted, else repels (which is stronger)
                if ((player.GetComponent <Player> ()).GetState() != target)
                {
                    float aForce = attractionForce;
                    if ((player.GetComponent <Player> ()).GetState() == Player.PlayerState.CIRCLE)
                    {
                        aForce /= 2.0f;
                    }
                    force -= (gameObject.transform.position - player.transform.position).normalized
                             * (aForce / (gameObject.transform.position - player.transform.position).sqrMagnitude);
                }
                else
                {
                    force += (gameObject.transform.position - player.transform.position).normalized
                             * (repelForce / (gameObject.transform.position - player.transform.position).sqrMagnitude);
                }

                mRigidbody.AddForce(new Vector2(force.x, force.y));

                // Ajust rotation to point where it's going
                gameObject.transform.rotation = Quaternion.Slerp(transform.rotation,
                                                                 Quaternion.LookRotation(new Vector3(0.0f, 0.0f, 1.0f), new Vector3(force.x, force.y, 0.0f))
                                                                 , alphaRotation);
            }
        }

        // Get light ahead of the body
        Vector2 scaledVelocity = mRigidbody.velocity / maxSpeed;

        selfLight.transform.position = gameObject.transform.position + (new Vector3(scaledVelocity.x, scaledVelocity.y, -1.0f));
    }
Ejemplo n.º 15
0
 private void OnNewLobbyPlayer(Player.PlayerState playerState)
 {
     _lobbyPlayers.Add(playerState);
 }
Ejemplo n.º 16
0
 public void SubmitPlayerAction(Player.PlayerState playerAction)
 {
     ResolveCombat(playerAction);
 }