/// <summary> /// Callback for the proximity of a player updating (entering /// or leaving a physics body). /// </summary> /// <param name="name">Name of the physics body.</param> /// <param name="status">Status of the player.</param> /// <param name="player">Player that changed.</param> public override void OnProximityUpdate(string name, PhysicsCollisionStatus status, Player player) { // Return if the name isn't correct. if (name != "BusDoorInner" && name != "BusDoorOuter") { return; } // Update the counters and move the door. var innerCounter = this.GetVar <int>("InnerCounter"); var outerCounter = this.GetVar <int>("OuterCounter"); if (status == PhysicsCollisionStatus.Enter) { // Add the counter. if (name == "BusDoorInner") { innerCounter += 1; } else { outerCounter += 1; } // Open the door if the first player entered the inner region. if (innerCounter == 1 && outerCounter >= 1) { this.MoveDoor(true); } } else if (status == PhysicsCollisionStatus.Leave) { // Subtract the counter. if (name == "BusDoorInner") { innerCounter += -1; } else { outerCounter += -1; } // Close the door if all players left. if (innerCounter == 0 && outerCounter == 0) { this.MoveDoor(false); } } // Store the counters. this.SetVar("InnerCounter", innerCounter); this.SetVar("OuterCounter", outerCounter); }
public override void OnProximityUpdate(string name, PhysicsCollisionStatus status, Player player) { if (name == "Firepit") { if (status == PhysicsCollisionStatus.Enter) { //this seems really easy to break, but it's interpreted directly from the script so uh if (IsBurning && GameObject.TryGetComponent <SkillComponent>(out var skillComponent)) { skillComponent.CalculateSkillAsync(43, GameObject); AddTimerWithCancel(2, "TimeBetweenCast"); } } else if (status == PhysicsCollisionStatus.Leave) { CancelAllTimers(); } } }