예제 #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         BGM = GameObject.FindGameObjectWithTag("BackgroundMusic").GetComponent <AudioSource>();
         Debug.Log("Entered");
         BGM.Stop();
         EndSound.Play();
         PlayerMovement    playerMovement = other.GetComponent <PlayerMovement>();
         NavMeshAgent      agent          = other.GetComponent <NavMeshAgent>();
         Animator          animator       = other.GetComponentInChildren <Animator>();
         TransformFollower camera         = Camera.main.GetComponent <TransformFollower>();
         if (playerMovement && agent && animator && camera)
         {
             heartCanvas.SetActive(false);
             canvasEnd.SetActive(true);
             playerMovement.enabled = false;
             agent.enabled          = true;
             agent.SetDestination(swimHere.position);
             animator.SetFloat("Forward", 1.0f);
             camera.stopFollowing = true;
             StartCoroutine(waitToChangeScene());
         }
     }
 }
예제 #2
0
    void Awake()
    {
        RandomAssignPlayerRole();
        PlayerGraphic_(photonView.CreatorActorNr % 3);
        if (photonView.IsMine)
        {
            PlayerManager.LocalPlayerInstance = this.gameObject;
            player = true;
            // show player name
            PlayerNameUI.GetComponent <Text>().text = PhotonNetwork.LocalPlayer.NickName;

            // check my role
            object myRole;
            PhotonNetwork.LocalPlayer.CustomProperties.TryGetValue("role", out myRole);
            if (myRole.ToString() == "seeker")
            {
                Player_SpotLight.SetActive(true);
            }
            else
            {
                PlayerGo.tag = "OtherPlayer";
            }

            // setup camera on 'my' controllable character only
            CamGo = GameObject.Find("Main Camera");

            TransformFollower tf = CamGo.GetComponent <TransformFollower>();
            tf.enabled = true;
            tf.target  = this.gameObject.transform;
        }
        else
        {
            DontDestroyOnLoad(this.gameObject);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        sentences      = new Queue <string>();
        canvas.enabled = false;
        player         = GameObject.FindGameObjectWithTag("Player");
        if (player == null)
        {
            Debug.LogWarning("No player found");
        }


        if (Camera.main)
        {
            cameraScript = Camera.main.GetComponent <TransformFollower>();
            if (cameraScript == null)
            {
                Debug.LogWarning("No main camera follower script");
            }
        }
        else
        {
            Debug.LogWarning("No main camera");
        }
    }
예제 #4
0
 public static void RemoveTransformFollower(TransformFollower follower)
 {
     _transformFollowers.Remove(follower);
 }