private void OnEnable() { m_attackAI = GetComponent(typeof(AttackAI)) as AttackAI; m_npcTracker = transform.parent.parent.parent.parent.GetComponent(typeof(NPCTracker)) as NPCTracker; m_objectTrasform = transform.parent.parent; startingClosestObject = FindObjectOfType <ClosestObjectInitTagScript>().transform; }
void Start() { attackAI = gameObject.GetComponent<AttackAI>(); movementAI = gameObject.GetComponent<MovementAI>(); breakable = gameObject.GetComponentInChildren<BreakableManager>(); if (entityType == EntityType.Enemy) { AutoAlign(); } }
void Start() { attackAI = gameObject.GetComponent <AttackAI>(); movementAI = gameObject.GetComponent <MovementAI>(); breakable = gameObject.GetComponentInChildren <BreakableManager>(); if (entityType == EntityType.Enemy) { AutoAlign(); } }
public AttackRequest(float priority, AttackAI ai, GameObject targetObject) : base(priority) { attackAI = ai; objectToAttack = targetObject; // check if we are in range float attackRange = MovingObjectStats.GetAttackRangeForObject(ai.gameObject); MoveAI moveAI = ai.GetComponent <MoveAI> (); fgoRequest = new FollowGameObjectRequest(0.5f, moveAI, attackRange); fgoRequest.targetObject = objectToAttack; }
private FleeAI fleeAI; //a variable used to check if the AI is in fleeing state #endregion private void Start() { //set all the variables to thier respective component values moveAI = GetComponent <MoveAI>(); patrolAI = GetComponent <PatrolAI>(); attackAI = GetComponent <AttackAI>(); fleeAI = GetComponent <FleeAI>(); enemyScript = GetComponent <Enemy>(); isSeeking = GetComponent <MoveAI>().isSeeking; //Debugging to check if objects are attached correctly if (moveAI == null) { Debug.LogError("moveAI not attached to StateMachine"); } if (patrolAI == null) { Debug.LogError("patrolAI not attached to StateMachine"); } //start the program in the patrol state ChangeStateTo("Patrol"); }
private void Start() { _anim = GetComponent <Animator>(); _attackAI = GetComponent <AttackAI>(); }
public void SetAttackAI(AttackAI ai) { attackAI = ai; AttemptStartup(); }