Beispiel #1
0
        public override IEnumerable <UtilityAction> GetActions(Blackboard context)
        {
            var owner = context.GetState <SelfState>().GetValue();

            if (!owner.TryGetComponent(out AiControllerComponent controller))
            {
                throw new InvalidOperationException();
            }

            foreach (var entity in Visibility.GetEntitiesInRange(owner.Transform.GridPosition, typeof(BallisticMagazineComponent),
                                                                 controller.VisionRadius))
            {
                yield return(new PickUpAmmo(owner, entity, Bonus));
            }
        }
Beispiel #2
0
        public override IEnumerable <UtilityAction> GetActions(Blackboard context)
        {
            var owner = context.GetState <SelfState>().GetValue();

            if (!owner.TryGetComponent(out AiControllerComponent controller))
            {
                throw new InvalidOperationException();
            }

            foreach (var entity in Visibility.GetEntitiesInRange(owner.Transform.GridPosition, typeof(SpeciesComponent),
                                                                 controller.VisionRadius))
            {
                if (entity.HasComponent <BasicActorComponent>() && entity != owner)
                {
                    yield return(new MeleeAttackEntity(owner, entity, Bonus));
                }
            }
        }
        protected override List <IEntity> GetTrueValue()
        {
            var result = new List <IEntity>();

            if (!Owner.TryGetComponent(out AiControllerComponent controller))
            {
                return(result);
            }

            foreach (var entity in Visibility.GetEntitiesInRange(Owner.Transform.GridPosition, typeof(IBodyManagerComponent), controller.VisionRadius))
            {
                if (entity == Owner)
                {
                    continue;
                }
                result.Add(entity);
            }

            return(result);
        }
        public override IEnumerable <UtilityAction> GetActions(Blackboard context)
        {
            var owner = context.GetState <SelfState>().GetValue();

            if (!owner.TryGetComponent(out AiControllerComponent controller))
            {
                throw new InvalidOperationException();
            }

            foreach (var entity in Visibility.GetEntitiesInRange(owner.Transform.GridPosition, typeof(WeaponCapacitorChargerComponent),
                                                                 controller.VisionRadius))
            {
                var contained = entity.GetComponent <WeaponCapacitorChargerComponent>().HeldItem;

                if (contained != null)
                {
                    yield return(new PickUpHitscanFromCharger(owner, entity, contained, Bonus));
                }
            }
        }
Beispiel #5
0
        protected override List <EntityUid> GetTrueValue()
        {
            var result = new List <EntityUid>();
            var entMan = IoCManager.Resolve <IEntityManager>();

            if (!entMan.TryGetComponent(Owner, out AiControllerComponent? controller))
            {
                return(result);
            }

            foreach (var entity in Visibility.GetEntitiesInRange(entMan.GetComponent <TransformComponent>(Owner).Coordinates, typeof(SharedBodyComponent), controller.VisionRadius))
            {
                if (entity == Owner)
                {
                    continue;
                }
                result.Add(entity);
            }

            return(result);
        }