コード例 #1
0
 /*
  * Set up script dependencies
  */
 void Awake()
 {
     _pathFinder   = gameObject.GetComponentInParent <Pathfinding>();
     _patrolBehav  = gameObject.GetComponentInParent <Patrol>();
     _player       = GameObject.FindGameObjectWithTag(PlayerTag);
     _soundHandler = GetComponentInParent <GuardSoundHandler>();
     _detection    = GetComponent <DetectionCommon>();
 }
コード例 #2
0
 protected void AssignComponents()
 {
     _pathFinding    = GetComponentInParent <Pathfinding>();
     _patrolBehav    = GetComponentInParent <Patrol>();
     _soundHandler   = GetComponentInParent <GuardSoundHandler>();
     _spriteHandler  = GetComponentInParent <Spritehandler>();
     _playerDetector = GetComponent <PlayerDetection>();
     _visionCone     = GetComponent <LineRenderer>();
     _detection      = GetComponent <DetectionCommon>();
 }
コード例 #3
0
 /*
  * In all of the guards in the scene with a rat, or had 1
  * the guard which can collect the rat should be the one without the rat in its 'group' object
  * Case could be that this may be several guards (stole > 1 rat), in which case the first found will collect
  */
 void Start()
 {
     _guardsWithRat = GameObject.FindGameObjectsWithTag("RatGuard");
     _detection     = GetComponent <DetectionCommon>();
 }