Beispiel #1
0
 void Extend()   /* The hook object is traveling through the world. */
 {
     if (!player.isGrounded())
     {
         StartCoroutine(frogAnim.PlayHooked());
         playingHookAnim = true;
     }
 }
Beispiel #2
0
 void Update()
 {
     horizontal = player.returnHorizontal();
     if (Time.time > 0.01f && !anim.GetBool("WallJump"))
     {
         anim.SetBool("Grounded", player.isGrounded());
         anim.SetBool("Moving", player.RelativeVelocity().magnitude > 0.01f);
         anim.SetFloat("Horizontal", horizontal);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if ((hookshotControl.State != HookshotControl.HookshotState.HOOKED && movement.isGrounded()) ||
         hookshotControl.State == HookshotControl.HookshotState.RETRACTING)
     {
         transform.localPosition = positionWhenMoving;
     }
     else
     {
         transform.localPosition = positionWhenHooked;
     }
 }
    IEnumerator UpdateSensors()
    {
        while (true)
        {
            sprite = GetComponent <SpriteRenderer>().sprite;
            Vector3 center  = sprite.bounds.center;
            Vector3 extents = sprite.bounds.extents;
            Sensors[1].offset = center + new Vector3(0, extents.y - 0.15f);
            Sensors[2].offset = center + new Vector3(extents.x - 0.15f, 0);
            Sensors[3].offset = center + new Vector3(-extents.x + 0.15f, 0);

            if (!player.isGrounded())
            {
                Sensors[0].offset = new Vector2(0, -extents.y + 0.15f);
            }
            yield return(new WaitForSeconds(SENSOR_UPDATE_DELTA));
        }
    }