private void CheckInput() { BullActionState state = GetComponent <BullActionStateManager>().CurrentState; var BullData = GetComponent <BullData>(); if (InputActive() && CompareTag("Player")) { 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 == BullActionState.Normal) { StartCharging(Direction); } Chase(Direction); } } if (!InputActive()) { if (state == BullActionState.Charging) { StopCharging(); } } }
public void SetActionState(BullActionState State) { CurrentState = State; if (CompareTag("Player")) { switch (CurrentState) { case BullActionState.Normal: GetComponent <CharacterMove>().enabled = true; break; case BullActionState.Charging: GetComponent <CharacterMove>().enabled = false; break; } } }