private void OnTriggerStay(Collider other) { if (other.CompareTag("Player")) { OnPlayerEnter?.Invoke(other.transform.position); } }
private void OnTriggerEnter2D(Collider2D collider) { if (collider.tag == "Player") { Debug.Log("Player is in the zone"); OnPlayerEnter?.Invoke(this, EventArgs.Empty); } }
private void OnTriggerEnter(Collider other) { if (!isActivated && other.GetComponentInParent <Player_Character_Controller>() != null) { isActivated = true; OnPlayerEnter?.Invoke(); } }
void OnTriggerEnter(Collider other) { If(other.GetComponent <PlayerController>()) { if (!isVisitedByPlayer) { SetVisited(); } OnPlayerEnter?.Invoke(gridPosition); } }
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!"); } }
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; } } }
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(); } }
/// <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; }
private void Start() { OnPlayerEnter.AddListener(Step); }
void Start() { OnPlayerEnter.AddListener(AddCoin); }