void Awake() { aiSight = GetComponent <AISightAndHearing>(); nav = GetComponent <UnityEngine.AI.NavMeshAgent>(); mov = GetComponent <Movement_Handler>(); deadZone *= Mathf.Deg2Rad; }
void Start() { movHdlr = GetComponent <Movement_Handler> (); // Make the rigid body not change rotation if (GetComponent <Rigidbody>()) { GetComponent <Rigidbody>().freezeRotation = true; } }
//--- Start --- void Start() { currentScene = SceneManager.GetActiveScene(); //gets the current scene _timer = 0.0f; //resets the timer pcs = FindObjectOfType <HideHandler>(); mcs = FindObjectOfType <Movement_Handler>(); rcs = FindObjectOfType <Rotation_Handler>(); }
void Awake() { movHdlr = GetComponent <Movement_Handler> (); aiPerception = GetComponent <AISightAndHearing> (); nav = GetComponent <UnityEngine.AI.NavMeshAgent> (); wep = GetComponent <Weapon_Handler> (); currWep = wep.GetCurrWeapon(); fireAtWill = true; holdPosition = true; follow = false; currWep = wep.GetCurrWeapon(); }
void Awake() { cam = GetComponent <Camera>(); wh = GetComponentInParent <Weapon_Handler> (); movHdlr = transform.root.GetComponent <Movement_Handler> (); Distance = DefaultDistance; Vector3 angles = transform.eulerAngles; x = angles.x; y = angles.y; if (GetComponent <Rigidbody>() != null) { GetComponent <Rigidbody>().freezeRotation = true; } }
void Start() { mov = GetComponent <Movement_Handler> (); ik = FindInChildren(transform, "Left Limb IK").GetComponent <ArmIK>(); weaponsObjects = new Weapon[weaponsInInventory.Length]; for (int i = 0; i < weaponsInInventory.Length; i++) { weaponsObjects[i] = weaponsInInventory[i].GetComponent <Weapon>(); } currWeaponIndex = 0; currWeapon = weaponsObjects[currWeaponIndex]; anim = new Animation_Handler(gameObject.GetComponent <Animator> ()); WeaponTransition(0); }
void OnTriggerStay(Collider other) { if (other.tag == opponent | (other.tag == "Spy" & opponentSpy)) { // Create a vector from the enemy to the player and store the angle between it and forward. Vector3 direction = other.transform.position - transform.position; float angle = Vector3.Angle(direction, transform.forward); // If the angle between forward and where the player is, is less than half the angle of view... if (angle < fieldOfViewAngle * 0.5f) { RaycastHit hit; // ... and if a raycast towards the player hits something... if (Physics.Raycast(transform.position + transform.up, direction.normalized, out hit, col.radius)) { // ... and if the raycast hits the player... if (!Target & (hit.collider.tag == opponent | (hit.collider.tag == "Spy" & opponentSpy)) & !globs.DeadSoldiers.Contains(other.transform)) { if (hit.collider.tag == "Spy") { spy = other.GetComponent <Spy>(); if (spy) { spy.canBeSeen = true; } } if (hit.collider.tag != "Spy" || spy.coverBlown) { Target = other.transform; trgtMvHdlr = other.GetComponent <Movement_Handler>(); opponentInSight = true; } } } else if (other.transform == Target) { EmptyTarget(); } } else if (other.transform == Target) { EmptyTarget(); } } }
// Use this for initialization void Awake() { cmdHdlr = GameObject.Find("System").GetComponent <CommandHandler>(); mov = GetComponent <Movement_Handler> (); wep = GetComponent <Weapon_Handler> (); }
private void EmptyTarget() { Target = null; trgtMvHdlr = null; opponentInSight = false; }