// Use this for initialization void Start() { controller = enemy.GetComponent<UnityStandardAssets.Characters.ThirdPerson.AICharacterControl> (); enemy.GetComponent<GrabbedGuy> ().gameMaster = gameMaster; if (!enabled) return; }
public void Shoot() { AICharacterControl[] targets = GameObject.FindObjectsOfType <AICharacterControl>(); AICharacterControl target = null; foreach (AICharacterControl t in targets) { if (!t.GetComponent <AICharacterControl>().dead) { target = t; } } if (target == null) { return; } if (Vector3.Distance(this.transform.position, target.transform.position) < range) { int random = Random.Range(0, 9); if (random < 4) { Debug.Log("Ally killed an Enemy"); target.OnBeingShot(); } } }
void Awake() { if (hitpoints == 0) { hitpoints = 1; } charScript = gameObject.GetComponent <AICharacterControl>(); charScript.target = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>(); audioManager = GameObject.FindObjectOfType <AudioManager> (); }
// Use this for initialization void Start() { //NavMeshAgent navMeshAgent = gameObject.GetComponent<NavMeshAgent>(); activeWaypoint = 0; control = gameObject.GetComponent <AICharacterControl>(); control.target = waypoints[activeWaypoint].transform; count = waypoints.Length; if (player == null) { player = GameObject.FindGameObjectWithTag("Player").transform; } }
// Use this for initialization void Start() { monkayAttachedToBack = false; settings = GetComponent <PlayerControlSettings>(); currSChCSA = switchCharactersCameraSpeedAcceleration; currSChLAtA = switchCharactersLookAtAcceleration; monkayAI = monkay.character.GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); switchingChars = false; currentChar = orphan; SwitchCharacters(); SwitchCharacters(); ChangeState(monkay, MonkayState.following); }
public void Spawn(bool isPC) { this.isAI = !isPC; NavMeshAgent naver = GetComponent <NavMeshAgent>(); AICharacterControl aier = GetComponent <AICharacterControl>(); if (isAI) { naver.enabled = true; aier.enabled = true; this.enabled = false; } else { naver.enabled = false; aier.enabled = false; this.enabled = true; } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { AICharacterControl characterController = GameObject.Find("Ethan").GetComponent <AICharacterControl>(); // Do this when the last action begins if (characterController.actionQueue.Count == 0) { characterController.nextAction = null; animator.SetBool("actionToWalk", false); } if (characterController.nextAction.name == "Put down left") { characterController.willPutDownLeftObject = true; } if (characterController.nextAction.name == "Put down right") { characterController.willPutDownRightObject = true; } }
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { AICharacterControl characterController = GameObject.Find("Ethan").GetComponent <AICharacterControl>(); characterController.actionStarted = false; animator.SetInteger("nextAction", 0); // If the character is about to put down the object, detach it from the hand if (characterController.willPutDownLeftObject) { characterController.leftObject.transform.parent = null; characterController.leftObject.transform.position = characterController.allObjects[characterController.leftObject.name].position; characterController.leftObject.transform.rotation = Quaternion.Euler(characterController.allObjects[characterController.leftObject.name].rotation); characterController.leftObject = null; characterController.willPutDownLeftObject = false; } if (characterController.willPutDownRightObject) { characterController.rightObject.transform.parent = null; characterController.rightObject.transform.position = characterController.allObjects[characterController.rightObject.name].position; characterController.rightObject.transform.rotation = Quaternion.Euler(characterController.allObjects[characterController.rightObject.name].rotation); characterController.rightObject = null; characterController.willPutDownRightObject = false; } // Set the location of the next action as the character's destination if (characterController.actionQueue.Count > 0) { characterController.nextAction = characterController.actionQueue.Dequeue(); characterController.navAgent.destination = characterController.nextAction.location; characterController.navAgent.Resume(); Debug.Log("next action = " + characterController.nextAction.name); } }
// Use this for initialization void Start() { targetManager = GameObject.FindObjectOfType <TargetManager>().GetComponent <TargetManager>(); aicc = GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); allyShoot = GetComponent <AllyShoot>(); }
// Use this for initialization void Start() { aicc = GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); }
private void Start() { ThisUnit = SO1.GameMaster.AI.NewAI(AI.Elements.Fire); PBS = gameObject.GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); }
void Start() { ai = NPC.GetComponent<AICharacterControl>(); mouseTarget = new GameObject(); }
public void AddToList(AICharacterControl ai) { ListAI.Add(ai); }
// Use this for initialization void Start() { this.tag = "Enemy"; anim = GetComponent <Animator>(); ai = GetComponentInParent <AICharacterControl>(); }
// Use this for initialization void Start() { characterController = GameObject.Find("Ethan").GetComponent <AICharacterControl>(); light = GameObject.Find("Light").GetComponent <Light>(); }
// Start is called before the first frame update void Start() { active = false; selfLargeAI = GetComponent <AICharacterControl>(); TargetCube(); }
// Use this for initialization void Start() { aiCharacterControl = GetComponent <AICharacterControl> (); zombieAnimator = GetComponent <Animator> (); zombieAnimator.avatar = avatarWalk; }
void SetupAI(bool on) { GetComponent<NavMeshAgent>().enabled = on; if(_AIController == null) { if(GetComponent<UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>() == null) gameObject.AddComponent<UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); _AIController = GetComponent<UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); } _AIController.enabled = on; // if(GameManager.CurrentSceneName == WorkSceneName){ // SetDestination(Wdefault); // } else { // // if(GameManager.CurrentSceneName == HomeSceneName){ // SetDestination(Wdefault); // } else { SetRandomDestination(); // } // } }
// Use this for initialization void Start() { AIPlayerTargetScript = GetComponent <UnityStandardAssets.Characters.ThirdPerson.AICharacterControl>(); }