예제 #1
0
    void FixedUpdate()
    {
        if (idleing)
        {
            Collider2D player = Physics2D.OverlapCircle(searchHitBox.position, searchHitBox.GetComponent <CircleCollider2D>().radius, playerLayer);

            if (player && true)
            {
                movement.Retarget(player.gameObject.transform);
                idleing = false;
                GetComponent <Animator>().SetBool("WakeUpYaLazyBum", true);
            }
        }
    }
예제 #2
0
    void FixedUpdate()
    {
        if (eatTimer > 0.0f)
        {
            Collider2D player = Physics2D.OverlapCircle(eatingHitbox.position, eatingHitbox.GetComponent <CircleCollider2D>().radius, playerLayer);

            if (player != null)
            {
                capturedPlayer = player.gameObject;
                capturedPlayer.GetComponent <Rigidbody2D>().isKinematic = true;
                capturedPlayer.GetComponent <PlayerInput>().stopMoving();
                DisablePlayerColliders();
                capturedPlayer.transform.SetParent(bodyHitbox, false);
                capturedPlayer.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
                capturedPlayer.GetComponent <SpriteRenderer>().enabled = false;
                movement.Retarget(superJumpLocationNode);
                movement.StartMoving();
                eatTimer = 0.0f;
            }
            else
            {
                eatTimer -= Time.deltaTime;

                if (eatTimer < 0.0f)
                {
                    eatTimer = 0.0f;

                    if (capturedPlayer == null)
                    {
                        movement.StartMoving();
                    }
                }
            }
        }

        if (!spitting && capturedPlayer != null)
        {
            capturedPlayer.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);

            if (!superJumpInitiated)
            {
                if (movement.IsGrounded() && GetComponent <Rigidbody2D>().velocity.y == 0.0f && Vector2.Distance(transform.position, superJumpLocationNode.position) <= nodeRange)
                {
                    movement.UnTarget();
                    movement.SuperJump();
                    superJumpInitiated = true;
                }
            }
            else if (superJumpInitiated && !movement.IsSuperJumping() && GetComponent <Rigidbody2D>().velocity.y <= 0.0f)
            {
                Spit();
            }
        }
        else if (spitting && !GetComponent <Rigidbody2D>().IsTouching(capturedPlayer.GetComponent <Collider2D>()))
        {
            bodyHitbox.gameObject.GetComponent <Collider2D>().enabled = true;
            capturedPlayer = null;
            spitting       = false;
            GetComponent <TerminationSequence>().InitiateTerminationSequence();
        }
    }