Exemplo n.º 1
0
    /**
     * <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);
    }
Exemplo n.º 2
0
 public void PlayerFellOutOfBounds()
 {
     if (OnRespawn != null)
     {
         OnRespawn.Invoke();
     }
 }
Exemplo n.º 3
0
    private IEnumerator EndGameRoutine()
    {
        yield return(new WaitForSeconds(3));

        controller.transform.position = startPosition;
        controller.playerHealth.ResetHp();
        OnRespawn?.Invoke();
    }
Exemplo n.º 4
0
    public void Respawn()
    {
        rigBody.velocity        = default(Vector2);
        rigBody.angularVelocity = 0;

        OnRespawn?.Invoke(rigBody.transform, body);

        StartCoroutine(IEWaitingAfterRespawn(1f));
    }
Exemplo n.º 5
0
        // 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);
            }
        }
Exemplo n.º 6
0
 public void CauseRespawn()
 {
     numResets++;
     if (numResets <= 3)
     {
         OnRespawn.Invoke();
     }
     else
     {
         Application.LoadLevel(Application.loadedLevel);
     }
 }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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;
            }
        }
Exemplo n.º 9
0
 public override void Die()
 {
     //enemies.Remove(this);
     GameObject.SetActive(false);
     OnRespawn?.Invoke(Enemy);
 }