public void Push(Vector2 direction, float force, float duration) { if (stateManager.GetState() == PlayerState.INVINCIBLE) { return; } rb.AddForce(direction.normalized * force, ForceMode2D.Impulse); stateManager.ChangeStateTemporaly(PlayerState.PUSHED, duration); }
private void Update() { playerStateManager.Update(); Do_AnyState(); #if UNITY_EDITOR if (playerStateManager.GetState() == null) { return; } // 現在のステートをInspecter上に表示 stateName = playerStateManager.GetState().ToString(); #endif }
void Update() { //if the player's height is below the minimum, bring up menu if (character.position.y < GAME_OVER_HEIGHT) { //pause menuManager.ToggleMenu(); SetGameInfoText(); SetHighScore(); RestartGame(); } /*if(RollingCharacterController.state.Equals("dead")){ * menuManager.ToggleMenu(); * SetGameInfoText(); * SetHighScore(); * RestartGame(); * * RollingCharacterController.state = "active"; * }*/ if (PlayerStateManager.GetState().Equals("dead")) { menuManager.ToggleMenu(); SetGameInfoText(); SetHighScore(); RestartGame(); PlayerStateManager.SetState("active"); //RollingCharacterController.state = "active"; } }
private void OnCollisionStay2D(Collision2D collision) { var penguin = collision.gameObject.GetComponent <PenguinMovement>(); if (penguin != null) { var tags = collision.gameObject.GetComponent <Tags>(); var isBonus = tags != null && tags.Contains("bonus"); if (stateManager.GetState() == PlayerState.INVINCIBLE && !isBonus) { Destroy(penguin.gameObject); onPenguinKilled?.Invoke(); } else { onCollide?.Invoke(); } } }