示例#1
0
        public static List <Entity> AttackableEntitiesInRange(this Entity entity)
        {
            var squad  = entity.GetModule <SquadMember>().Squad;
            var pos    = entity.GetComponent <HexPosComp>().Position;
            var weapon = entity.GetComponent <WeaponComp>();

            // TODO: consider height diff!

            var gem = ServiceLocator.Instance.GetService <IEntityManager>();

            return(gem.GetEntities(e =>
                                   e.IsAttackable() &&
                                   e.GetModule <SquadMember>().Squad != squad &&
                                   HexFun.Distance(e.GetComponent <HexPosComp>().Position, pos) <= weapon.range
                                   ).ToList());
        }