private void FixedUpdate()
    {
        if (RIGID_BODY.velocity.y < -0.2f)
        {
            RIGID_BODY.velocity += (-Vector3.up * GravityMultiplier);
        }

        if (RIGID_BODY.velocity.y > 0.2f && !Jump)
        {
            RIGID_BODY.velocity += (-Vector3.up * PullMultiplier);
        }

        playerRig.localPosition = Vector3.Lerp(playerRig.localPosition, new Vector3(0, -0.46f, playerRigPosZ), 6 * Time.deltaTime);


        if (transform.position.y < -10)
        {
            LevelDebugManager levelDebugManager = GameObject.Find("LevelDebugManager").transform.GetComponent <LevelDebugManager>();
            levelDebugManager.Death();
        }


        if (Dying)
        {
            animator.SetBool(CharacterControl.TransitionParameter.Dying.ToString(), true);
            Dying = false;
        }
    }
Exemple #2
0
    public IEnumerator TriggerDeath()
    {
        tracking = false;

        /* Basic death while we don't have a real character. we just disappear */

        /*
         * if (target != null && target.tag == "Player") {
         *  target.localScale = new Vector3(0,0,0);
         *  target.gameObject.SetActive(false);
         * }
         */

        target.GetComponent <CharacterControl>().Dying = true;

        Instantiate(wrongSoundPrefab, transform.position, transform.rotation);
        GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMove>().enabled = false;

        /* Wait 2 seconds until we restart the level */
        yield return(new WaitForSeconds(3f));

        LevelDebugManager levelDebugManager = GameObject.Find("LevelDebugManager").transform.GetComponent <LevelDebugManager>();

        levelDebugManager.Death();
    }