/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (GameWorld game = new GameWorld()) { game.Run(); } }
public void LevelFinished(Player player, GameWorld world) { MessageBox.Show("Gewonnen", "Super", MessageBoxButtons.OK); player.Position = new Point(300, 200); world.ScrollOffset = new Point(0, 0); world.Import(); }
public CreatureGroup(CreatureType type, GameWorld gameWorld) { this.gameWorld = gameWorld; this.type = type; this.id = next_id; next_id++; }
public MeleeCombatSubsystem(GameWorld theWorld) : base(theWorld) { ComponentMask.SetBit(XnaGameComponentType.Collision); ComponentMask.SetBit(XnaGameComponentType.Spatial); ComponentMask.SetBit(XnaGameComponentType.MeleeCombat); ComponentMask.SetBit(XnaGameComponentType.Health); }
public UnitSelectionManager(GameWorld gameWorldRef) { _gameWorldRef = gameWorldRef; CurrentlySelectesItems = new List<ISelectable>(); CurrentlySelectedGroups = new List<int>(); _currentFrameManagedItems = new List<ISelectable>(); }
public AISubsystem(GameWorld theWorld) : base(theWorld) { ComponentMask.SetBit(XnaGameComponentType.EnemyAI); ComponentMask.SetBit(XnaGameComponentType.Collision); ComponentMask.SetBit(XnaGameComponentType.Spatial); ComponentMask.SetBit(XnaGameComponentType.Physics); }
public void WorldSwitched(GameWorld world) { GameObject current = transform.parent.gameObject; transform.parent = null; transform.position = current.transform.position; transform.rotation = current.transform.rotation; Destroy(current); GameObject prefab = null; switch (world) { case GameWorld.human: prefab = humanVersion; break; case GameWorld.race: prefab = raceVersion; break; case GameWorld.dino: prefab = dinoVersion; break; case GameWorld.space: prefab = spaceVersion; break; } current = Instantiate(prefab) as GameObject; current.transform.position = transform.position; current.transform.rotation = transform.rotation; if (current.tag == "Player") { // cancel out any rolling we may have encountered current.transform.rotation = Quaternion.Euler( new Vector3(0, transform.rotation.eulerAngles.y, 0)); } transform.parent = current.transform; }
public Sun(GameWorld gameWorld) : base(gameWorld) { Graphic.LoadContent("gfx/background/sun"); Graphic.Layer = 0.001f; Graphic.CenterOrigin(); }
public void UpdateWorld(GameWorld world) { if (sc != null) { Destroy(sc); } string moveDesc="Move yourself around", switchDesc="Change yourself", attackDesc = null; switch (world) { case GameWorld.dino: attackDesc = "Attack!"; break; case GameWorld.space: attackDesc = "Fly up"; break; case GameWorld.race: attackDesc = "Speed Boost"; break; } if (attackDesc != null) { sc = ShowControls.CreateDocked(new ControlItem[] { new ControlItem(moveDesc, CustomDisplay.arrows), new ControlItem(switchDesc, KeyCode.LeftControl), new ControlItem(attackDesc, KeyCode.Space) }); } else { sc = ShowControls.CreateDocked(new ControlItem[] { new ControlItem(moveDesc, CustomDisplay.arrows), new ControlItem(switchDesc, KeyCode.LeftControl) }); } sc.size = ShowControlSize.Small; sc.position = ShowControlPosition.Bottom; sc.slideSpeed = 0; sc.showDuration = -1; sc.Show(); }
public CircleMotionBehavior(IGameObject gameObject, GameWorld gw, DecimalPoint center) : base(gameObject, gw) { Center = center; Range = 200; angle = 0; }
public CraftingGrid(GameWorld GameWorld, Vector2 Position) { this.Position = Position; RecipePartIdMatching = new int[5, 5]; for (int y = 0; y < 5; y++) { for (int x = 0; x < 5; x++) { RecipeSlots[x, y] = new ItemSlot(GameWorld); RecipeSlots[x, y].Visible = true; Vector2 UpperLeftPos = Position + new Vector2(x * 34, y * 34); RecipeSlots[x, y].Position = new Rectangle((int)UpperLeftPos.X, (int)UpperLeftPos.Y, 32, 32); RecipeSlots[x, y].OnStackModified += UpdateGrid; RecipePartIdMatching[x, y] = -1; } } OutputSlot = new ItemSlot(GameWorld); OutputSlot.Visible = true; OutputSlot.State = ItemSlot.SlotState.InputLocked; OutputSlot.Position = new Rectangle((int)Position.X + 5 * 32 + 10, (int)Position.Y + 2 * 32, 32, 32); OutputSlot.OnStackModified += ItemCrafted; }
public GamePlayer(GameWorld gameWorldRef) { _gameWorldRef = gameWorldRef; People = new List<CreatureBase>(); Buildings = new List<BuildingBase>(); BuildingBase building3 = new ResidentialHouse(gameWorldRef, this, new Point(15, 20)); BuildingBase building6 = new ResidentialHouse(gameWorldRef, this, new Point(6, 20)); BuildingBase building4 = new TrainingCamp(gameWorldRef, this, new Point(10, 16)); BuildingBase building1 = new TrainingCamp(gameWorldRef, this, new Point(30, 30)); BuildingBase building5 = new Stable(gameWorldRef, this, new Point(14, 35)); Buildings.Add(building6); Buildings.Add(building4); Buildings.Add(building5); Buildings.Add(building1); Buildings.Add(building3); Farms = new List<Farm>(); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(4, 28))); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(6, 32))); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(10, 32))); Farms.Add(new Farm("farm1", gameWorldRef, this, new Point(12, 28))); //TODO: create player presets instead of following CreatureBase human1 = new Swordsman(gameWorldRef, this, new Vector2(300, 400)); CreatureBase human2 = new Horseman(gameWorldRef, this, new Vector2(350, 400)); CreatureBase human3 = new Farmer(gameWorldRef, this, new Vector2(300, 460)); CreatureBase human4 = new Knight(gameWorldRef, this, new Vector2(350, 460)); People.Add(human1); People.Add(human4); People.Add(human3); People.Add(human2); }
public CombatController(GameWorld gameWorld, ICombatEngine combatEngine, IAsciiArtRepository asciiArtRepository) { _gameWorld = gameWorld; _combatEngine = combatEngine; _combatSteps = _combatEngine.GetSteps().GetEnumerator(); _asciiArtRepository = asciiArtRepository; }
public DungeonController(GameWorld gameWorld, IDice dice, IWeaponFactory weaponFactory, IAsciiArtRepository asciiArtRepository) { _gameWorld = gameWorld; _dice = dice; _weaponFactory = weaponFactory; _asciiArtRepository = asciiArtRepository; }
public SpriteRendererSubsystem(RenderWindow sb, GameWorld theWorld) : base(theWorld) { ComponentMask.SetBit(XnaGameComponentType.Sprite); ComponentMask.SetBit(XnaGameComponentType.Spatial); _renderWindow = sb; }
public InventoryController(GameWorld gameWorld, IAsciiArtRepository asciiArtRepository, IDice dice) { _gameWorld = gameWorld; _asciiArtRepository = asciiArtRepository; _dice = dice; _title = DefaultTitle; _information = DefaultInformation; }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. sB = new SpriteBatch(GraphicsDevice); Asset.Initialise(Content); gameWorld = new GameWorld(); }
/// <param name="moteType">>Numer grafiki pyłku (liczba z zakresu [1 - 3])</param> public Mote(int moteType, float graphicScale, GameWorld gameWorld) : base(gameWorld) { Graphic.LoadContent("gfx/background/mote" + moteType); Graphic.Layer = 0.9f; Graphic.Scale = new Vector2(graphicScale, graphicScale); Graphic.CenterOrigin(); }
public PlayState(StateManager stateManager, GameWorld gameWolrd) : base(stateManager) { _gameWorld = gameWolrd; backgroundSound = new AudioClip(Path.Combine("Content", "Sounds", "rainfall.ogg")); backgroundSound.Play(); }
/// <summary> /// MotionBehavior contructor /// </summary> /// <param name="gameObject">GameObject</param> /// <param name="gw">GameWorld</param> protected MotionBehavior(IGameObject gameObject, GameWorld gw) { this.GameObject = gameObject; this.Gw = gw; Speed = new DecimalPoint(0, 0); NewSpeed = new DecimalPoint(0, 0); CanMoveThroughWall = false; }
public Bow(GameWorld gameWorld) : base(gameWorld) { PerfermingTimer.Duration = MaxTension; PerfermingTimer.UpdateEvent += OnPerfemingTimerUpdate; Size = new Size(16, 64); _tension = MinTension; }
public CircleMotionBehavior(IGameObject gameObject, GameWorld gw, DecimalPoint center) : base(gameObject, gw) { Center = center; range = gw.GetDistance(center, gameObject.Location); Range = 180; angle = GameWorld.CalcAngle(GameObject.Location.ToPoint(), Center.ToPoint()); }
public Monster CreateMonster(GameWorld gameWorld, CombatContext combatContext) { bool isBoss = gameWorld.NumberOfMonstersDefeatedInCurrentDungeonLevel >= gameWorld.RequiredNumberOfMonstersInCurrentDungeonLevelBeforeBoss; var monster = CreateMonster(gameWorld.CurrentDungeonLevel, isBoss, combatContext); Debug.WriteLine("Created {0} (Level {1}) HP:{6} ATK:{2} DEF:{3}. Player ATK:{4} DEF:{5}", monster.Name, monster.Level, monster.ToHitAttack, monster.ToHitDefense, combatContext.Player.ToHitAttack, combatContext.Player.ToHitDefense, monster.MaxHitPoints); if (monster.Weapon != null) Debug.WriteLine("Monster is wielding a {0} ({1})", monster.Weapon.GetLeveledName(), monster.Weapon.Damage); return monster; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); // create and reset the game world gameWorld = new GameWorld(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, Content); gameWorld.Reset(); }
void Awake() { if (Instance != null) { throw new Exception("Singleton instance already exists"); } Instance = this; subjectiveTime = GetComponent<SubjectiveTime>(); }
public Projective(GameWorld gameWorld) : base(gameWorld) { GravityAffected = true; CollisionWithTiles += OnCollisionWithTiles; CollisionWithObjects += OnCollision; Size = new Size(64,16); //MaxVelocity = new Vector2(0,15); }
private HDirection _lastGoodDirection; // it is good direction if != Direction.No #endregion Fields #region Constructors public Item(GameWorld gameWorld) : base(gameWorld) { IntervalTimer = new Timer(); PerfermingTimer = new Timer(); GravityAffected = true; MaxVelocity = new Vector2(10, 10); Friction = 1.0f; }
/// <summary> /// GfxEngine constructor /// </summary> /// <param name="g">Graphics object to draw onto</param> /// <param name="gw">GameWorld</param> /// <param name="camera">Camera</param> public GfxEngine(Graphics g, GameWorld gw, Camera camera) { this.g = g; this.gw = gw; this.camera = camera; Bitmap original = new Bitmap(Game.Size.Width, Game.Size.Height); bmp = new Bitmap(original.Width, original.Height, PixelFormat.Format32bppPArgb); frameG = Graphics.FromImage(bmp); }
public Enemy(GameWorld gameWorld, IBehaviour behaviour = null) : base(gameWorld) { DestroyEvent += CreateDeadBodyOnDestroyEvent; DestroyEvent += CreateLettersOnDestroyEvent; CollisionWithObjects += OnCollision; _behaviour = behaviour; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); gameWorld = new GameWorld(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, Content); SongGenerator(); MediaPlayer.Play(song); MediaPlayer.IsRepeating = true; gameWorld.Reset(); }
public override void _Process(float delta) { // https://github.com/Revolutionary-Games/Thrive/issues/1976 if (delta <= 0) { return; } FluidSystem.Process(delta); TimedLifeSystem.Process(delta); ProcessSystem.Process(delta); microbeAISystem.Process(delta); if (gameOver) { guidanceLine.Visible = false; // Player is extinct and has lost the game // Show the game lost popup if not already visible HUD.ShowExtinctionBox(); return; } if (Player != null) { spawner.Process(delta, Player.Translation, Player.Rotation); Clouds.ReportPlayerPosition(Player.Translation); TutorialState.SendEvent(TutorialEventType.MicrobePlayerOrientation, new RotationEventArgs(Player.Transform.basis, Player.RotationDegrees), this); TutorialState.SendEvent(TutorialEventType.MicrobePlayerCompounds, new CompoundBagEventArgs(Player.Compounds), this); TutorialState.SendEvent(TutorialEventType.MicrobePlayerTotalCollected, new CompoundEventArgs(Player.TotalAbsorbedCompounds), this); elapsedSinceCompoundPositionCheck += delta; if (elapsedSinceCompoundPositionCheck > Constants.TUTORIAL_COMPOUND_POSITION_UPDATE_INTERVAL) { elapsedSinceCompoundPositionCheck = 0; if (TutorialState.WantsNearbyCompoundInfo()) { TutorialState.SendEvent(TutorialEventType.MicrobeCompoundsNearPlayer, new CompoundPositionEventArgs(Clouds.FindCompoundNearPoint(Player.Translation, glucose)), this); } guidancePosition = TutorialState.GetPlayerGuidancePosition(); } if (guidancePosition != null) { guidanceLine.Visible = true; guidanceLine.LineStart = Player.Translation; guidanceLine.LineEnd = guidancePosition.Value; } else { guidanceLine.Visible = false; } } else { guidanceLine.Visible = false; if (!spawnedPlayer) { GD.PrintErr("MicrobeStage was entered without spawning the player"); SpawnPlayer(); } else { // Respawn the player once the timer is up playerRespawnTimer -= delta; if (playerRespawnTimer <= 0) { HandlePlayerRespawn(); } } } // Start auto-evo if stage entry finished, don't need to auto save, // settings have auto-evo be started during gameplay and auto-evo is not already started if (TransitionFinished && !wantsToSave && Settings.Instance.RunAutoEvoDuringGamePlay) { GameWorld.IsAutoEvoFinished(true); } // Save if wanted if (TransitionFinished && wantsToSave) { if (!CurrentGame.FreeBuild) { SaveHelper.AutoSave(this); } wantsToSave = false; } }
public void NotifyRemoved() { GameWorld.GetWorldInstance().ShadowCastCollection.Remove(this); GameWorld.GetWorldInstance().LitCheckCollection.Remove(this); GameWorld.GetWorldInstance().VisibilityCheckCollection.Remove(this); }
public void InitCloseRealm() { Console.WriteLine("Oryx has closed realm {0}...", world.Name); ClosingStarted = true; foreach (var i in world.Players.Values) { SendMsg(i, "I HAVE CLOSED THIS REALM!", "#Oryx the Mad God"); SendMsg(i, "YOU WILL NOT LIVE TO SEE THE LIGHT OF DAY!", "#Oryx the Mad God"); } world.Timers.Add(new WorldTimer(120000, (ww, tt) => { CloseRealm(); })); world.Manager.GetWorld(World.NEXUS_ID).Timers.Add(new WorldTimer(130000, (w, t) => Task.Factory.StartNew(() => GameWorld.AutoName(1, true)).ContinueWith(_ => w.Manager.AddWorld(_.Result), TaskScheduler.Default))); world.Manager.CloseWorld(world); }
/// <summary> /// Finds the closest tree to the player within the collider radius. /// </summary> /// <param name="player">The player, defining the center and radius of the search operation.</param> /// <param name="world">The world which is searched.</param> /// <returns>The closest tree instance to the player, or null if no tree was found within the radius.</returns> public static PlantInstanceTemplate FindClosestPlantRequiringInstanceReallyBruteForce(LocalPlayer player, GameWorld world) { var relevantChunks = world.WorldChunks.Where(wc => wc.CurrentMode == ChunkMode.Immediate); return(FindClosestPlantRequiringInstance(player, relevantChunks.SelectMany(c => c.PlantInstances))); }
public GrenadeLauncher_Update(GameWorld world) : base(world) { ExtraComponentRequirements = new ComponentType[] { typeof(ServerEntity) }; }
public void LogResultsToTimeline(GameWorld world, List <ExternalEffect> effects = null) { var newSpecies = GetNewSpecies(); foreach (var patch in world.Map.Patches.Values) { foreach (var species in patch.SpeciesInPatch.Keys) { var globalPopulation = GetGlobalPopulation(species, true, true); var previousGlobalPopulation = world.Map.GetSpeciesGlobalPopulation(species); var finalPatchPopulation = GetPopulationInPatch(species, patch); var previousPatchPopulation = patch.GetSpeciesPopulation(species); finalPatchPopulation += CountSpeciesSpreadPopulation(species, patch); if (results[species].SplitOffPatches?.Contains(patch) == true) { // All population splits off finalPatchPopulation = 0; } // Apply external effects if (effects != null && world.Map.CurrentPatch.ID == patch.ID) { foreach (var effect in effects) { if (effect.Species == species) { finalPatchPopulation += effect.Constant + (long)(effect.Species.Population * effect.Coefficient) - effect.Species.Population; } } } if (globalPopulation <= 0) { // TODO: see https://github.com/Revolutionary-Games/Thrive/issues/2958 LogEventGloballyAndLocally(world, patch, new LocalizedString( "TIMELINE_SPECIES_EXTINCT", species.FormattedName), species.PlayerSpecies, "extinction.png"); continue; } if (finalPatchPopulation > 0 && finalPatchPopulation != previousPatchPopulation) { if (finalPatchPopulation > previousPatchPopulation) { patch.LogEvent(new LocalizedString("TIMELINE_SPECIES_POPULATION_INCREASE", species.FormattedName, finalPatchPopulation), species.PlayerSpecies, "popUp.png"); } else { patch.LogEvent(new LocalizedString("TIMELINE_SPECIES_POPULATION_DECREASE", species.FormattedName, finalPatchPopulation), species.PlayerSpecies, "popDown.png"); } } else { patch.LogEvent(new LocalizedString( "TIMELINE_SPECIES_EXTINCT_LOCAL", species.FormattedName), species.PlayerSpecies, "extinctionLocal.png"); } if (globalPopulation != previousGlobalPopulation) { if (globalPopulation > previousGlobalPopulation) { world.LogEvent(new LocalizedString("TIMELINE_SPECIES_POPULATION_INCREASE", species.FormattedName, globalPopulation), species.PlayerSpecies, "popUp.png"); } else { world.LogEvent(new LocalizedString("TIMELINE_SPECIES_POPULATION_DECREASE", species.FormattedName, globalPopulation), species.PlayerSpecies, "popDown.png"); } } } foreach (var migration in GetMigrationsTo(patch)) { // Log to destination patch patch.LogEvent(new LocalizedString("TIMELINE_SPECIES_MIGRATED_FROM", migration.Key.FormattedName, new LocalizedString(migration.Value.From.Name)), migration.Key.PlayerSpecies, "newSpecies.png"); // Log to game world world.LogEvent(new LocalizedString("GLOBAL_TIMELINE_SPECIES_MIGRATED_TO", migration.Key.FormattedName, new LocalizedString(migration.Value.To.Name), new LocalizedString(migration.Value.From.Name)), migration.Key.PlayerSpecies, "newSpecies.png"); // Log to origin patch migration.Value.From.LogEvent(new LocalizedString("TIMELINE_SPECIES_MIGRATED_TO", migration.Key.FormattedName, new LocalizedString(migration.Value.To.Name)), migration.Key.PlayerSpecies, "newSpecies.png"); } foreach (var newSpeciesEntry in newSpecies) { GetSpeciesPopulationsByPatch(newSpeciesEntry, true, true).TryGetValue(patch, out var population); var speciesResult = results[newSpeciesEntry]; if (population > 0 && speciesResult.NewlyCreated != null) { switch (speciesResult.NewlyCreated.Value) { case NewSpeciesType.FillNiche: LogEventGloballyAndLocally(world, patch, new LocalizedString("TIMELINE_NICHE_FILL", newSpeciesEntry.FormattedName, speciesResult.SplitFrom.FormattedName), false, "newSpecies.png"); break; case NewSpeciesType.SplitDueToMutation: LogEventGloballyAndLocally(world, patch, new LocalizedString( "TIMELINE_SELECTION_PRESSURE_SPLIT", newSpeciesEntry.FormattedName, speciesResult.SplitFrom.FormattedName), false, "newSpecies.png"); break; default: GD.PrintErr("Unhandled newly created species type: ", speciesResult.NewlyCreated.Value); break; } } } } }
public OffensiveMotionBehavior(IGameObject gameObject, GameWorld gameWorld, DecimalPoint targetLocation) : base(gameObject, gameWorld) { this.TargetLocation = targetLocation; }
protected override void Update(GameTime gameTime) { #if !DEBUG if (!IsActive) { return; } #endif if (_wantsToQuit) { Exit(); } SteamAPI.RunCallbacks(); GameTime = gameTime; GameUpdateCalled?.Invoke(); InputSystem.Update(); _frameRateTimer += gameTime.ElapsedGameTime.TotalMilliseconds; if (_frameRateTimer > 1000f) { FPS = _totalFrames; _totalFrames = 0; _frameRateTimer = 0; } IsMouseVisible = false; Cursor.Update(); SoundtrackManager.Update(); MessageBox.Update(); if (MessageBox.IsActive) { return; } TextInputBox.Update(); if (TextInputBox.IsActive) { return; } GameDebug.Update(); if (GameDebug.IsTyping) { return; } PauseMenu.Update(); OptionsMenu.Update(); if (OptionsMenu.IsActive) { return; } if (PauseMenu.IsActive) { return; } Dialog.Update(); Overlay.Update(); KeyPopUp.Update(); Player player = GameWorld.GetPlayers()[0]; Session.Update(); //Update the game based on what GameState it is switch (CurrentGameState) { case GameState.MainMenu: MainMenu.Update(); if (GameWorld.TileArray != null && GameWorld.TileArray.Length != 0) { goto case GameState.GameWorld; } break; case GameState.LoadingScreen: LoadingScreen.Update(); if (!IsLoadingContent) { CurrentGameState = _desiredGameState; } break; case GameState.GameWorld: if (IsLoadingContent) { return; } if (GameWorld.IsOnDebug) { break; } GameWorld.TotalUpdateTimer.Start(); if (!TimeFreeze.IsTimeFrozen()) { GameWorld.UpdateWorld(); } GameWorld.UpdateVisual(); GameWorld.TotalUpdateTimer.Measure(); if (StoryTracker.IsInStoryMode) { StoryTracker.Update(); } break; } base.Update(gameTime); }
public UpdateItemActionTimelineTrigger(GameWorld world) : base(world) { }
public RocketJump_Update(GameWorld world) : base(world) { ExtraComponentRequirements = new ComponentType[] { typeof(ServerEntity) }; }
public override void HandleInput(InputHelper inputHelper) { float walkingSpeed = 400; if (walkingOnIce) { walkingSpeed *= 1.5f; } if (!isAlive) { return; } if (inputHelper.IsKeyDown(Keys.Left)) { velocity.X = -walkingSpeed; } else if (inputHelper.IsKeyDown(Keys.Right)) { velocity.X = walkingSpeed; } else if (!walkingOnIce && isOnTheGround) { velocity.X = 0.0f; } if (velocity.X != 0.0f) { Mirror = velocity.X < 0; } if ((inputHelper.KeyPressed(Keys.Space) || inputHelper.KeyPressed(Keys.Up))) { if (isOnTheGround) { Jump(); } } if (inputHelper.IsKeyDown(Keys.Space) || inputHelper.IsKeyDown(Keys.Up)) { holdingUp = true; } else { holdingUp = false; } if (inputHelper.IsKeyDown(Keys.Down)) { movingThroughPlatform = true; } else { movingThroughPlatform = false; } if (inputHelper.KeyPressed(Keys.M)) { if (GameWorld.Find("bomb") != null) { Bomb bomb = GameWorld.Find("bomb") as Bomb; if (!bomb.remove) { bomb.explode(); } bomb.Reset(GlobalPosition - new Vector2(0, Height / 4 * 3), Mirror); } else { Bomb bomb = new Bomb(); GameWorld.Add(bomb); bomb.Reset(GlobalPosition - new Vector2(0, Height / 4 * 3), Mirror); } } }
public DefaultBehaviourController_Update(GameWorld world) : base(world) { ExtraComponentRequirements = new ComponentType[] { typeof(ServerEntity) }; }
protected override void CalcMove() { GameObject.Angle = (int)GameWorld.CalcAngle(GameObject.Location.ToPoint(), TargetLocation.ToPoint()); }
public StartGrenadeMovement(GameWorld world) : base(world) { }
/// <summary> /// Logs an event description into game world and a patch. Use this if the event description in question /// is exactly the same. /// </summary> private void LogEventGloballyAndLocally(GameWorld world, Patch patch, LocalizedString description, bool highlight = false, string iconPath = null) { patch.LogEvent(description, highlight, iconPath); world.LogEvent(description, highlight, iconPath); }
public FinalizeGrenadeMovement(GameWorld world) : base(world) { }
public HandleGrenadeRequest(GameWorld world, BundledResourceManager resourceManager) : base(world) { m_resourceManager = resourceManager; }
public Oryx(GameWorld world) { this.world = world; Init(); }
public void ApplyResults(GameWorld world, bool skipMutations) { foreach (var entry in results) { if (entry.Value.NewlyCreated != null) { world.RegisterAutoEvoCreatedSpecies(entry.Key); } if (!skipMutations && entry.Value.MutatedProperties != null) { entry.Key.ApplyMutation(entry.Value.MutatedProperties); } foreach (var populationEntry in entry.Value.NewPopulationInPatches) { var patch = world.Map.GetPatch(populationEntry.Key.ID); if (patch != null) { // We ignore the return value as population results are added for all existing patches for all // species (if the species is not in the patch the population is 0 in the results) patch.UpdateSpeciesPopulation(entry.Key, populationEntry.Value); } else { GD.PrintErr("RunResults has population of a species for invalid patch"); } } if (entry.Value.NewlyCreated != null) { // If we split off from a species that didn't take a population hit, we need to register ourselves bool register = false; if (entry.Value.SplitFrom == null) { register = true; } else if (results[entry.Value.SplitFrom].SplitOff != entry.Key) { register = true; } if (register) { foreach (var populationEntry in entry.Value.NewPopulationInPatches) { var patch = world.Map.GetPatch(populationEntry.Key.ID); if (patch?.AddSpecies(entry.Key, populationEntry.Value) != true) { GD.PrintErr( "RunResults has new species with invalid patch or it was failed to be added"); } } } } foreach (var spreadEntry in entry.Value.SpreadToPatches) { var from = world.Map.GetPatch(spreadEntry.From.ID); var to = world.Map.GetPatch(spreadEntry.To.ID); if (from == null || to == null) { GD.PrintErr("RunResults has a species migration to/from an invalid patch"); continue; } long remainingPopulation = from.GetSpeciesPopulation(entry.Key) - spreadEntry.Population; long newPopulation = to.GetSpeciesPopulation(entry.Key) + spreadEntry.Population; if (!from.UpdateSpeciesPopulation(entry.Key, remainingPopulation)) { GD.PrintErr("RunResults failed to update population for a species in a patch it moved from"); } if (!to.UpdateSpeciesPopulation(entry.Key, newPopulation)) { if (!to.AddSpecies(entry.Key, newPopulation)) { GD.PrintErr("RunResults failed to update population and also add species failed on " + "migration target patch"); } } } if (entry.Value.SplitOff != null) { if (entry.Value.SplitOffPatches != null) { // Set populations to 0 for the patches that moved and replace the results for the split off // species with those foreach (var splitOffPatch in entry.Value.SplitOffPatches) { var patch = world.Map.GetPatch(splitOffPatch.ID); if (patch == null) { GD.PrintErr("RunResults has a species split in an invalid patch"); continue; } var population = patch.GetSpeciesPopulation(entry.Key); if (population <= 0) { continue; } if (!patch.UpdateSpeciesPopulation(entry.Key, 0)) { GD.PrintErr("RunResults failed to update population for a species that split"); } if (!patch.AddSpecies(entry.Value.SplitOff, population)) { GD.PrintErr("RunResults failed to add species to patch that split off"); } } } else { GD.PrintErr("List of split off patches is null, can't actually perform the split"); } } } }
public Shop_Level3(GameWorld gameWorld, GraphicsDevice graphicsDevice, ContentManager content) : base(gameWorld, graphicsDevice, content) { var buttonTexture = _content.Load <Texture2D>("Button"); var buttonFont = _content.Load <SpriteFont>("Font"); Font = content.Load <SpriteFont>("Font"); Texture2D piller = content.Load <Texture2D>("Pillar1"); #region Texture loaded //Left Wall Texture2D wallTopCorLeft = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Top_Left"); Texture2D wallTopCorLeft2 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Top_Left_2"); Texture2D wallTopLeft = content.Load <Texture2D>("64x64/Purple_Wall_Left_Up_1"); Texture2D wallTopLeft2 = content.Load <Texture2D>("64x64/Purple_Wall_Left_Up_2"); Texture2D wallMidLeftTop = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Left_Top"); Texture2D wallMidLeftLow = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Left_Low"); Texture2D wallBotLeft2 = content.Load <Texture2D>("64x64/Purple_Wall_Left_Bottom_2"); Texture2D wallBotLeft1 = content.Load <Texture2D>("64x64/Purple_Wall_Left_Bottom_1"); Texture2D wallBotCorLeft1 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Bot_Left_1"); Texture2D wallBotCorLeft2 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Bot_Left_2"); Texture2D wallBotLow = content.Load <Texture2D>("64x64/Purple_Wall_Left_Left_Low_2"); Texture2D wallTopLow = content.Load <Texture2D>("64x64/Purple_Wall_Right_Left_Low_1"); //Bottom Wall Texture2D wallBottomLeft1 = content.Load <Texture2D>("64x64/Purple_Wall_Left_Bottom_Up_1"); Texture2D wallBottomLeft2 = content.Load <Texture2D>("64x64/Purple_Wall_Left_Bot_2"); Texture2D wallBottomMiddle1 = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Bottom_Up"); Texture2D wallBottomMiddle2 = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Bottom_Low"); Texture2D wallBottomRight2 = content.Load <Texture2D>("64x64/Purple_Wall_Right_Bottom_2"); Texture2D wallBottomRight1 = content.Load <Texture2D>("64x64/Purple_Wall_Right_Bottom_1"); Texture2D wallCornerBottomRight1 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Bot_Right_1"); Texture2D wallCornerBottomRight2 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Bot_Right_2"); Texture2D wallLeftBotLow = content.Load <Texture2D>("64x64/Purple_Wall_Left_Bottom_Low_2"); Texture2D wallRightBotLow = content.Load <Texture2D>("64x64/Purple_Wall_Right_Bottom_Low_1"); //Right Wall Texture2D wallRightLeft1 = content.Load <Texture2D>("64x64/Purple_Wall_Right_Bottom_Up_1"); Texture2D wallRightLeft2 = content.Load <Texture2D>("64x64/Purple_Wall_Right_Bottom_Up_2"); Texture2D wallRightMiddle1 = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Right_Up"); Texture2D wallRightMiddle2 = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Right_Low"); Texture2D wallRightTop2 = content.Load <Texture2D>("64x64/Purple_Wall_Right_Top_2"); Texture2D wallRightTop1 = content.Load <Texture2D>("64x64/Purple_Wall_Right_Top_1"); Texture2D wallCornerTopRight1 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Top_Right_1"); Texture2D wallCornerTopRight2 = content.Load <Texture2D>("64x64/Purple_Wall_Corner_Top_Right_2"); Texture2D wallLeftRightLow = content.Load <Texture2D>("64x64/Purple_Wall_Right_Right_Low_1"); Texture2D wallRightRightLow = content.Load <Texture2D>("64x64/Purple_Wall_Left_Right_Low_2"); //Top Wall Texture2D wallTopRight1 = content.Load <Texture2D>("64x64/Purple_Wall_Top_Right_1"); Texture2D wallTopRight2 = content.Load <Texture2D>("64x64/Purple_Wall_Top_Right_2"); Texture2D wallTopMiddle1 = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Top_Up"); Texture2D wallTopMiddle2 = content.Load <Texture2D>("64x64/Purple_Wall_Mid_Top_Low"); Texture2D wallTopLeft_2 = content.Load <Texture2D>("64x64/Purple_Wall_Top_Left_1"); Texture2D wallTopLeft_1 = content.Load <Texture2D>("64x64/Purple_Wall_Top_Left_2"); Texture2D wallLeftTopLow = content.Load <Texture2D>("64x64/Purple_Wall_Right_Top_Low_2"); Texture2D wallRightTopLow = content.Load <Texture2D>("64x64/Purple_Wall_Right_Top_Low_1"); //Floor Texture2D floorPattern1 = content.Load <Texture2D>("64x64/Purple_Floor_1"); Texture2D floorPattern2 = content.Load <Texture2D>("64x64/Purple_Floor_2"); Texture2D floorPlain = content.Load <Texture2D>("64x64/Plain_Floor"); Texture2D floorBrick = content.Load <Texture2D>("64x64/Brick_Floor"); Texture2D floorPlainGray = content.Load <Texture2D>("64x64/Plain_Floor_Gray"); Texture2D floorRockyGray = content.Load <Texture2D>("64x64/Rocky_Floor_Gray"); //Door //Door Entry Texture2D Door_Left_Top_Entry = content.Load <Texture2D>("64x64/Door_Left_Top_Entry"); Texture2D Door_Mid_Top_Entry = content.Load <Texture2D>("64x64/Door_Mid_Top_Entry"); Texture2D Door_Right_Top_Entry = content.Load <Texture2D>("64x64/Door_Right_Top_Entry"); Texture2D Door_Left_Bot_Entry = content.Load <Texture2D>("64x64/Door_Left_Bot_Entry"); Texture2D Door_Mid_Bot_Entry = content.Load <Texture2D>("64x64/Door_Mid_Bot_Entry"); Texture2D Door_Right_Bot_Entry = content.Load <Texture2D>("64x64/Door_Right_Bot_Entry"); //Top Door Texture2D Door_Left_Top_Top = content.Load <Texture2D>("64x64/Purple_Door_Left_Top_Top"); Texture2D Door_Mid_Top_Top = content.Load <Texture2D>("64x64/Purple_Door_Mid_Top_Top"); Texture2D Door_Right_Top_Top = content.Load <Texture2D>("64x64/Purple_Door_Right_Top_Top"); Texture2D Door_Left_Bot_Top = content.Load <Texture2D>("64x64/Purple_Door_Left_Bot_Top"); Texture2D Door_Mid_Bot_Top = content.Load <Texture2D>("64x64/Purple_Door_Mid_Bot_Top"); Texture2D Door_Right_Bot_Top = content.Load <Texture2D>("64x64/Purple_Door_Right_Bot_Top"); //Right Door Texture2D Door_Left_Top_Right = content.Load <Texture2D>("64x64/Purple_Door_Left_Top_Right"); Texture2D Door_Mid_Top_Right = content.Load <Texture2D>("64x64/Purple_Door_Mid_Top_Right"); Texture2D Door_Right_Top_Right = content.Load <Texture2D>("64x64/Purple_Door_Right_Top_Right"); Texture2D Door_Left_Bot_Right = content.Load <Texture2D>("64x64/Purple_Door_Left_Bot_Right"); Texture2D Door_Mid_Bot_Right = content.Load <Texture2D>("64x64/Purple_Door_Mid_Bot_Right"); Texture2D Door_Right_Bot_Right = content.Load <Texture2D>("64x64/Purple_Door_Right_Bot_Right"); //Bottom Door Texture2D Door_Left_Top_Bottom = content.Load <Texture2D>("64x64/Purple_Door_Left_Top_Bottom"); Texture2D Door_Mid_Top_Bottom = content.Load <Texture2D>("64x64/Purple_Door_Mid_Top_Bottom"); Texture2D Door_Right_Top_Bottom = content.Load <Texture2D>("64x64/Purple_Door_Right_Top_Bottom"); Texture2D Door_Left_Bot_Bottom = content.Load <Texture2D>("64x64/Purple_Door_Left_Bot_Bottom"); Texture2D Door_Mid_Bot_Bottom = content.Load <Texture2D>("64x64/Purple_Door_Mid_Bot_Bottom"); Texture2D Door_Right_Bot_Bottom = content.Load <Texture2D>("64x64/Purple_Door_Right_Bot_Bottom"); //Left Door Texture2D Door_Left_Top_Left = content.Load <Texture2D>("64x64/Purple_Door_Left_Top_Left"); Texture2D Door_Mid_Top_Left = content.Load <Texture2D>("64x64/Purple_Door_Mid_Top_Left"); Texture2D Door_Right_Top_Left = content.Load <Texture2D>("64x64/Purple_Door_Right_Top_Left"); Texture2D Door_Left_Bot_Left = content.Load <Texture2D>("64x64/Purple_Door_Left_Bot_Left"); Texture2D Door_Mid_Bot_Left = content.Load <Texture2D>("64x64/Purple_Door_Mid_Bot_Left"); Texture2D Door_Right_Bot_Left = content.Load <Texture2D>("64x64/Purple_Door_Right_Bot_Left"); //Carpet Texture2D Carpet_Top_Left = content.Load <Texture2D>("64x64/Carpet_Left_Top_Corner"); Texture2D Carpet_Top_Mid = content.Load <Texture2D>("64x64/Carpet_Top_Mid"); Texture2D Carpet_Top_Right = content.Load <Texture2D>("64x64/Carpet_Top_Right_Corner"); Texture2D Carpet_Left_Mid = content.Load <Texture2D>("64x64/Carpet_Left_Mid"); Texture2D Carpet_Left_Bot = content.Load <Texture2D>("64x64/Carpet_Left_Bot_Corner"); Texture2D Carpet_Bot_Mid = content.Load <Texture2D>("64x64/Carpet_Bot_Mid"); Texture2D Carpet_Bot_Right = content.Load <Texture2D>("64x64/Carpet_Bot_Right_Corner"); Texture2D Carpet_Right_Mid = content.Load <Texture2D>("64x64/Carpet_Right_Mid"); Texture2D Carpet_Mid = content.Load <Texture2D>("64x64/Carpet_Mid"); //Misc. Texture2D Brazier = content.Load <Texture2D>("64x64/Brazier"); Texture2D Rocks = content.Load <Texture2D>("64x64/Rocks"); Texture2D ShieldTop = content.Load <Texture2D>("64x64/Wall_Right_Top_Low_Shield"); Texture2D ShieldRight = content.Load <Texture2D>("64x64/Wall_Right_Right_Low_Shield"); Texture2D ShieldBot = content.Load <Texture2D>("64x64/Wall_Right_Bot_Low_Shield"); Texture2D ShieldLeft = content.Load <Texture2D>("64x64/Wall_Right_Left_Low_Shield"); Texture2D ShieldAndSwordTop = content.Load <Texture2D>("64x64/Wall_Right_Top_Low_SwordShield"); Texture2D ShieldAndSwordRight = content.Load <Texture2D>("64x64/Wall_Right_Right_Low_SwordShield"); Texture2D ShieldAndSwordBot = content.Load <Texture2D>("64x64/Wall_Right_Bot_Low_SwordShield"); Texture2D ShieldAndSwordLeft = content.Load <Texture2D>("64x64/Wall_Right_Left_Low_SwordShield"); Texture2D wall = content.Load <Texture2D>("Wall"); Texture2D ground = content.Load <Texture2D>("Ground"); Texture2D DoorFront = content.Load <Texture2D>("DoorFront1"); Texture2D Shop = content.Load <Texture2D>("Shop"); Texture2D Pedestal_Top = content.Load <Texture2D>("64x64/Pedestal_Top"); Texture2D Pedestal_Bot = content.Load <Texture2D>("64x64/Pedestal_Bot"); #endregion #region Added Textures to list AddTexture(wall); AddTexture(piller); AddTexture(ground); AddTexture(DoorFront); AddTexture(wallTopCorLeft); AddTexture(wallTopCorLeft2); AddTexture(wallTopLeft); AddTexture(wallTopLeft2); AddTexture(wallMidLeftTop); AddTexture(wallMidLeftLow); AddTexture(wallBotLeft2); AddTexture(wallBotLeft1); AddTexture(wallBotCorLeft1); AddTexture(wallBotCorLeft2); AddTexture(floorPattern1); AddTexture(wallBotLow); AddTexture(wallTopLow); AddTexture(wallBottomLeft1); AddTexture(wallBottomLeft2); AddTexture(wallBottomMiddle1); AddTexture(wallBottomMiddle2); AddTexture(wallBottomRight2); AddTexture(wallBottomRight1); AddTexture(wallCornerBottomRight1); AddTexture(wallCornerBottomRight2); AddTexture(wallLeftBotLow); AddTexture(wallRightBotLow); AddTexture(wallRightLeft1); AddTexture(wallRightLeft2); AddTexture(wallRightMiddle1); AddTexture(wallRightMiddle2); AddTexture(wallRightTop2); AddTexture(wallRightTop1); AddTexture(wallCornerTopRight1); AddTexture(wallCornerTopRight2); AddTexture(wallLeftRightLow); AddTexture(wallRightRightLow); AddTexture(wallTopRight1); AddTexture(wallTopRight2); AddTexture(wallTopMiddle1); AddTexture(wallTopMiddle2); AddTexture(wallTopLeft_1); AddTexture(wallTopLeft_2); AddTexture(wallLeftTopLow); AddTexture(wallRightTopLow); AddTexture(floorPattern2); AddTexture(Door_Left_Top_Top); AddTexture(Door_Mid_Top_Top); AddTexture(Door_Right_Top_Top); AddTexture(Door_Left_Bot_Top); AddTexture(Door_Mid_Bot_Top); AddTexture(Door_Right_Bot_Top); AddTexture(Door_Left_Top_Right); AddTexture(Door_Mid_Top_Right); AddTexture(Door_Right_Top_Right); AddTexture(Door_Left_Bot_Right); AddTexture(Door_Mid_Bot_Right); AddTexture(Door_Right_Bot_Right); AddTexture(Door_Left_Top_Bottom); AddTexture(Door_Mid_Top_Bottom); AddTexture(Door_Right_Top_Bottom); AddTexture(Door_Left_Bot_Bottom); AddTexture(Door_Mid_Bot_Bottom); AddTexture(Door_Right_Bot_Bottom); AddTexture(Door_Left_Top_Left); AddTexture(Door_Mid_Top_Left); AddTexture(Door_Right_Top_Left); AddTexture(Door_Left_Bot_Left); AddTexture(Door_Mid_Bot_Left); AddTexture(Door_Right_Bot_Left); AddTexture(Brazier); AddTexture(Rocks); AddTexture(ShieldTop); AddTexture(ShieldRight); AddTexture(ShieldBot); AddTexture(ShieldLeft); AddTexture(ShieldAndSwordTop); AddTexture(ShieldAndSwordRight); AddTexture(ShieldAndSwordBot); AddTexture(ShieldAndSwordLeft); AddTexture(Carpet_Top_Left); AddTexture(Carpet_Top_Mid); AddTexture(Carpet_Top_Right); AddTexture(Carpet_Left_Mid); AddTexture(Carpet_Left_Bot); AddTexture(Carpet_Bot_Mid); AddTexture(Carpet_Bot_Right); AddTexture(Carpet_Right_Mid); AddTexture(Carpet_Mid); AddTexture(Door_Left_Top_Entry); AddTexture(Door_Mid_Top_Entry); AddTexture(Door_Right_Top_Entry); AddTexture(Door_Left_Bot_Entry); AddTexture(Door_Mid_Bot_Entry); AddTexture(Door_Right_Bot_Entry); AddTexture(Pedestal_Top); AddTexture(Pedestal_Bot); #endregion }
public Movement_HandleCollision(GameWorld world) : base(world) { ExtraComponentRequirements = new ComponentType[] { typeof(ServerEntity) }; }
protected override bool Process(Player player, RealmTime time, string[] args) { Task.Factory.StartNew(() => GameWorld.AutoName(1, true)).ContinueWith(_ => GameServer.Manager.AddWorld(_.Result), TaskScheduler.Default); return(true); }
public static PlantInstanceTemplate FindClosestPlantRequiringInstance(LocalPlayer player, GameWorld world) { chunkQuads.Clear(); quadTreeCells.Clear(); plantList.Clear(); for (int i = 0; i < GameWorld.Get.ImmediateChunks.Count; i++) { chunkQuads.Add(GameWorld.Get.ImmediateChunks[i].PlantInstanceQuad); } // Find all individual quad tree cells which may be relevant for (int i = 0; i < chunkQuads.Count; i++) { quadTreeCells.AddRange(chunkQuads[i].FindNodesIntersecting(player.ColliderBounds)); } // Retrieve the trees from the relevant cells. for (int i = 0; i < quadTreeCells.Count; i++) { List <PlantInstanceTemplate> content = quadTreeCells[i].Content; if (content != null) { plantList.AddRange(content); } } // From here, the approach is just regular brute force on the reduced list. return(FindClosestPlantRequiringInstance(player, plantList)); // Bounds radiusBounds = new Bounds (player.Position, new Vector3 (player.ColliderRadius, player.ColliderRadius, player.ColliderRadius) * 2); // // // Sort out all irrelevant chunks, i.e. all which cannot contain a tree within collider radius. // // Relevant are all where a) the player currently is in or b) the collider radius intersects with the chunk bounds. // float squaredRadius = player.ColliderRadius * player.ColliderRadius; // var relevantChunks = world.WorldChunks.Where (wc => // wc.CurrentMode == ChunkMode.Immediate || wc.CurrentMode == ChunkMode.Primary // //&& wc.ChunkBounds.Intersects (radiusBounds)//wc.ChunkBounds.Contains (player.Position) || wc.ChunkBounds.Intersects (radiusBounds) // ); // // // Retrieve quadtrees of relevant chunks (generate if not yet available) // var chunkQuads = relevantChunks.Select (c => c.PlantInstanceQuad); // // // Find all individual quad tree cells which may be relevant // var quadtreeCells = chunkQuads.SelectMany (cq => cq.FindNodesIntersecting (radiusBounds)); // // // Retrieve the trees from the relevant cells. // var plantList = quadtreeCells.SelectMany (c => c.Content ?? Enumerable.Empty <PlantInstanceTemplate> ()); // // // From here, the approach is just regular brute force on the reduced list. // return FindClosestPlantRequiringInstance (player, plantList); }
public Oryx(GameWorld world) { this.world = world; TimedSpawn(); Init(); }
public HandleSpectatorCamRequests(GameWorld world, BundledResourceManager resourceManager) : base(world) { m_ResourceManager = resourceManager; m_Settings = Resources.Load <SpectatorCamSettings>("SpectatorCamSettings"); }
private void OnKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs args) { Keys key = (Keys)char.ToUpper(args.KeyChar); GameWorld.GetWorldInstance().GetLevel().PlayerController.GetKeyboardHandler().KeyPress(key); }
public UpdateSpectatorCam(GameWorld world) : base(world) { }
public SpinSystem(GameWorld gameWorld) : base(gameWorld) { }
public GunSystem(GameWorld world) : base(world) { }
protected static bool SimpleSpawn(ServerPlayer player, GameWorld map, ref Vector3F position, ref float rotation) { return(map.GetSpawn(ref player.Info.LastSpawnState.Position, ref player.Info.LastSpawnState.Azimuth)); }