コード例 #1
0
        // using _spatialMap.GetAllIntersecting(CCamera2D.Active.GetArea(graphicsContext.ScreenSize))) causes all kinds of problems (render order changes when zombies move from cell and pretty sure other things too)
        protected override void Draw(GraphicsContext graphicsContext, ReadOnlyBag<Entity> entities)
        {
            // the texture size is actually 63x63, but the area in the texture that is of the actual zombie (no shadows) is 48x48
            const float BaseTextureSize = 48;

            RectangleF cameraArea = CCamera2D.Active.GetArea(graphicsContext.ScreenSize);
            foreach (Entity zombie in entities)
            {
                CZombieInfo zombieInfo = zombie.Get<CZombieInfo>();
                if (zombieInfo.AreaRectangle.Intersects(cameraArea))
                {
                    float scale = zombieInfo.Size / BaseTextureSize;
                    graphicsContext.SpriteBatch.DrawCentered(this.GetTexture(zombieInfo.Type), zombie.Transform.Position, ZombieRenderer.GetColor(zombieInfo), zombie.Transform.Rotation, scale);
                }

                // draw golden goblin glow
                if (zombieInfo.Type == ZombieType.GoldenGoblin)
                {
                    graphicsContext.SpriteBatch.DrawCentered(graphicsContext.ContentProvider.DefaultManager.LoadTexture("GoldenGoblinGlow"), zombie.Transform.Position, Color.Gold * 0.5f, 0, 3f + FlaiMath.Sin(graphicsContext.TotalSeconds * 2));

                    // DEBUG //
                  /*  CGoldenGoblinAI goldenGoblinAI = zombie.Get<CGoldenGoblinAI>();
                    if (goldenGoblinAI.State == GoldenGoblinState.TravellingToWaypoint)
                    {
                        graphicsContext.PrimitiveRenderer.DrawLine(goldenGoblinAI.Transform.Position, goldenGoblinAI.CurrentWaypoint, Color.Red, 2f);
                    }

                    for (int i = 0; i < goldenGoblinAI.Waypoints.Length - 1; i++)
                    {
                        graphicsContext.PrimitiveRenderer.DrawLine(goldenGoblinAI.Waypoints[i], goldenGoblinAI.Waypoints[i + 1], Color.Red, 4f);
                    } */
                }
            }
        }
コード例 #2
0
 protected override sealed void Process(UpdateContext updateContext, ReadOnlyBag<Entity> entities)
 {
     for (int i = 0; i < entities.Count; i++)
     {
         this.Process(updateContext, entities[i]);
     }
 }
コード例 #3
0
 protected sealed override void Draw(GraphicsContext graphicsContext, ReadOnlyBag<Entity> entities)
 {
     foreach (Entity entity in entities)
     {
         this.Draw(graphicsContext, entity);
     }
 }
コード例 #4
0
        /// <summary>
        /// Type initializer. Initialize the engine experimental feature list.
        /// </summary>
        static ExperimentalFeature()
        {
            // Initialize the readonly collection 'EngineExperimentalFeatures'.
            var engineFeatures = new ExperimentalFeature[] {
                /* Register engine experimental features here. Follow the same pattern as the example:
                 * new ExperimentalFeature(
                 *  name: "PSFileSystemProviderV2",
                 *  description: "Replace the old FileSystemProvider with cleaner design and faster code"),
                 */
                new ExperimentalFeature(
                    name: "PSImplicitRemotingBatching",
                    description: "Batch implicit remoting proxy commands to improve performance"),
                new ExperimentalFeature(
                    name: "PSCommandNotFoundSuggestion",
                    description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"),
                new ExperimentalFeature(
                    name: "PSForEachObjectParallel",
                    description: "New parameter set for ForEach-Object to run script blocks in parallel"),
                new ExperimentalFeature(
                    name: "PSTernaryOperator",
                    description: "Support the ternary operator in PowerShell language"),
                new ExperimentalFeature(
                    name: "PSErrorView",
                    description: "New formatting for ErrorRecord"),
                new ExperimentalFeature(
                    name: "PSUpdatesNotification",
                    description: "Print notification message when new releases are available"),
                new ExperimentalFeature(
                    name: "PSCoalescingOperators",
                    description: "Support the null coalescing operator and null coalescing assignment operator in PowerShell language"),
                new ExperimentalFeature(
                    name: "PSPipelineChainOperators",
                    description: "Allow use of && and || as operators between pipeline invocations"),
            };

            EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures);

            // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'.
            var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase);

            EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap);

            // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'.
            // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that:
            //   1. 'EnabledExperimentalFeatureNames' can be declared as readonly;
            //   2. No need to deal with initialization from multiple threads;
            //   3. We don't need to decide where/when to read the config file for the enabled experimental features,
            //      instead, it will be done when the type is used for the first time, which is always earlier than
            //      any experimental features take effect.
            string[] enabledFeatures = Array.Empty <string>();
            try
            {
                enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures();
            }
            catch (Exception e) when(LogException(e))
            {
            }

            EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures);
        }
コード例 #5
0
        protected override void Process(UpdateContext updateContext, ReadOnlyBag<Entity> entities)
        {
            if (!_playerInfo.IsAlive)
            {
                return;
            }

            float range = _playerInfo.IsInvulnerable ? 12 : 6;
            IZombieSpatialMap zombieSpatialMap = this.EntityWorld.Services.Get<IZombieSpatialMap>();
            foreach (Entity zombie in zombieSpatialMap.GetAllIntersecting(_player.Transform, range))
            {
                CZombieInfo zombieInfo = zombie.Get<CZombieInfo>();
                if (!_playerInfo.IsInvulnerable)
                {
                    if (!ZombieAttackSystem.CanAttack(zombieInfo.Type))
                    {
                        continue;
                    }

                    _playerInfo.KillPlayer();
                    return;
                }

                // player is invulnerable
                ZombieHelper.Kill(zombie, Vector2.Zero);
            }
        }
コード例 #6
0
        /// <summary>
        /// Type initializer. Initialize the engine experimental feature list.
        /// </summary>
        static ExperimentalFeature()
        {
            // Initialize the readonly collection 'EngineExperimentalFeatures'.
            var engineFeatures = new ExperimentalFeature[] {
                /* Register engine experimental features here. Follow the same pattern as the example:
                 * new ExperimentalFeature(
                 *  name: "PSFileSystemProviderV2",
                 *  description: "Replace the old FileSystemProvider with cleaner design and faster code"),
                 */
                new ExperimentalFeature(
                    name: "PSImplicitRemotingBatching",
                    description: "Batch implicit remoting proxy commands to improve performance"),
                new ExperimentalFeature(
                    name: "PSCommandNotFoundSuggestion",
                    description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"),
#if UNIX
                new ExperimentalFeature(
                    name: "PSUnixFileStat",
                    description: "Provide unix permission information for files and directories"),
#endif
                new ExperimentalFeature(
                    name: "PSNullConditionalOperators",
                    description: "Support the null conditional member access operators in PowerShell language"),
                new ExperimentalFeature(
                    name: "PSCultureInvariantReplaceOperator",
                    description: "Use culture invariant to-string convertor for lval in replace operator"),
                new ExperimentalFeature(
                    name: "PSNativePSPathResolution",
                    description: "Convert PSPath to filesystem path, if possible, for native commands"),
                new ExperimentalFeature(
                    name: "PSNotApplyErrorActionToStderr",
                    description: "Don't have $ErrorActionPreference affect stderr output"),
            };

            EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures);

            // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'.
            var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase);

            EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap);

            // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'.
            // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that:
            //   1. 'EnabledExperimentalFeatureNames' can be declared as readonly;
            //   2. No need to deal with initialization from multiple threads;
            //   3. We don't need to decide where/when to read the config file for the enabled experimental features,
            //      instead, it will be done when the type is used for the first time, which is always earlier than
            //      any experimental features take effect.
            string[] enabledFeatures = Array.Empty <string>();
            try
            {
                enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures();
            }
            catch (Exception e) when(LogException(e))
            {
            }

            EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures);
        }
コード例 #7
0
 protected sealed override void Process(UpdateContext updateContext, ReadOnlyBag<Entity> entities)
 {
     _currentTime += TimeSpan.FromTicks(updateContext.GameTime.DeltaTicks);
     if (_currentTime >= _interval)
     {
         _currentTime -= _interval;
         this.ProcessInner(updateContext, entities);
     }
 }
コード例 #8
0
 protected override void Draw(GraphicsContext graphicsContext, ReadOnlyBag<Entity> entities)
 {
     RectangleF cameraArea = CCamera2D.Active.GetArea().Inflate(-16);
     foreach (Entity entity in entities)
     {
         if (!cameraArea.Contains(entity.Transform.Position))
         {
             this.DrawArrow(graphicsContext, entity);
         }
     }
 }
コード例 #9
0
        protected override void Process(UpdateContext updateContext, ReadOnlyBag<Entity> entities)
        {
            float speedMultiplier = BoosterHelper.GetZombieSpeedMultiplier(_boosterState) * _zombieStatsProvider.SpeedMultiplier;

            for (int i = 0; i < entities.Count; i++)
            {
                Entity zombie = entities[i];
                CGoldenGoblinAI goldenGoblinAI = zombie.Get<CGoldenGoblinAI>();

                this.UpdateGoblin(updateContext, zombie, speedMultiplier);
            }
        }
コード例 #10
0
        /// <summary>
        /// Type initializer. Initialize the engine experimental feature list.
        /// </summary>
        static ExperimentalFeature()
        {
            // Initialize the readonly collection 'EngineExperimentalFeatures'.
            var engineFeatures = new ExperimentalFeature[] {
                /* Register engine experimental features here. Follow the same pattern as the example:
                 * new ExperimentalFeature(
                 *  name: "PSFileSystemProviderV2",
                 *  description: "Replace the old FileSystemProvider with cleaner design and faster code",
                 *  source: EngineSource,
                 *  isEnabled: false),
                 */
                new ExperimentalFeature(
                    name: "PSImplicitRemotingBatching",
                    description: "Batch implicit remoting proxy commands to improve performance",
                    source: EngineSource,
                    isEnabled: false),
                new ExperimentalFeature(
                    name: "PSUseAbbreviationExpansion",
                    description: "Allow tab completion of cmdlets and functions by abbreviation",
                    source: EngineSource,
                    isEnabled: false),
                new ExperimentalFeature(
                    name: "PSTempDrive",
                    description: "Create TEMP: PS Drive mapped to user's temporary directory path",
                    source: EngineSource,
                    isEnabled: false),
            };

            EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures);

            // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'.
            var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase);

            EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap);

            // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'.
            // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that:
            //   1. 'EnabledExperimentalFeatureNames' can be declared as readonly;
            //   2. No need to deal with initialization from multiple threads;
            //   3. We don't need to decide where/when to read the config file for the enabled experimental features,
            //      instead, it will be done when the type is used for the first time, which is always earlier than
            //      any experimental features take effect.
            string[] enabledFeatures = Utils.EmptyArray <string>();
            try
            {
                enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures();
            }
            catch (Exception e) when(LogException(e))
            {
            }

            EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures);
        }
コード例 #11
0
        protected override void Draw(GraphicsContext graphicsContext, ReadOnlyBag<Entity> entities)
        {
            RectangleF cameraArea = SkypieaConstants.GetAdjustedCameraArea(CCamera2D.Active);
            for (int i = 0; i < entities.Count; i++)
            {
                Entity entity = entities[i];
                if (!cameraArea.Contains(entity.Transform.Position))
                {
                    continue;
                }

                this.DrawBullet(graphicsContext, entity, entity.Get<CBullet>());
            }
        }
コード例 #12
0
        /// <summary>
        /// Type initializer. Initialize the engine experimental feature list.
        /// </summary>
        static ExperimentalFeature()
        {
            // Initialize the readonly collection 'EngineExperimentalFeatures'.
            var engineFeatures = new ExperimentalFeature[] {
                /* Register engine experimental features here. Follow the same pattern as the example:
                 * new ExperimentalFeature(
                 *  name: "PSFileSystemProviderV2",
                 *  description: "Replace the old FileSystemProvider with cleaner design and faster code"),
                 */
                new ExperimentalFeature(
                    name: "PSImplicitRemotingBatching",
                    description: "Batch implicit remoting proxy commands to improve performance"),
                new ExperimentalFeature(
                    name: "PSCommandNotFoundSuggestion",
                    description: "Recommend potential commands based on fuzzy search on a CommandNotFoundException"),
            };

            EngineExperimentalFeatures = new ReadOnlyCollection <ExperimentalFeature>(engineFeatures);

            // Initialize the readonly dictionary 'EngineExperimentalFeatureMap'.
            var engineExpFeatureMap = engineFeatures.ToDictionary(f => f.Name, StringComparer.OrdinalIgnoreCase);

            EngineExperimentalFeatureMap = new ReadOnlyDictionary <string, ExperimentalFeature>(engineExpFeatureMap);

            // Initialize the readonly hashset 'EnabledExperimentalFeatureNames'.
            // The initialization of 'EnabledExperimentalFeatureNames' is deliberately made in the type initializer so that:
            //   1. 'EnabledExperimentalFeatureNames' can be declared as readonly;
            //   2. No need to deal with initialization from multiple threads;
            //   3. We don't need to decide where/when to read the config file for the enabled experimental features,
            //      instead, it will be done when the type is used for the first time, which is always earlier than
            //      any experimental features take effect.
            string[] enabledFeatures = Array.Empty <string>();
            try
            {
                enabledFeatures = PowerShellConfig.Instance.GetExperimentalFeatures();
            }
            catch (Exception e) when(LogException(e))
            {
            }

            EnabledExperimentalFeatureNames = ProcessEnabledFeatures(enabledFeatures);
        }
コード例 #13
0
 // meh name
 protected virtual void ProcessInner(UpdateContext updateContext, ReadOnlyBag<Entity> entities) { }
コード例 #14
0
 public AchievementGroup(Achievement[] achievements)
 {
     Ensure.NotNull(achievements);
     _achievements = new ReadOnlyArray<Achievement>(achievements);
     _readOnlyReturnAchievements = new ReadOnlyBag<Achievement>(_returnAchievements);
 }
コード例 #15
0
 protected virtual void PreDraw(GraphicsContext graphicsContext) { } // entities?
 protected abstract void Draw(GraphicsContext graphicsContext, ReadOnlyBag<Entity> entities);
コード例 #16
0
 protected ProcessingSystem(Aspect aspect)
 {
     _aspect = aspect;
     _readOnlyEntities = new ReadOnlyBag<Entity>(_entities);
 }
コード例 #17
0
ファイル: TagManager.cs プロジェクト: JaakkoLipsanen/Flai.XNA
 public EntityCollection()
 {
     this.ReadOnlyEntities = new ReadOnlyBag<Entity>(this.Entities);
 }