Exemplo n.º 1
0
 void ChaseTarget()
 {
     if (GrubTarget != null)
     {
         moveComponent.RotateTowards(GrubTarget.position);
     }
     else
     {
         moveComponent.RotateTowards(PlayerTarget.position);
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        if (!IsGrounded())
        {
            return;
        }

        movementComponent.RotateTowards(player.transform.position);
        movementComponent.SetTraverse(transform.forward);
    }
Exemplo n.º 3
0
    private void HandleRotate()
    {
        // Arbitrary plane instead of actual field GameObject because intersections
        // have to be valid -inf < x,z < inf.
        Ray screenToPointRay = GameCamera.Get().GetScreenToPointRay(Input.mousePosition);

        if (!groundPlane.Raycast(screenToPointRay, out float intersectAt))
        {
            return;
        }

        Vector3 positionOnPlane = screenToPointRay.GetPoint(intersectAt);

        movementComponent.RotateTowards(positionOnPlane);
    }
Exemplo n.º 4
0
    protected void RunAway(bool special = false)
    {
        if (gameObject.activeSelf == true)
        {
            if (special)
            {
                baseSprite.color = ColorList.colors[(int)ColorNames.Yellow];
                gameObject.layer = 16; // Special Escape.
            }
            else
            {
                polyCollider.enabled = false;
            }

            animating = true;
            StopCoroutine(movementRoutine);
            Vector3 direction = transform.position - Vector3.zero;
            moveComponent.RotateTowards(-direction);
            moveComponent.MoveSpeed += 3;
        }
    }