// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { GuardBehaviour g = animator.gameObject.GetComponent <GuardBehaviour>(); navMeshAgent.SetDestination(targetPrisioner.GetComponent <Transform>().position); Quaternion endRotation = Quaternion.LookRotation(navMeshAgent.velocity.normalized); animator.gameObject.transform.rotation = Quaternion.Lerp(animator.gameObject.transform.rotation, endRotation, 0.2f); }
void FriendlyDown(GuardBehaviour downedGuard) { if (state != GuardState.Stunned && state != GuardState.Distracted) { state = GuardState.Search; lastPlayerSighting = downedGuard.transform.position; RaiseAlarm(); } }
void Start() { laserL = new LineRenderer(); laserR = new LineRenderer(); EyeL = transform.Find("EyeL"); EyeR = transform.Find("EyeR"); guardBehaviour = transform.root.GetComponent <GuardBehaviour>(); }
void Start() { laserL = new LineRenderer(); laserR = new LineRenderer(); EyeL = transform.Find("EyeL"); EyeR = transform.Find("EyeR"); guardBehaviour = transform.root.GetComponent<GuardBehaviour>(); }
void Start() { sensing = GetComponent<GuardSensing> (); behaviour = GetComponent<GuardBehaviour> (); alerted = false; alertSystem = GameObject.Find ("Alert System").GetComponent<AlertManager>(); pHealth = GameObject.Find ("Health Manager").GetComponent<HealthManager> (); // Set default state: patrol or sentry (stationary) if (patrolling) { behaviour.guardState = GuardBehaviour.GuardState.Patrol; } else { behaviour.guardState = GuardBehaviour.GuardState.Sentry; } }
public SearchingState(GuardBehaviour owner, Vector3 _lastSeenPosition) : base(owner) { lastSeenPosition = _lastSeenPosition; }
public ChasingState(GuardBehaviour owner) : base(owner) { }
public State(GuardBehaviour _owner) { owner = _owner; }
void Start() { player = GameObject.FindWithTag ("Player"); playerController = player.GetComponent<PlayerController>(); guardAI = GetComponent<GuardAI> (); gBehaviour = GetComponent<GuardBehaviour> (); tScaler = GameObject.Find ("Time Manager").GetComponent<TimeScaler> (); if (tScaler.GetNoiseDampening ()) { hearingRange = 2.5f; } }
public LookingAroundState(GuardBehaviour owner) : base(owner) { }
public PatrolState(GuardBehaviour owner) : base(owner) { }