private int wayPointIndex; // A counter for the way point array. #endregion Fields #region Methods void Awake() { // Setting up the references. enemySight = GetComponent<DoneEnemySight>(); nav = GetComponent<NavMeshAgent>(); // player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; // playerHealth = player.GetComponent<DonePlayerHealth>(); // lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneLastPlayerSighting>(); }
private int wayPointIndex; // A counter for the way point array. void Awake() { // Setting up the references. enemySight = GetComponent <DoneEnemySight>(); nav = GetComponent <NavMeshAgent>(); player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; playerHealth = player.GetComponent <DonePlayerHealth>(); lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneLastPlayerSighting>(); }
private int wayPointIndex; // A counter for the way point array. #endregion Fields #region Methods void Awake() { // Setting up the references. enemySight = GetComponent<DoneEnemySight>(); nav = GetComponent<NavMeshAgent>(); player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; playerHealth = player.GetComponent<DonePlayerHealth>(); lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneLastPlayerSighting>(); // initializing the current_behavior variable current_behavior = "Initializing"; }
private Transform player; // Reference to the player's transform. #endregion Fields #region Methods // private DoneHashIDs hash; // Reference to the HashIDs script. // private DoneAnimatorSetup animSetup; // An instance of the AnimatorSetup helper class. void Awake() { // Setting up the references. // player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; enemySight = GetComponent<DoneEnemySight>(); nav = GetComponent<NavMeshAgent>(); anim = GetComponent<Animator>(); // hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>(); // Making sure the rotation is controlled by Mecanim. nav.updateRotation = false; // Creating an instance of the AnimatorSetup class and calling it's constructor. // animSetup = new DoneAnimatorSetup(anim, hash); // Set the weights for the shooting and gun layers to 1. anim.SetLayerWeight(1, 1f); anim.SetLayerWeight(2, 1f); // We need to convert the angle for the deadzone from degrees to radians. deadZone *= Mathf.Deg2Rad; }
void Awake() { // Setting up the references. enemySight = GetComponent <DoneEnemySight>(); nav = GetComponent <NavMeshAgent>(); player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; playerHealth = player.GetComponent <Health>(); lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneLastPlayerSighting>(); if (bloodPrefab) { // if (damageEffectTransform == gameObject.transform) damageEffectTransform = transform; GameObject effect = Spawner.Spawn(bloodPrefab, Vector3.zero, Quaternion.identity); effect.transform.parent = damageEffectTransform; effect.transform.localPosition = Vector3.zero; damageEffect = effect.GetComponent <ParticleEmitter>(); Vector2 tempSize = new Vector2(GetComponent <Collider>().bounds.extents.x, GetComponent <Collider>().bounds.extents.z); colliderRadiusHeuristic = tempSize.magnitude * 0.5f; damageEffectCenterYOffset = GetComponent <Collider>().bounds.extents.y; } }
private DoneAnimatorSetup animSetup; // An instance of the AnimatorSetup helper class. void Awake() { // Setting up the references. player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; enemySight = GetComponent <DoneEnemySight>(); nav = GetComponent <NavMeshAgent>(); anim = GetComponent <Animator>(); hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneHashIDs>(); // Making sure the rotation is controlled by Mecanim. nav.updateRotation = false; // Creating an instance of the AnimatorSetup class and calling it's constructor. animSetup = new DoneAnimatorSetup(anim, hash); // Set the weights for the shooting and gun layers to 1. anim.SetLayerWeight(1, 1f); anim.SetLayerWeight(2, 1f); // We need to convert the angle for the deadzone from degrees to radians. deadZone *= Mathf.Deg2Rad; }
void Awake() { // Setting up the references. enemySight = GetComponent<DoneEnemySight>(); nav = GetComponent<NavMeshAgent>(); player = GameObject.FindGameObjectWithTag(DoneTags.player).transform; playerHealth = player.GetComponent<Health>(); lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneLastPlayerSighting>(); if (bloodPrefab) { // if (damageEffectTransform == gameObject.transform) damageEffectTransform = transform; GameObject effect = Spawner.Spawn(bloodPrefab, Vector3.zero, Quaternion.identity); effect.transform.parent = damageEffectTransform; effect.transform.localPosition = Vector3.zero; damageEffect = effect.GetComponent<ParticleEmitter>(); Vector2 tempSize = new Vector2(GetComponent<Collider>().bounds.extents.x, GetComponent<Collider>().bounds.extents.z); colliderRadiusHeuristic = tempSize.magnitude * 0.5f; damageEffectCenterYOffset = GetComponent<Collider>().bounds.extents.y; } }
void Awake() { counter = 0; incorrect_counter = 0; filename = "collision_eval.txt"; time_stat_file = "time_stats.txt"; write_once = false; self = this.transform; self_ai = this.GetComponent<DoneEnemyAI>(); self_sight = this.GetComponent<DoneEnemySight>(); player = GameObject.FindGameObjectWithTag(DoneTags.player); player_health = player.GetComponent<DonePlayerHealth>(); animator_hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>(); GameObject[] enemies = GameObject.FindGameObjectsWithTag(DoneTags.enemy); for( int i = 0; i < enemies.Length; i++) { if ( self.transform == enemies[i].transform) { enemy_num = i + 1; } } }