Exemplo n.º 1
0
 protected void TransitionInternal()
 {
     if (transitionType == TransitionType.SameScene)
     {
         GameObjectTeleporter.Teleport(transitioningGameObject, destinationTransform.transform);
     }
 }
Exemplo n.º 2
0
    // RESPAWN

    public void Respawn(bool resetHealth, bool useCheckpoint)
    {
        if (resetHealth)
        {
            damageable.SetHealth(damageable.startingHealth);
        }


        animator.ResetTrigger(hashHurtPara);
        if (flickerCoroutine != null)
        {
            StopFlickering();
        }
        animator.SetTrigger(hashRespawnPara);


        if (useCheckpoint && lastCheckpoint != null)
        {
            UpdateFacing(lastCheckpoint.respawnFacingLeft);
            GameObjectTeleporter.Teleport(gameObject, lastCheckpoint.transform.position);
        }
        else
        {
            UpdateFacing(startingFacingLeft);
            GameObjectTeleporter.Teleport(gameObject, startingPosition);
        }
    }
Exemplo n.º 3
0
 private void OnCollisionEnter(Collision other)
 {
     if (other.transform.GetComponent <TeleportBullet>() != null)
     {
         GameObjectTeleporter.Teleport(PlayerController.instance.gameObject, transform.TransformPoint(TeleportLandOffset));
         //PlayerController.instance.transform.position = transform.TransformPoint( TeleportLandOffset);
     }
 }
Exemplo n.º 4
0
    /* void OnTriggerEnter2D(Collider2D other)
     * {
     *   if (other.gameObject == transitioningGameObject)
     *   {
     *       m_TransitioningGameObjectPresent = true;
     *
     *
     *
     *       if (transitionWhen == TransitionWhen.OnTriggerEnter)
     *           TransitionInternal();
     *   }
     * }
     *
     * void OnTriggerExit2D(Collider2D other)
     * {
     *   if (other.gameObject == transitioningGameObject)
     *   {
     *       m_TransitioningGameObjectPresent = false;
     *   }
     * }
     *
     */
    private void OnTriggerStay2D(Collider2D other)

    {
        if (other.tag == "Player" && Input.GetButtonDown("Interact"))
        {
            GameObjectTeleporter.Teleport(transitioningGameObject, destinationTransform.transform);

            Debug.Log("interacted");

            Debug.Log("stay" + other.tag);
        }
    }
Exemplo n.º 5
0
    void Update()
    {
        if (!m_TransitioningGameObjectPresent)
        {
            return;
        }

        if (transitionWhen == TransitionWhen.InteractPressed)
        {
            if (transitionType == TransitionType.SameScene)
            {
                GameObjectTeleporter.Teleport(transitioningGameObject, destinationTransform.transform);
            }
        }
    }
    protected void TransitionInternal()
    {
        if (requiresInventoryCheck)
        {
            if (!inventoryCheck.CheckInventory(inventoryController))
            {
                return;
            }
        }

        if (transitionType == TransitionType.SameScene)
        {
            GameObjectTeleporter.Teleport(transitioningGameObject, destinationTransform.transform);
        }
        else
        {
        }
    }
Exemplo n.º 7
0
        private void Respawn(bool p_resetHealth, bool p_useCheckPoint)
        {
            if (m_flickerCoroutine != null)
            {
                StopFlickering();
            }

            m_animator.SetTrigger(m_hashRespawnPara);

            UpdateFacing(m_startingFacingLeft);
            GameObjectTeleporter.Teleport(gameObject, m_startingPosition);

            m_animator.ResetTrigger(m_hashHurtPara);
            m_animator.ResetTrigger(m_hashDeadPara);

            if (p_resetHealth)
            {
                DamageableRef.SetHealth(DamageableRef.StartingHealth);
            }
        }
Exemplo n.º 8
0
    IEnumerator DieCoroutine()
    {
        m_ReadInput       = false;
        m_StoppedShooting = true;
        VerifyShootRoutine();
        deathParticle.Play();

        spriteRenderer.enabled = false;
        hitboxRenderer.enabled = false;
        gameObject.layer       = 13;

        damageable.EnableInvulnerability(true);
        yield return(new WaitForSeconds(2.0f)); //wait one second before respawing

        spawnParticle.Play();
        GameObjectTeleporter.Teleport(gameObject, respawnLocation.position);

        spriteRenderer.enabled = true;

        damageable.EnableInvulnerability();
        StartFlickering();
        m_ReadInput = true;
        yield return(new WaitForEndOfFrame());
    }
    public void Respawn(bool resetHealth, bool useCheckpoint) // Respawns character. Can use level start or checkpoint and can reset health if needed.
    {
        if (resetHealth)
        {
            damageable.SetHealth(damageable.startingHealth);
        }

        animator.ResetTrigger(hashHurtParameter); // Stops being "hurt" since respawning
        if (flickerCoroutine != null)
        {
            StopFlickering();
        }
        animator.SetTrigger(hashRespawnParameter);

        if (useCheckpoint && lastCheckpoint != null)
        {
            ForceFacing(lastCheckpoint.respawnFacingLeft);
            GameObjectTeleporter.Teleport(gameObject, lastCheckpoint.transform.position); // Teleports player to last checkpoint
            CheckGrounded();
            if (boy != null)
            {
                boy.Respawn(lastCheckpoint.transform.position);
            }
        }
        else
        {
            ForceFacing(startingFacingLeft);
            GameObjectTeleporter.Teleport(gameObject, startingPosition); // Teleports player to level start.
            CheckGrounded();
            animator.SetBool(hashGroundedParameter, true);
            if (boy != null)
            {
                boy.Respawn(startingPosition);
            }
        }
    }
Exemplo n.º 10
0
 public void Respawn(Vector3 playerLoc)
 {
     GameObjectTeleporter.Teleport(gameObject, new Vector2(playerLoc.x - distanceFromPlayer, playerLoc.y));
 }