Beispiel #1
0
 private void FixedUpdate()
 {
     controller.Move(velocity * Time.deltaTime);
     if (controller.collisions.above || controller.collisions.below)
     {
         if (anim.GetBool("Falling"))
         {
             if (velocity.y <= -4f)
             {
                 anim.SetTrigger("Land");
             }
             else
             {
                 if (velocity.y < -1f)
                 {
                     deformer.startDeform(new Vector3(1.2f, 0.75f, 1.0f), 0.1f, 0.1f);
                 }
                 anim.SetTrigger("Idle");
             }
         }
         if (velocity.y < 0)
         {
             velocity.x = 0;
         }
         velocity.y = 0;
     }
     if ((controller.collisions.right && velocity.x > 0) || (controller.collisions.left && velocity.x < 0))
     {
         velocity.x = 0;
         if (velocity.y > 0)
         {
             velocity.y = 0;
         }
     }
 }
    private void FixedUpdate()
    {
        if (!dropThroughPlatforms && AtlasInputManager.getKey("Jump") && isCrouching())
        {
            dropThroughPlatforms = true;
            controller.collisions.Reset();
            Vector3 downVec = Vector3.down;
            controller.VerticalCollisions(ref downVec);
            controller.checkGrounded(downVec.y);
        }
        anim.SetBool("isGrounded", isGrounded());
        if (isGrounded())
        {
            coyoteTime = maxCoyoteTime;
        }
        else if (coyoteTime > 0)
        {
            coyoteTime--;
        }

        if (state == State.Reset || state == State.Wait || state == State.Menu)
        {
            return;
        }
        controller.Move(velocity * Time.deltaTime);
        controller.checkWallSlide(facing);
        isWallSliding();
        if (controller.collisions.above || controller.collisions.below)
        {
            velocity.y = 0;
        }
    }
Beispiel #3
0
 void FixedUpdate()
 {
     //using function to move player if dialog ui is off
     if (!isDialogueOn)
     {
         controller.Move(hori * Time.fixedDeltaTime, jump);
         jump = false;
     }
     else
     {
         animator.enabled = false;
     }
 }
    // Update is called once per frame
    void FixedUpdate()
    {
        //Movement and turning
        //if (hc.inHitStun) return;
        if (cc.collisions.right && velocity.x > 0 ||
            cc.collisions.left && velocity.x < 0)
        {
            velocity *= -1;
        }

        cc.Move(velocity * moveSpeed * Time.deltaTime);

        timer += Time.fixedDeltaTime;
        if (timer > dropTimer)
        {
            timer = 0;
            gameManager.createInstance("LevelPrefabs/Enemies/Projectiles/flowerBomberSeed", transform.position);
        }
    }
Beispiel #5
0
 private void FixedUpdate()
 {
     controller.Move(velocity);
 }