Esempio n. 1
0
    public IEnumerator Respawn(bool atRandomPoint = true)
    {
        print("start of respawn");
        mIsDisabled     = false;
        mIsDead         = false;
        mIsInvolnurable = true;
        isRespawning    = true;

        if (atRandomPoint)
        {
            transform.position = mSpawnManager.GetRandomSpawnPoint();
        }
        else
        {
            transform.position = mSpawnManager.GetNextSpawnPoint();
        }

        transform.rotation = Quaternion.identity;

        yield return(StartCoroutine(PopOutAndIn()));

        float startTime = Time.time;

        while (startTime + involnurableTime > Time.time)
        {
            mAvatarGraphicsMain.renderer.enabled    = !mAvatarGraphicsMain.renderer.enabled;
            mAvatarGraphicsOverlay.renderer.enabled = !mAvatarGraphicsOverlay.renderer.enabled;

            yield return(new WaitForSeconds(involnurableBlinkTime));
        }

        mAvatarGraphicsMain.renderer.enabled    = true;
        mAvatarGraphicsOverlay.renderer.enabled = true;

        isRespawning    = false;
        mIsInvolnurable = false;
    }