示例#1
0
    private void NextTurn(PlayerScript player)
    {
        if (Game.PlayAudio())
        {
            var audioFromPlayer = player.GetComponentInChildren <AudioSource>();
            if (audioFromPlayer != null && audioFromPlayer.enabled)
            {
                audioFromPlayer.Play();
            }
        }

        if (!player.UsedMove)
        {
            player.Multiplier = 1;
            UpdateGui(player.MultiplierText, player.Multiplier);
        }
        player.UsedMove = false;
        if (Game.GetPlayers().IndexOf(player) == Game.GetPlayers().Count - 1)
        {
            this.time = 0.0f;
            ResetSliders();
            enemyMove = false;
        }

        player.gameObject.GetComponent <Renderer>().material.color = player.BaseColor;
        player.ColorChange = false;
        var vector = player.GetMoveBuffer();

        if (!vector.Equals(new Vector3(0, 0, 0)))
        {
            var position = player.transform.position;
            position += vector;
            var playerHit = CheckPositionForPlayer(position);

            if (grid.MoveTo(position.x, position.z, player) && playerHit == null)
            {
                player.gameObject.transform.Translate(vector);
            }
            else if (playerHit != null)
            {
                playerHit.GetHit(1);
                if (playerHit.Health <= 0)
                {
                    Destroy(playerHit.gameObject);
                    Game.GetPlayers().Remove(playerHit);
                    return;
                }
            }
            if (player.Multiplier <= 2)
            {
                player.Multiplier++;
            }
            UpdateGui(player.MultiplierText, player.Multiplier);
            if (beatShow)
            {
                MiddleNote.gameObject.transform.localScale = new Vector3(0.9f, 0.9f, 0.9f);
                beatShow = false;
            }
        }
    }