Пример #1
0
    private void TeleportFighters()
    {
        // Make sure player is facing right direction
        SpriteRenderer playerSprite = Player.GetComponent <SpriteRenderer>();

        if (playerSprite.flipX)
        {
            playerSprite.flipX = false;
        }

        // Positioning the player
        Player.transform.position = new Vector2(PlayerFightSpawn.transform.position.x, PlayerFightSpawn.transform.position.y);
        PlayerMovement pm = Player.GetComponent <PlayerMovement>();

        pm.CanMove(false); // player cannot move

        // positioning mob
        transform.parent.position = new Vector2(MobFightSpawn.transform.position.x, MobFightSpawn.transform.position.y);

        // ready to fight
        fightManager.CanFight(true);
        fightManager.SetOpponent(transform.parent.gameObject.GetComponent <Mob>()); // storing player's opponent

        // activate health bars
        fightManager.ShowFightUI(true);
    }
Пример #2
0
    private void ResetForNextFight()
    {
        // Deactivating Fight UI
        fightManager.ShowFightUI(false);

        // Resetting Player
        Player.GetComponent <PlayerFight>().ResetForNextFight();
    }
 public void ResetForNextFight()
 {
     gameObject.GetComponent <PlayerMovement>().CanMove(true); // Player able to move again
     CurrentHealth = MaxHealth;                                // Resetting player's health after fight
     slider.value  = CurrentHealth;                            // Updating healthbar
     ReturnToOldPosition();                                    // Moving player back to old pos
     fightManager.ShowFightUI(false);                          // Hide UI
     opponent = null;                                          // resetting opponent
 }