Exemplo n.º 1
0
        public IEntity FindNearestTarget(eCombatType targetType, Vector3 myPosition, float radius)
        {
            List <ICombatOwner> combatList = new List <ICombatOwner>();

            if (targetType == eCombatType.Hero || targetType == eCombatType.PC)
            {
                combatList.Add(m_hero);
            }

            CombatRepository repository = GetRepository(targetType);

            repository.GetCombats(ref combatList);

            float   minDistant = float.MaxValue;
            IEntity actor      = null;

            for (int i = 0; i < combatList.Count; i++)
            {
                float sqrDistant = (myPosition - combatList[i].GetOwnerPosition()).sqrMagnitude;
                if (sqrDistant < radius * radius && sqrDistant < minDistant)
                {
                    minDistant = sqrDistant;
                    actor      = combatList[i] as IEntity;
                }
            }

            return(actor);
        }
Exemplo n.º 2
0
        public bool GetCombats(eCombatType nodeType, ref List <ICombatOwner> lstActor)
        {
            CombatRepository repository = GetRepository(nodeType);

            return(repository.GetCombats(ref lstActor));
        }