コード例 #1
0
        public override Order Clone()
        {
            AttackOrder order = new AttackOrder
            {
                attackTarget = attackTarget
            };

            return(order);
        }
コード例 #2
0
        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;
        }