private void OnEnable() { currentState = EnnemyState.wander; target = null; canAttack = true; currentAttack = RandomHelper.GetRandomInCollection(GetComponentsInChildren <EnnemyAttack>()); }
// Start is called before the first frame update void Start() { anim = GetComponent <Animator>(); aIPath = GetComponent <AIPath>(); rb = GetComponent <Rigidbody2D>(); attackState = GetComponent <EnnemyAttack>(); timerTornado = Time.time + Random.Range(timeToNextTornadoMin, timeToNextTornadoMax); }
// Start is called before the first frame update void Awake() { ennemyAttack = GetComponentInParent <EnnemyAttack>(); beamDuration = ennemyAttack.beamDuration; damage = ennemyAttack.globalDamage; startBeamDuration = beamDuration; beamLine.enabled = false; }
protected void enqueuAttack(EnnemyAttack attack) { for (int i = 0; i < attacks.Length; i++) { if (attack == attacks[i]) { int coolDownUnitIndex = attackPaterns[i]; //Identify to which cooldownUnit this attack belongs to coolDownUnits[coolDownUnitIndex].AddFirst(attack); } } }
//InitiateDestination initiate; void Awake() { // Set up the references. nav = GetComponentInParent <NavMeshAgent> (); animator = GetComponentInParent <Animator> (); atkscript = GetComponentInChildren <EnnemyAttack>(); hp = GetComponentInParent <Health>(); atkscript.enabled = false; distance = 5; //initiate = GetComponent <InitiateDestination> (); }
// Returns true if an attack could be decided protected bool DecideOnAttack() { List <EnnemyAttack> availableEnnemyAttacks = GetAvailableEnnemyAttacks(); if (availableEnnemyAttacks.Count > 0) { // TODO : instead of deciding by random, we should use some kind of scale system nextAttack = ennemyAttacks[Random.Range(0, ennemyAttacks.Count - 1)]; return(true); } return(false); }