private void CheckInput()
    {
        FlowerActionState state = GetComponent <FlowerActionStateManager>().CurrentState;
        var FlowerData          = GetComponent <FlowerData>();

        if (CompareTag("Player"))
        {
            if (InputActive())
            {
                Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                {
                    Vector3 Direction = hit.point - hit.point.y * Vector3.up - (transform.position - transform.position.y * Vector3.up);
                    Direction.Normalize();

                    if (state == FlowerActionState.Normal)
                    {
                        ActivateField(Direction);
                    }

                    Follow(Direction);
                }
            }
            else
            {
                if (state == FlowerActionState.Blowing)
                {
                    DeactivateField();
                }
            }
        }
    }
Beispiel #2
0
    public void SetActionState(FlowerActionState State)
    {
        CurrentState = State;
        if (CompareTag("Player"))
        {
            switch (CurrentState)
            {
            case FlowerActionState.Normal:
                GetComponent <CharacterMove>().enabled = true;
                break;

            case FlowerActionState.Blowing:
                GetComponent <CharacterMove>().enabled = false;
                break;
            }
        }
    }