private bool Look(ENNEMY_BODY body) { RaycastHit hit; if (Physics.SphereCast(body.transform.position, 25f, body.transform.forward, out hit, body.lookRange)) //// CHANGEMENT D'ETAT DU FSM PARENT / { if (hit.collider.CompareTag("demon")) { Debug.Log("ATTACK this ENNEMY " + hit.transform.gameObject.tag); // body.target.position = hit.point; body.target = hit.transform; return(true); } } else { Debug.Log(" PATROLLING"); } return(false); }
private void DoActions(ENNEMY_BODY body) { for (int i = 0; i < actions.Length; i++) { actions[i].Act(body); } }
public override void Act(ENNEMY_BODY body) { Debug.Log("RUN TEST HUNTING"); body.firing.Launch(body.transform, body.transform.rotation); }
private void CheckTransitions(ENNEMY_BODY body) { for (int i = 0; i < transitions.Length; i++) { bool decisionSucceeded = transitions[i].decision.Decide(body); if (decisionSucceeded) { body.TransitionToState(transitions[i].trueState); } else { body.TransitionToState(transitions[i].falseState); } } }
public void UpdateState(ENNEMY_BODY body) { DoActions(body); CheckTransitions(body); }
// Use this for initialization void Awake() { body = GetComponent <ENNEMY_BODY>(); }
public override void Act(ENNEMY_BODY body) { body.target = body.GOtarget.transform; Debug.Log("RUN TEST PATROL"); }
public override bool Decide(ENNEMY_BODY body) { bool chaseTargetIsActive = body.target.gameObject.activeSelf; return(chaseTargetIsActive); }
public override bool Decide(ENNEMY_BODY body) { bool targetVisible = Look(body); return(targetVisible); }
public abstract void Act(ENNEMY_BODY body);
public abstract bool Decide(ENNEMY_BODY body);
public override void Act(ENNEMY_BODY body) { Debug.Log("RUN TEST PATROL"); }