Exemplo n.º 1
0
    void SetPlayerPosition(Vector2 pos)
    {
        int count = Resources.FindObjectsOfTypeAll <Player>().Length;

        if (count > 0)
        {
            Player player = Resources.FindObjectsOfTypeAll <Player>()[0];
            player.ClearState();
            player.transform.position = pos;
            count = Resources.FindObjectsOfTypeAll <UI_Handler>().Length;
            if (count > 0)
            {
                UI_Handler handler = Resources.FindObjectsOfTypeAll <UI_Handler>()[0];
                handler.SetHealthBar(player.HP);
            }
        }
        count = Resources.FindObjectsOfTypeAll <Kid>().Length;
        if (count > 0)
        {
            Kid kid = Resources.FindObjectsOfTypeAll <Kid>()[0];
            kid.transform.position = GetEntrancePos() + new Vector2(1, 0);
            kid.CleanState();
        }
    }