/*public void Eyes()
     * {
     *  int rev = 1;
     *  //if (reversed) { rev = -1; }
     *  eyes.transform.localPosition = Vector3.Lerp(eyes.transform.localPosition, new Vector3(rev * (moveX / 800), 0 * rev * (player_body.velocity.y / 80), 0), .4f);
     *
     *  if (!grounded)
     *  {
     *      return;
     *  }
     *  else
     *  {
     *      if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 0)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 1)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 2)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 3)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(true);
     *      }
     *  }
     * }*/

    public override void Jump()
    {
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        trail.emitting = true;

        if (teleorb_j)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;

            jump      = false;
            teleorb_j = false;
            teleorb   = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;

            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb_j)
        {
            triggerorb_j = false;
            triggerorb   = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (blue_j || green_j)
        {
            if (blue_j)
            {
                blue   = false;
                blue_j = false;
            }

            if (green_j)
            {
                green   = false;
                green_j = false;
            }

            playGravityParticles();

            reversed = !reversed;

            player_body.gravityScale *= -1;
            grav_scale *= -1;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        /*
         * int rev = 1;
         * if (reversed) { rev = -1; }
         *
         * if (jump)
         * {
         *  player_body.velocity = new Vector2(player_body.velocity.x, rev * player_body.velocity.x);
         * }
         * else
         * {
         *  player_body.velocity = new Vector2(player_body.velocity.x, rev * -player_body.velocity.x);
         * }*/
    }
    public override void Jump()
    {
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        if (teleorb && jump)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;
            jump    = false;
            teleorb = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;

            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb && jump)
        {
            triggerorb = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (yellow && jump)
        {
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            fromGround           = false;
            released             = false;
            jump                 = false;
            yellow               = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.1f);
            trail.emitting       = true;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (pink && jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            fromGround           = false;
            released             = false;
            jump                 = false;
            pink                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .94f);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (red && jump)
        {
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            fromGround           = false;
            released             = false;
            jump                 = false;
            red                  = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.4f);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (blue && jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            playGravityParticles();

            fromGround                = false;
            released                  = false;
            jump                      = false;
            blue                      = false;
            trail.emitting            = true;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * .4f);
            reversed                  = !reversed;
            player_body.gravityScale *= -1;
            grav_scale               *= -1;
            grounded                  = false;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (green && jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);

            playGravityParticles();

            fromGround = false;
            released   = false;
            jump       = false;
            green      = false;
            reversed   = !reversed;

            if (reversed)
            {
                jumpForce = -posJump;
            }
            else
            {
                jumpForce = posJump;
            }
            trail.emitting            = true;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * 1.1f);
            player_body.gravityScale *= -1;
            grav_scale *= -1;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (black && jump)
        {
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            fromGround           = false;
            black                = false;
            released             = false;
            jump                 = true;
            downjump             = true;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, -jumpForce * 1.1f);

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if ((grounded || time < 0.05f) && jump_ground)
        {
            time                 = 1;
            trail.emitting       = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce);
            grounded             = false;

            checkGrounded = false;
            checkGrounded = true;

            fromGround = true;
            jump       = false;
            downjump   = false;
        }/*
          * else if (fromGround && ((!reversed && released && player_body.velocity.y > 0) || (reversed && released && player_body.velocity.y < 0)))
          * {
          * player_body.velocity /= 2;
          * released = false;
          * fromGround = false;
          * }*/
    }
    public override void Jump()
    {
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        if (maxSpeed != 17)
        {
            maxSpeed = Mathf.Lerp(maxSpeed, 17, time);
            time    += 1f * Time.deltaTime;

            if (time > 1.0f)
            {
                time = 0.0f;
            }
        }

        if (teleorb && jump)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;
            teleorb = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;
            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb && jump)
        {
            triggerorb = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (yellow && jump)
        {
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            jump   = false;
            yellow = false;

            maxSpeed             = Mathf.Abs(jumpForce) * 1.3f;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.3f);
            trail.emitting       = true;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (pink && jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            jump           = false;
            pink           = false;
            trail.emitting = true;

            maxSpeed             = 17;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .8f);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (red && jump)
        {
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            jump           = false;
            red            = false;
            trail.emitting = true;

            maxSpeed             = Mathf.Abs(jumpForce) * 1.6f;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.6f);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (blue && jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            jump           = false;
            blue           = false;
            trail.emitting = true;

            maxSpeed             = 17;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .4f);

            playGravityParticles();
            reversed = !reversed;
            player_body.gravityScale *= -1;
            grav_scale *= -1;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (green && jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);

            jump  = false;
            green = false;
            playGravityParticles();
            reversed = !reversed;

            if (reversed)
            {
                jumpForce = -posJump;
            }
            else
            {
                jumpForce = posJump;
            }
            trail.emitting = true;

            maxSpeed                  = Mathf.Abs(jumpForce) * 1.3f;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * 1.3f);
            player_body.gravityScale *= -1;
            grav_scale               *= -1;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (black && jump)
        {
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            black          = false;
            jump           = false;
            trail.emitting = true;

            maxSpeed             = 17;
            player_body.velocity = new Vector2(player_body.velocity.x, -jumpForce * 1.2f);

            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (jump)
        {
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            //trail.emitting = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce);

            jump = false;
        }
    }
    /*public void Eyes()
     * {
     *  int rev = 1;
     *  if (reversed) { rev = -1; }
     *  eyes.transform.localPosition = Vector3.Lerp(eyes.transform.localPosition, new Vector3(rev * (moveX / 800), 0 * rev * (player_body.velocity.y / 80), 0), .4f);
     *
     *  if (!grounded)
     *  {
     *      return;
     *  }
     *  else
     *  {
     *      if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 0)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 1)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 2)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 3)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(true);
     *      }
     *  }
     * }*/

    public override void Jump()
    {
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        if (teleorb && jump)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;

            jump    = false;
            teleorb = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;

            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb && jump)
        {
            triggerorb = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (yellow && jump)
        {
            jump   = false;
            yellow = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.1f);
            trail.emitting       = true;

            Spider_Anim.GetComponent <Animator>().ResetTrigger("run");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("curl");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("stop");
            Spider_Anim.GetComponent <Animator>().SetTrigger("jump");
            Spider_Anim.GetComponent <Animator>().Play("jump", -1, 0f);
            Spider_Anim.GetComponent <Animator>().speed = 2;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (pink && jump)
        {
            jump                 = false;
            pink                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce);

            Spider_Anim.GetComponent <Animator>().ResetTrigger("run");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("curl");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("stop");
            Spider_Anim.GetComponent <Animator>().SetTrigger("jump");
            Spider_Anim.GetComponent <Animator>().Play("jump", -1, 0f);
            Spider_Anim.GetComponent <Animator>().speed = 2;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (red && jump)
        {
            jump                 = false;
            red                  = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.4f);

            Spider_Anim.GetComponent <Animator>().ResetTrigger("run");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("curl");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("stop");
            Spider_Anim.GetComponent <Animator>().SetTrigger("jump");
            Spider_Anim.GetComponent <Animator>().Play("jump", -1, 0f);
            Spider_Anim.GetComponent <Animator>().speed = 2;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (blue && jump)
        {
            jump                 = false;
            blue                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .4f);

            playGravityParticles();

            reversed = !reversed;
            player_body.gravityScale *= -1;
            grav_scale *= -1;
            grounded    = false;

            Spider_Anim.GetComponent <Animator>().ResetTrigger("run");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("jump");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("stop");
            Spider_Anim.GetComponent <Animator>().SetTrigger("curl");
            Spider_Anim.GetComponent <Animator>().speed = 2;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (green && jump)
        {
            jump  = false;
            green = false;

            playGravityParticles();
            reversed = !reversed;

            if (reversed)
            {
                jumpForce = -posJump;
            }
            else
            {
                jumpForce = posJump;
            }
            trail.emitting            = true;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * 1.2f);
            player_body.gravityScale *= -1;
            grav_scale *= -1;

            Spider_Anim.GetComponent <Animator>().ResetTrigger("run");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("jump");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("stop");
            Spider_Anim.GetComponent <Animator>().SetTrigger("curl");
            Spider_Anim.GetComponent <Animator>().speed = 2;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (black && jump)
        {
            black = false;
            //jump = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, -jumpForce * 1.6f);

            Spider_Anim.GetComponent <Animator>().ResetTrigger("run");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("jump");
            Spider_Anim.GetComponent <Animator>().ResetTrigger("stop");
            Spider_Anim.GetComponent <Animator>().SetTrigger("curl");
            Spider_Anim.GetComponent <Animator>().speed = 2;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (grounded && jump)
        {
            jump = false; grounded = false;

            int rev = 1, back = 1;
            if (reversed)
            {
                rev = -1;
            }
            if (!facingright)
            {
                back = -1;
            }
            RaycastHit2D groundhit, deathhit;

            if (!reversed)
            {
                //groundhit = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y + .2f), Vector2.up, 120, groundLayer);
                //deathhit = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y + .2f), Vector2.up, 120, deathLayer);
                groundhit = Physics2D.BoxCast(player_body.transform.position + new Vector3(0, .2f, 0), new Vector2(spider_collider.size.x * .5f, .1f), 0f, Vector2.up, 120, groundLayer);
                deathhit  = Physics2D.BoxCast(player_body.transform.position + new Vector3(0, .2f, 0), new Vector2(spider_collider.size.x * .5f, .1f), 0f, Vector2.up, 120, deathLayer);
            }
            else
            {
                //groundhit = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y - .2f), -Vector2.up, 120, groundLayer);
                //deathhit = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y - .2f), -Vector2.up, 120, deathLayer);

                groundhit = Physics2D.BoxCast(player_body.transform.position + new Vector3(0, -.2f, 0), new Vector2(spider_collider.size.x * .5f, .1f), 0f, -Vector2.up, 120, groundLayer);
                deathhit  = Physics2D.BoxCast(player_body.transform.position + new Vector3(0, -.2f, 0), new Vector2(spider_collider.size.x * .5f, .1f), 0f, -Vector2.up, 120, deathLayer);
            }

            //Debug.Log("D: " + deathhit.distance + "G: " + groundhit.distance);

            if (deathhit.collider != null && (deathhit.distance < groundhit.distance || groundhit.distance == 0))
            {
                spider_trail.emitting = true;

                //Debug.Log(deathhit.distance);
                reversed = !reversed;
                player_body.gravityScale *= -1;
                grav_scale        *= -1;
                transform.position = new Vector2(transform.position.x, transform.position.y + rev * (deathhit.distance - (mini ? .1f : .4f)));
            }
            else if (groundhit.collider != null)
            {
                spider_trail.emitting = true;

                //Debug.Log(groundhit.distance);
                reversed = !reversed;
                player_body.gravityScale *= -1;
                grav_scale        *= -1;
                transform.position = new Vector2(transform.position.x, transform.position.y + rev * (groundhit.distance - (mini ? .1f : .4f)));
            }
            else
            {
                spider_trail.emitting = true;
            }

            pulse_trigger_p1.Enter();
            pulse_trigger_p2.Enter();

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            time = 0;
        }
    }
Exemple #5
0
    /*public void Eyes()
     * {
     *  int rev = 1;
     *  if (reversed) { rev = -1; }
     *  eyes.transform.localPosition = Vector3.Lerp(eyes.transform.localPosition, new Vector3(rev * (moveX / 800), 0 * rev * (player_body.velocity.y / 80), 0), .4f);
     *
     *  if (!grounded)
     *  {
     *      return;
     *  }
     *  else
     *  {
     *      if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 0)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 1)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 2)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);
     *      }
     *      else if ((int)Mathf.Abs(transform.rotation.eulerAngles.z / 90) == 3)
     *      {
     *          eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
     *          eyes.transform.Find("Eyes_Irked").gameObject.SetActive(true);
     *      }
     *  }
     * }*/

    public override void Jump()
    {
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        if (teleorb && jump)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;
            jump    = false;
            teleorb = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;
            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb && jump)
        {
            triggerorb = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (yellow && jump)
        {
            jump   = false;
            yellow = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.2f);
            trail.emitting       = true;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            orbJumped = true;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (pink && jump)
        {
            jump                 = false;
            pink                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            orbJumped = true;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (red && jump)
        {
            jump                 = false;
            red                  = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.4f);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            orbJumped = true;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (blue && jump)
        {
            jump                 = false;
            blue                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .4f);
            playGravityParticles();

            reversed = !reversed;
            player_body.gravityScale *= -1;
            grav_scale *= -1;
            grounded    = false;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (green && jump)
        {
            jump  = false;
            green = false;
            playGravityParticles();
            reversed = !reversed;

            if (reversed)
            {
                jumpForce = -posJump;
            }
            else
            {
                jumpForce = posJump;
            }
            trail.emitting            = true;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * 1.2f);
            player_body.gravityScale *= -1;
            grav_scale *= -1;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            orbJumped = true;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (black && jump)
        {
            black                = false;
            jump                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, -jumpForce * 1.2f);

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (grounded && jump)
        {
            jump                      = false;
            blue                      = false;
            trail.emitting            = false;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * .4f);
            reversed                  = !reversed;
            player_body.gravityScale *= -1;
            grav_scale               *= -1;
            grounded                  = false;

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            orbJumped = true;
        }
    }
    public override void Jump()
    {
        //trailUp.emitting = true;
        //trailDown.emitting = true;
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        if (maxSpeed != 15)
        {
            maxSpeed = Mathf.Lerp(maxSpeed, 15, time);
            time    += 1f * Time.deltaTime;

            if (time > 1.0f)
            {
                time = 0.0f;
            }
        }

        if (teleorb_j && jump)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;

            teleorb_j = false;
            teleorb   = false;
            jump      = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;

            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb_j && jump)
        {
            triggerorb_j = false;
            triggerorb   = false;
            jump         = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (yellow_j)
        {
            yellow   = false;
            yellow_j = false;
            jump     = false;
            //yellow_count++;
            //if (yellow_count >= 0) { yellow_j = false; yellow_count = 0; }
            trail.emitting = true;

            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            maxSpeed             = Mathf.Abs(jumpForce) * 1.5f;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.5f);
            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (red_j)
        {
            red   = false;
            red_j = false;
            jump  = false;

            trail.emitting = true;

            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            maxSpeed             = Mathf.Abs(jumpForce) * 1.85f;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.85f);
            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (pink_j)
        {
            pink   = false;
            pink_j = false;
            jump   = false;

            trail.emitting = true;

            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            maxSpeed             = 15f;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1f);
            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (blue_j)
        {
            blue   = false;
            blue_j = false;
            jump   = false;
            //yellow_count++;
            //if (yellow_count >= 0) { green_j = false; yellow_count = 0; }
            trail.emitting = true;

            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            playGravityParticles();

            reversed = !reversed;
            goingUp  = !goingUp;

            maxSpeed             = 15f;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .7f);

            player_body.gravityScale *= -1;
            grav_scale *= -1;
            time        = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (green_j)
        {
            green   = false;
            green_j = false;
            jump    = false;
            //yellow_count++;
            //if (yellow_count >= 0) { green_j = false; yellow_count = 0; }
            trail.emitting = true;

            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            playGravityParticles();

            reversed = !reversed;
            goingUp  = !goingUp;

            if (reversed)
            {
                jumpForce = -posJump;
            }
            else
            {
                jumpForce = posJump;
            }

            maxSpeed = Mathf.Abs(jumpForce) * 1.5f;

            player_body.gravityScale *= -1;
            grav_scale *= -1;

            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.5f);
            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (black_j)
        {
            black   = false;
            black_j = false;
            jump    = false;
            //black_count++;
            //if (black_count >= 5) { black_j = false; black_count = 0; }
            trail.emitting = true;

            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            maxSpeed             = Mathf.Abs(jumpForce) * 2.4f;
            player_body.velocity = new Vector2(player_body.velocity.x, 0f);
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * -2.4f);
            time = 0;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (jump)
        {
            jump           = false;
            goingUp        = !goingUp;
            trail.emitting = false;

            //player_body.velocity = new Vector2(player_body.velocity.x, player_body.velocity.y + 3f);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);
        }

        player_body.AddForce(new Vector2(0, goingUp ? 80f : -80f));
        //int add = goingUp != player_body.velocity.y >= 0 ? (int)(.1f * Mathf.Abs(player_body.velocity.y)) : 0;//prevgoingUp != goingUp ? 20 : 0;
        //player_body.AddForce(new Vector2(0, goingUp ? 80f + add : -80f - add));
    }
Exemple #7
0
    public override void Jump()
    {
        OrbComponent orbscript = new OrbComponent();

        if (OrbTouched != null)
        {
            orbscript = OrbTouched.GetComponent <OrbComponent>();
        }

        if (teleorb && jump)
        {
            Vector3 positionDelta = (transform.position + teleOrb_translate) - transform.position;
            jump    = false;
            teleorb = false;

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }

            player_body.transform.position += teleOrb_translate;

            CinemachineVirtualCamera activeCamera = gamemanager.getActiveCamera();
            activeCamera.GetCinemachineComponent <CinemachineFramingTransposer>().OnTargetObjectWarped(activeCamera.Follow, positionDelta);
        }

        if (triggerorb && jump)
        {
            triggerorb = false;
            SpawnTrigger spawn = OrbTouched.GetComponent <SpawnTrigger>();
            StartCoroutine(spawn.Begin());

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }

        if (yellow && jump)
        {
            launched = true;
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            fromGround           = false;
            released             = false;
            jump                 = false;
            yellow               = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.1f);
            trail.emitting       = true;
            //StartCoroutine(RotateArc(Vector3.forward, negate * -30.0f, 0.5f));

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (pink && jump)
        {
            launched = true;
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            fromGround           = false;
            released             = false;
            jump                 = false;
            pink                 = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * .95f);
            //StartCoroutine(RotateArc(Vector3.forward, negate * -25.0f, 0.5f));

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (red && jump)
        {
            launched = true;
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            fromGround           = false;
            released             = false;
            jump                 = false;
            red                  = false;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce * 1.45f);

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (blue && jump)
        {
            launched = false;
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(true);

            playGravityParticles();

            fromGround                = false;
            released                  = false;
            jump                      = false;
            blue                      = false;
            trail.emitting            = true;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce * .4f);
            reversed                  = !reversed;
            player_body.gravityScale *= -1;
            grav_scale               *= -1;
            grounded                  = false;
            //StartCoroutine(RotateAround(Vector3.forward, regate * negate * -180.0f, 0.4f));

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (green && jump)
        {
            launched = false;
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(true);

            playGravityParticles();

            fromGround = false;
            released   = false;
            jump       = false;
            green      = false;
            reversed   = !reversed;

            if (reversed)
            {
                jumpForce = -posJump;
            }
            else
            {
                jumpForce = posJump;
            }
            trail.emitting            = true;
            player_body.velocity      = new Vector2(player_body.velocity.x, jumpForce);
            player_body.gravityScale *= -1;
            grav_scale *= -1;

            //StartCoroutine(RotateAround(Vector3.forward, regate * negate * 180.0f, 0.5f));

            if (grav)
            {
                grav = false;
            }
            if (gravN)
            {
                gravN = false;
            }

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if (black && jump)
        {
            launched = false;
            eyes.transform.Find("Eyes_Normal").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Irked").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Squint").gameObject.SetActive(false);
            eyes.transform.Find("Eyes_Wide").gameObject.SetActive(true);

            fromGround           = false;
            black                = false;
            released             = false;
            jump                 = true;
            downjump             = true;
            trail.emitting       = true;
            player_body.velocity = new Vector2(player_body.velocity.x, -jumpForce * 1.1f);

            if (OrbTouched != null)
            {
                orbscript.Pulse();
            }
        }
        else if ((grounded || time < .07f) && jump && downjump)
        {
            launched = false;
            time     = 1;
            Cube_Anim.ResetTrigger("Default");
            Cube_Anim.ResetTrigger("Squash");
            Cube_Anim.SetTrigger("Stretch");
            trail.emitting       = false;
            player_body.velocity = new Vector2(player_body.velocity.x, jumpForce);
            grounded             = false;

            /* f**k me
             * if (Mathf.Abs(moveX) > 0)
             * {
             *  checkGrounded = false;
             *  StartCoroutine(RotateArc(Vector3.forward, negate * -10.0f, 0.2f));
             *  checkGrounded = true;
             * }//*/

            fromGround = true;
            jump       = false;
            downjump   = false;
        }
        else if (fromGround && ((!reversed && released && player_body.velocity.y > 0) || (reversed && released && player_body.velocity.y < 0)))
        {
            Cube_Anim.ResetTrigger("Crouch");
            Cube_Anim.ResetTrigger("Squash");
            Cube_Anim.ResetTrigger("Stretch");
            Cube_Anim.SetTrigger("Default");
            player_body.velocity /= 2;
            released              = false;
            fromGround            = false;
        }
    }