public override Order Clone() { AttackOrder order = new AttackOrder { attackTarget = attackTarget }; return(order); }
protected virtual void SearchForTarget() { if (selfUnit.HasOrders() || attackTarget != null) { return; } float objectsCount = Physics.OverlapSphereNonAlloc(transform.position, maxEnemySearchRadius, objectsInSearchRadius, unitLayermask); for (int i = 0; i < objectsCount; i++) { unitComponentsFound = objectsInSearchRadius[i].GetComponents <Unit>(); if (unitComponentsFound.Length == 0) { continue; } var unit = unitComponentsFound[0]; if (selfUnit.IsInMyTeam(unit) || unit == selfUnit || !unit.GetModule <FogOfWarModule>().isVisibleInFOW || !CanAttackTargetByMoveType(unit)) { continue; } var order = new AttackOrder { attackTarget = unit }; selfUnit.AddOrder(order, false); break; } targetSearchDelay = enemySearchDelayTime; }