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 GameRepository(GameManager gameManager)
        {
            m_gameManager = gameManager;

            m_hero = null;


            m_combatRepositories = new CombatRepository[(int)eCombatType.Max];
            for (int i = 0; i < (int)eCombatType.Max; i++)
            {
                m_combatRepositories[i] = new CombatRepository((eCombatType)(i));
            }
        }
Exemplo n.º 3
0
        public IEntity GetPlayer(eCombatType nodeType, long id)
        {
            if (m_hero.NetID == id)
            {
                return(m_hero);
            }

            IEntity          actor      = null;
            CombatRepository repository = GetRepository(nodeType);

            if (repository.Get(id, out actor))
            {
                return(actor);
            }
            return(null);
        }
Exemplo n.º 4
0
 public SimpleCombatService(CombatRepository combatRepository)
 {
     this.combatRepository = combatRepository;
 }
Exemplo n.º 5
0
        public bool Remove(eCombatType actorType, long id)
        {
            CombatRepository repository = GetRepository(actorType);

            return(repository.Remove(id));
        }
Exemplo n.º 6
0
        public void Insert(ICombatOwner actor)
        {
            CombatRepository repository = GetRepository(actor.CombatType);

            repository.Insert(actor);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 인자로 주어진 battleTeam과 다른 team의 actor 목록을 얻어옴. - 17.07.21. #jonghyuk
        /// </summary>
        /// <param name="nodeType"></param>
        /// <param name="lstActor"></param>
        /// <param name="battleTeam"></param>
        /// <returns></returns>
        public bool GetCombatsInOtherTeam(eCombatType nodeType, ref List <ICombatOwner> lstActor, int battleTeam)
        {
            CombatRepository repository = GetRepository(nodeType);

            return(repository.GetCombatsByCondition(ref lstActor, (combatOwner) => combatOwner.BattleTeam != battleTeam));
        }
Exemplo n.º 8
0
        public bool GetCombatTransforms(eCombatType nodeType, ref List <Transform> lstTransforms)
        {
            CombatRepository repository = GetRepository(nodeType);

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

            return(repository.GetCombats(ref lstActor));
        }
Exemplo n.º 10
0
        public int GetCombatCount(eCombatType nodeType)
        {
            CombatRepository repository = GetRepository(nodeType);

            return(repository.GetCount());
        }