コード例 #1
0
ファイル: Hunt.cs プロジェクト: ricardj/unity_mechanics
    // 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);
    }
コード例 #2
0
 void FriendlyDown(GuardBehaviour downedGuard)
 {
     if (state != GuardState.Stunned && state != GuardState.Distracted)
     {
         state = GuardState.Search;
         lastPlayerSighting = downedGuard.transform.position;
         RaiseAlarm();
     }
 }
コード例 #3
0
    void Start()
    {
        laserL = new LineRenderer();
        laserR = new LineRenderer();

        EyeL = transform.Find("EyeL");
        EyeR = transform.Find("EyeR");

        guardBehaviour = transform.root.GetComponent <GuardBehaviour>();
    }
コード例 #4
0
ファイル: LaserEyes.cs プロジェクト: kiichi7/MecanimAndAI
    void Start()
    {
        laserL = new LineRenderer();
        laserR = new LineRenderer();

        EyeL = transform.Find("EyeL");
        EyeR = transform.Find("EyeR");

        guardBehaviour = transform.root.GetComponent<GuardBehaviour>();
    }
コード例 #5
0
ファイル: GuardAI.cs プロジェクト: redahanb/Spectral
    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;
        }
    }
コード例 #6
0
 public SearchingState(GuardBehaviour owner, Vector3 _lastSeenPosition) : base(owner)
 {
     lastSeenPosition = _lastSeenPosition;
 }
コード例 #7
0
 public ChasingState(GuardBehaviour owner) : base(owner)
 {
 }
コード例 #8
0
ファイル: State.cs プロジェクト: Matzkee/FinalYearProject
 public State(GuardBehaviour _owner)
 {
     owner = _owner;
 }
コード例 #9
0
ファイル: GuardSensing.cs プロジェクト: redahanb/Spectral
 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;
     }
 }
コード例 #10
0
 public LookingAroundState(GuardBehaviour owner) : base(owner)
 {
 }
コード例 #11
0
 public PatrolState(GuardBehaviour owner) : base(owner)
 {
 }