/** * <summary> * Lets this object respawn. * </summary> * <remarks> * See the class description for an explanation on how respawn positions are determined. * This method will also make this object visible using <see cref="GameObjectExtensions.MakeVisible"/>. * </remarks> */ public void Respawn(RespawnReason reason = RespawnReason.Other) { var respawnPosition = RespawnPosition; // Move to position of the spawner when respawning if (TryGetComponent(out PhysicsEffects physicsEffects)) { physicsEffects.Teleport(respawnPosition); } else if (TryGetComponent(out Rigidbody2D body)) { body.position = respawnPosition; } else { this.transform.position = respawnPosition; } // Make visible again(, if we have been invisible) this.gameObject.MakeVisible(); OnRespawn?.Invoke(respawnPosition, reason); }
public void PlayerFellOutOfBounds() { if (OnRespawn != null) { OnRespawn.Invoke(); } }
private IEnumerator EndGameRoutine() { yield return(new WaitForSeconds(3)); controller.transform.position = startPosition; controller.playerHealth.ResetHp(); OnRespawn?.Invoke(); }
public void Respawn() { rigBody.velocity = default(Vector2); rigBody.angularVelocity = 0; OnRespawn?.Invoke(rigBody.transform, body); StartCoroutine(IEWaitingAfterRespawn(1f)); }
// Token: 0x060013B8 RID: 5048 RVA: 0x0001CB98 File Offset: 0x0001BB98 protected internal override void Execute(ActivityExecutionContext context) { OnRespawn onRespawn = new OnRespawn(base.Entrant.PersonaId, this.respawnTargetPersonaId.Value); LocalHumanOpponent localHumanOpponent = base.Entrant.Opponent as LocalHumanOpponent; if (localHumanOpponent != null) { onRespawn.Synchronize(Ports.Gameplay); } }
public void CauseRespawn() { numResets++; if (numResets <= 3) { OnRespawn.Invoke(); } else { Application.LoadLevel(Application.loadedLevel); } }
public bool Ressurect(int _amount, ISource _source) { if (!IsDead) { Debug.Log($"Health is not dead"); return(false); } IsDead = false; OnRespawn?.Invoke(); Resource.Gain(_amount, _source); return(true); }
public void RespawnPlayer() { if (!_respawned) { _killed = false; var pos = GameObject.Find("Managers").GetComponent <OnlineManager>().ChoosePos(); gameObject.transform.position = pos; SetComponentsState(true, RigidbodyType2D.Dynamic); OnRespawn?.Invoke(); _respawned = true; } }
public override void Die() { //enemies.Remove(this); GameObject.SetActive(false); OnRespawn?.Invoke(Enemy); }