Пример #1
0
    void OnMouseDown()
    {
        if (!isPosses)
        {
            PlayerMovement player    = (PlayerMovement)FindObjectOfType(typeof(PlayerMovement));
            PlayerPoses    playerPos = (PlayerPoses)FindObjectOfType(typeof(PlayerPoses));

            if (roomBelong.setRoom == playerPos.room)
            {
                player.Stop();
                playerPos.PossesOject(player, this);
            }
            else
            {
                Debug.Log("Your in other room");
            }
        }
    }
Пример #2
0
 void Start()
 {
     playerPos   = (PlayerPoses)FindObjectOfType(typeof(PlayerPoses));
     agent       = GetComponent <NavMeshAgent>();
     allowToMove = true;
 }