예제 #1
0
 private void OnTriggerStay(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         OnPlayerEnter?.Invoke(other.transform.position);
     }
 }
예제 #2
0
 private void OnTriggerEnter2D(Collider2D collider)
 {
     if (collider.tag == "Player")
     {
         Debug.Log("Player is in the zone");
         OnPlayerEnter?.Invoke(this, EventArgs.Empty);
     }
 }
예제 #3
0
 private void OnTriggerEnter(Collider other)
 {
     if (!isActivated && other.GetComponentInParent <Player_Character_Controller>() != null)
     {
         isActivated = true;
         OnPlayerEnter?.Invoke();
     }
 }
예제 #4
0
 void OnTriggerEnter(Collider other)
 {
     If(other.GetComponent <PlayerController>())
     {
         if (!isVisitedByPlayer)
         {
             SetVisited();
         }
         OnPlayerEnter?.Invoke(gridPosition);
     }
 }
예제 #5
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.CompareTag("Player"))
            {
                OnPlayerEnter?.Invoke();

                var pos = transform.position;
                pos.y = other.transform.position.y;
                _gameStateData.ReachCheckPoint(1, pos);
                Debug.Log("Checkpoint!");
            }
        }
예제 #6
0
 private void Update()
 {
     // ReSharper disable once InvertIf
     if (Vector3.Distance(_player.transform.position, transform.position) < distanceToAssignToPlayer)
     {
         OnPlayerEnter?.Invoke(_player.gameObject);
         if (onAssignClip)
         {
             onAssignClip.Play();
         }
         if (autoDisable)
         {
             enabled = false;
         }
     }
 }
예제 #7
0
        public void Update()
        {
            var lastplayerrect = new Rectangle(Main.player.lastPosition.ToPoint(), new Point(50, 50));

            if (Main.player.rect.Intersects(bounds))
            {
                OnPlayerInside?.Invoke();
            }
            if (Main.player.rect.Intersects(bounds) && !lastplayerrect.Intersects(bounds))
            {
                OnPlayerEnter?.Invoke();
            }
            if (!Main.player.rect.Intersects(bounds) && lastplayerrect.Intersects(bounds))
            {
                OnPlayerExit?.Invoke();
            }
        }
예제 #8
0
    /// <summary>
    /// When player enter, initialize the level and spawn ennemies
    /// </summary>
    public void PlayerEnter()
    {
        // Indicate teleporter manager that the player is here
        TeleporterManager tpm = teleportersExit.GetComponent <TeleporterManager>();

        tpm.SetPlayerHere(true);
        tpm.SetLevelComplete(IsSublevelComplete, levelIndex);

        if (OnPlayerEnter == null)
        {
            tpm.EnableTeleporters();
        }
        else
        {
            OnPlayerEnter?.Invoke(this, EventArgs.Empty);
        }
    }
 protected virtual void Awake()
 {
     OnPlayerEnter?.Invoke(this);
     PersistentPlayerStats.Instance.SetPlayerStats(this);
     speedMultiplier = baseSpeedMultiplier;
 }
예제 #10
0
 private void Start()
 {
     OnPlayerEnter.AddListener(Step);
 }
예제 #11
0
 void Start()
 {
     OnPlayerEnter.AddListener(AddCoin);
 }