Пример #1
0
        public void Initilize()
        {
            StartTime = DateTime.Now;

            //got to do this before the command list
            TagWrapper = new TagWrapper();
            World      = new World.World();
            Settings   = new Settings.Settings();


            CanMobDoSomething = new CanMobDoSomething.CanMobDoSomething();
            //ClassFactory = new ClassFactory();
            CommandList = new Commands.CommandList();
            //Counters = new PerformanceCounters.Counters();
            DefaultValues   = new DefaultValues.DefaultValues();
            Experience      = new Exp.Experience();
            Engine          = new Engine.Engine();
            FindObjects     = new FindObjects.FindObjects();
            FileIO          = new FileIO();
            GameDateTime    = new GameDateTime.GameDateTime(new Time());
            GuildAbilities  = new Guild.GuildAbilities();
            Logger          = new Logging.Logger();
            Map             = new Map.Map();
            MoneyToCoins    = new MoneyToCoins.MoneyToCoins();
            MultiClassBonus = new MultiClassBonus.MultiClassBonus();
            Notify          = new Notify.Notify();
            Parser          = new Commands.Parser();
            Random          = new Random.Random();
            TickTimes       = new TickTimes.TickTimes();
            Translator      = new Language.Translator(new Language.TranslatorAlgorithm());
            UpTime          = new UpTime.UpTime();
            //Serialization = new Serialization.XmlSerialization();
            Serialization = new Serialization.JsonSerialization();
        }
Пример #2
0
        public GameScene(SpaceGame owner) : base(owner)
        {
            world = new World.World((0, 0), (owner.ScreenWidth, owner.ScreenHeight));

            uiManager = new UIManager(owner);
            uiManager.uiElements.Add(new HUD(world.player as World.Entities.Player));
        }
Пример #3
0
        public override void Initialize()
        {
            base.Initialize();

            // Various markers for the networkmap
            Texture2D spinner01 = Content.Load <Texture2D>("Graphics/Textures/spinner01");
            Texture2D spinner02 = Content.Load <Texture2D>("Graphics/Textures/spinner02");
            Texture2D spinner03 = Content.Load <Texture2D>("Graphics/Textures/spinner03");
            Texture2D spinner04 = Content.Load <Texture2D>("Graphics/Textures/spinner04");
            Texture2D spinner05 = Content.Load <Texture2D>("Graphics/Textures/spinner05");
            Texture2D spinner06 = Content.Load <Texture2D>("Graphics/Textures/spinner06");
            Texture2D spinner07 = Content.Load <Texture2D>("Graphics/Textures/spinner07");
            Texture2D spinner08 = Content.Load <Texture2D>("Graphics/Textures/spinner08");

            _networkNodeSpinners = new Dictionary <string, Texture2D>()
            {
                { "ConnectedSpinner", spinner01 },
                { "PlayerSpinner", spinner02 },
                { "03", spinner03 },
                { "MissionSpinner", spinner04 },
                { "05", spinner05 },
                { "06", spinner06 },
                { "07", spinner07 },
                { "HoverSpinner", spinner08 },
            };

            _rnd          = new Random(DateTime.Now.Millisecond);
            _world        = World.World.GetInstance();
            _networkNodes = new List <NetworkNode>();
            GenerateMapNoOverlap(30);
            foreach (NetworkNode n in _networkNodes)
            {
                n.Initialize();
            }
        }
Пример #4
0
 /// <summary>
 /// Constructs a new RadioTransmitBarViewModel.
 /// </summary>
 /// <param name="world">The world into which to transmit messages.</param>
 public RadioTransmitViewModel(World.World world)
 {
     Debug.Assert(world != null);
     World       = world;
     ChannelImpl = 0;
     MessageImpl = string.Empty;
 }
Пример #5
0
        // Starts the server; Make sure to give the server a unique ID
        public bool Start(string brokerAddress, int brokerPort, string serverID)
        {
            // Create a new networking manager
            networkingManager = new NetworkingManager(attachedApplication);
            // Generate a new world
            attachedApplication.output.PrintLine("Generating new world...");
            world = new World.World(attachedApplication, new Random().Next());
            // Start the new world in a thread
            Thread worldThread = new Thread(world.Start);

            worldThread.Start();
            attachedApplication.output.PrintLine("Connecting to broker...");
            // Connect to the broker
            bool connectedToBroker = networkingManager.Connect(brokerAddress, brokerPort, serverID, 10);

            // If the connection was successful
            if (connectedToBroker)
            {
                attachedApplication.output.PrintLine("Connected!");
                // Setup the send and recieve topics
                recieveCommandsTopic = serverID + "/Recieve";
                networkingManager.Subscribe(recieveCommandsTopic);
                sendCommandsTopic = serverID + "/Send";
                // Add our OnRecieveCommand event to the networking manager so we can recieve messages
                networkingManager.MessageRecieved += OnRecieveCommand;
            }
            return(connectedToBroker);
        }
Пример #6
0
        public void Start()
        {
            World.World w = new World.World(30, 30, 10);

            //TODO Gameplay loop
            //alle creatures har en tur, dem med højest Speed går først (flere Creatures har samme Speed. skal finde en måde at give en tilfældig første tur osv.))

            // 1. prioritet: hvis der er et Creature i en Tile lige ved siden af mig, Hit()
            // 2. prioritet: hvis jeg ikke har et våben og jeg står ved siden af et, PickupAttack(). Hvis jeg ikke står ved siden af, bevæg mig imod det nærmeste våben.
            // 3. prioritet: hvis jeg ikke har et skjold og jeg står ved siden af et, PickupDefence(). Hvis jeg ikke står ved siden af, bevæg mig imod det nærmeste Skjold.
            // 4. prioritet: bevæg mig imod nærmeste fjende

            // using table state machine
            //IState stateMachine = new TableStateMachine();

            // using state machine pattern
            //IState stateMachine = new StateMachinePattern();

            //bool gameContinue = true;
            //while (gameContinue)
            //{
            //    foreach (var v in Creatures)
            //    {

            //    }
            //    StatesTypes nextMove = stateMachine.NextMove();

            //    gameContinue = w.DoNextMove(nextMove);

            //}

            //Console.WriteLine("You loose :-( ");
        }
Пример #7
0
        static public void Send(LobbyClient client)
        {
            client.Characters = Databases.CharacterTable.Select(c => c.AccountIndex == client.Account.Index);
            PacketOut Out = new PacketOut((uint)Opcodes.CHARACTER_LIST);

            Out.WriteByte((byte)client.Characters.Count);
            lock (Program.worldListener.Worlds)
            {
                foreach (CharacterEntry chr in client.Characters)
                {
                    Out.WriteByte(chr.Slot);
                    Out.WriteByte(chr.Faction);
                    Out.WriteByte(1);
                    Out.WriteUInt32Reverse((uint)chr.World);
                    World.World info = null;
                    Program.worldListener.Worlds.TryGetValue((uint)chr.World, out info);
                    if (info != null)
                    {
                        Out.WriteParsedString(info.Name, 32);
                    }
                    else
                    {
                        Out.WriteParsedString("(undefined)", 32);
                    }
                    Out.WriteParsedString(chr.Name, 32);
                }
            }
            client.Send(Out);
            if (client.Characters.Count <= 0)
            {
                WORLD_LIST.SendWorldList(client);
            }
        }
Пример #8
0
        public void PrepareDrawWater(World.World world)
        {
            if (NOWATER)
            {
                return;
            }

            var blending = BlendState.Additive;

            var water     = world.Water;
            var particles = water.Particles;

            Game.GraphicsDevice.SetRenderTarget(WaterRenderTarget);
            Game.GraphicsDevice.Clear(Color.Transparent);

            spriteBatch.Begin(SpriteSortMode.Deferred, blending);

            for (int i = 0; i < particles.Length; i++)
            {
                var pos = WorldToScreen(particles[i]);
                spriteBatch.Draw(MetaBallTexture, position: pos, origin: new Vector2(MetaBallRadius, MetaBallRadius));
            }

            spriteBatch.End();

            Game.GraphicsDevice.SetRenderTarget(null);
        }
Пример #9
0
        public void DrawWater(World.World world)
        {
            if (NOWATER)
            {
                return;
            }

            var waterDomainScreenPos = WorldToScreen(Vector2.Zero);

            WaterEffect.Parameters["WaterTexture"].SetValue(WaterRenderTarget);
            WaterEffect.Techniques[0].Passes[0].Apply();
            var oldRasterizerState = Game.GraphicsDevice.RasterizerState;

            Game.GraphicsDevice.RasterizerState = new RasterizerState
            {
                CullMode = CullMode.None,
            };
            var oldDepthState = Game.GraphicsDevice.DepthStencilState;

            Game.GraphicsDevice.DepthStencilState = new DepthStencilState
            {
                DepthBufferEnable      = false,
                DepthBufferWriteEnable = false
            };
            Game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, FullscreenQuad, 0, 2);
            Game.GraphicsDevice.DepthStencilState = oldDepthState;
            Game.GraphicsDevice.RasterizerState   = oldRasterizerState;
        }
Пример #10
0
        public Collision CheckCollision(ICollidable collider)
        {
            if (collider is World.World)
            {
                World.World world = (World.World)collider;

                int sx = (int)this.BoundingBox.Min.X - 1,
                    ex = (int)this.BoundingBox.Max.X + 1,
                    sy = (int)this.BoundingBox.Min.Y - 1,
                    ey = (int)this.BoundingBox.Max.Y + 1,
                    sz = (int)this.BoundingBox.Min.Z - 1,
                    ez = (int)this.BoundingBox.Max.Z + 1;

                for (int z = sz; z <= ez; z++)
                {
                    for (int y = sy; y <= ey; y++)
                    {
                        for (int x = sx; x <= ex; x++)
                        {
                            Collision collision;

                            if (!(world[x, y, z] is BlockAir) && (collision = Game.CollisionManager.GetCollision(world.GetBlock(x, y, z), this)) != null)
                            {
                                return(collision);
                            }
                        }
                    }
                }

                return(null);
            }

            return(new Collision(collider));
        }
Пример #11
0
        public int OnPipeExit(Ray posDir, int amount)
        {
            var pos           = posDir.FirstPos;
            var toSet         = Math.Min(amount, 1000);
            var existingBlock = World.GetBlock(pos);

            if (!(existingBlock is EmptyBlock) && !(existingBlock is WaterBlock))
            {
                return(0);
            }

            // Set the existing block if it's there, or add a new block.
            if (existingBlock is EmptyBlock)
            {
                existingBlock = World.SetBlock(typeof(WaterBlock), pos, toSet * 0.001f) as WaterBlock;
            }

            var waterBlock = existingBlock as WaterBlock;

            if (waterBlock.Water < toSet)
            {
                waterBlock.Water = toSet;
                World.WakeUp(pos);
            }
            waterBlock.PipeSupplied = true;
            return(toSet);
        }
Пример #12
0
 public Camera(World.World world, Viewport viewport)
 {
     this.world        = world;
     this.screenBounds = viewport.Bounds;
     Position          = Vector2.Zero;
     Zoom = 2.0f;
 }
Пример #13
0
        public List <PathLink> GetRoute(World.World world, Living living, Point origin, Point destination)
        {
            MasterLog.DebugWriteLine("Finding route from: " + origin.ToString());
            MasterLog.DebugWriteLine("Finding route to: " + destination.ToString());
            Position[]      path = this.Grid.GetPath(new Position(origin.X, origin.Y), new Position(destination.X, destination.Y));
            List <PathLink> ret  = new List <PathLink>();

            if (!world.Tiles[destination.X, destination.Y].IsWalkable)
            {
                throw new Exception("Destination not possible!");
            }

            if (path.Length < 1)
            {
                throw new Exception("Path not possible!");
            }

            int i      = 0;
            int length = path.Length - 1;

            while (i != length)
            {
                if (!world.Tiles[path[i].X, path[i].Y].IsWalkable)
                {
                    MasterLog.DebugWriteLine("Walking on unwalkable tile!");
                }

                ret.Add(new PathLink(new Point(path[i].X, path[i].Y), new Point(path[i + 1].X, path[i + 1].Y)));
                i++;
            }

            return(ret);
        }
Пример #14
0
            private static Chunk DeserializeChunk(Int3 chunkPos, World.World world, byte[] data)
            {
                var chk = new Chunk(chunkPos, world, Chunk.InitOption.AllocateUnique);

                chk.DeserializeFrom(data);
                return(chk);
            }
Пример #15
0
 private void Start()
 {
     world       = GameplayController.instance.World;
     stoneNearby = CheckNearbyResources(this.transform.position);
     if (stoneNearby.Count == 0)
     {
         SetBuildingEmpty(stones);
         this.maxWorkers = 0;
     }
 }
Пример #16
0
        public Game(int w, int h)
            : base(w, h)
        {
            Size = new Size(w, h);

            _renderMachine = new RenderMachine(w, h);
            _stopwatch     = new Stopwatch();

            World = new World.World();
        }
 public void Initialize(Tile myTile, World.World world)
 {
     theWorld = world;
     world.AddResource(this);
     placedTile = myTile;
     if (blocksBuilding)
     {
         placedTile.IsBuildable = false;
     }
 }
Пример #18
0
        /// <summary>
        /// Initializes this Character before it is added to the Shard for the first time.
        /// </summary>
        /// <param name="world">static world store</param>
        public override void Initialize(World.World world)
        {
            base.Initialize(world);

            // initialize default values
            DamageDoneArcaneMultiplier   = 1.0f;
            DamageDoneFrostMultiplier    = 1.0f;
            DamageDoneFireMultiplier     = 1.0f;
            DamageDoneNatureMultiplier   = 1.0f;
            DamageDoneShadowMultiplier   = 1.0f;
            DamageDoneHolyMultiplier     = 1.0f;
            DamageDonePhysicalMultiplier = 1.0f;

            UnitFlags |= UnitFlags.PvPUnit;

            // TODO: instead of 0x18 as described here, this field has value 0x28 for players. need to determine the difference
            UnitFlags2 |= UnitFlags2.Supportable;
            UnitFlags2 |= UnitFlags2.CanHaveAuras;

            RestState           = RestState.Normal;
            WatchedFactionIndex = -1;

            // get race definition for this character and assign related unit values
            RaceDefinition rd = world.RaceDefinitions[Race];

            DisplayID       = NativeDisplayID = rd.GetDisplayID(Sex);
            FactionTemplate = rd.FactionID;

            // get model definition for this character and assign related unit values
            ModelDefinition md = ModelDefinition.Default;

            if (world.ModelDefinitions.ContainsKey(DisplayID))
            {
                md = world.ModelDefinitions[DisplayID];
            }
            else
            {
                log.WarnFormat("model bounding info not found for player {0} with display id {1}", Name, DisplayID);
            }

            BoundingRadius = md.BoundingRadius * Scale;
            CombatReach    = md.CombatReach * Scale;

            // get player base stats and assign. probably not the best spot for this
            // TODO: get healthmax and manamax out of here
            CharacterBaseStats cbs = world.CharacterBaseStats[Race][Class][(byte)Level];

            HealthMax = Health = HealthBase = cbs.Health;
            ManaMax   = Mana = ManaBase = cbs.Mana;
            Strength  = cbs.Strength;
            Agility   = cbs.Agility;
            Stamina   = cbs.Stamina;
            Intellect = cbs.Intellect;
            Spirit    = cbs.Spirit;
        }
Пример #19
0
 /// <summary>
 /// Removes the physics body of the given entity from the physics world.
 /// </summary>
 public void RemoveEntity(Entity e, World.World worldState)
 {
     e.Dispose();
     worldState.RemoveEntity(e);
     if (e.PhysicsBody != null)
     {
         EntityIdByPhysicsBody.Remove(e.PhysicsBody);
         RemoveBody(e.PhysicsBody);
         e.PhysicsBody = null;
     }
 }
        public float OnPipeExit(Ray posDir, float amount)
        {
            var existingBlock = World.GetBlock(posDir.FirstPos) as EmptyBlock;

            if (existingBlock != null)
            {
                var target = World.FindPyramidPos(posDir.FirstPos);
                World.SetBlock(this.OriginType, target);
                return(1);
            }
            return(0);
        }
Пример #21
0
        private void HandleMovement(World.World world)
        {
            // Keyboard input
            if (InputManager.KeyboardState.IsKeyDown(Keys.Right) && !InputManager.KeyboardState.IsKeyDown(Keys.Left))
            {
                if (InputManager.LastKeyboardState.IsKeyUp(Keys.Right))
                {
                    Move(world);
                    frameCounter = 0;
                }

                HorizontalIndicatedDirection = HorizontalPlayerDirection.Right;
            }

            if (InputManager.KeyboardState.IsKeyDown(Keys.Left) && !InputManager.KeyboardState.IsKeyDown(Keys.Right))
            {
                if (InputManager.LastKeyboardState.IsKeyUp(Keys.Left))
                {
                    Move(world);
                    frameCounter = 0;
                }

                HorizontalIndicatedDirection = HorizontalPlayerDirection.Left;
            }

            if (InputManager.KeyboardState.IsKeyDown(Keys.Up) && !InputManager.KeyboardState.IsKeyDown(Keys.Down))
            {
                if (InputManager.LastKeyboardState.IsKeyUp(Keys.Up))
                {
                    Move(world);
                    frameCounter = 0;
                }

                VerticalIndicatedDirection = VerticalPlayerDirection.Up;
            }

            if (InputManager.KeyboardState.IsKeyDown(Keys.Down) && !InputManager.KeyboardState.IsKeyDown(Keys.Up))
            {
                if (InputManager.LastKeyboardState.IsKeyUp(Keys.Down))
                {
                    Move(world);
                    frameCounter = 0;
                }

                VerticalIndicatedDirection = VerticalPlayerDirection.Down;
            }

            if (frameCounter == frameLimit)
            {
                Move(world);
            }
        }
Пример #22
0
        public int OnPipeExit(Ray posDir, int amount)
        {
            // need a pyramid check, but for now just do down
            var existingBlock = World.GetBlock(posDir.FirstPos) as EmptyBlock;

            if (existingBlock != null)
            {
                var target = World.FindPyramidPos(posDir.FirstPos);
                World.SetBlock(this.OriginType, target);
                return(1);
            }
            return(0);
        }
Пример #23
0
 /// <summary>
 /// Constructs a new MainViewModel.
 /// </summary>
 /// <param name="world">The world being interacted with.</param>
 public MainViewModel(World.World world)
 {
     Debug.Assert(world != null);
     WorldImpl = world;
     RadioTransmitBarViewModelImpl = new RadioTransmitViewModel(world);
     BlinkClockSourceImpl          = new BlinkClockSource();
     TrainDetailViewModelImpl      = new TrainDetailViewModel();
     ChannelMaskImpl     = new ChannelMask();
     Messages            = new ObservableCollection <Message>();
     world.TrainEntered += OnTrainEntered;
     world.RadioRX      += OnRadioRX;
     world.RadioTX      += OnRadioTX;
 }
Пример #24
0
        /// <summary>
        /// Updates the ball state and preforms ball-related actions.
        /// </summary>
        /// <returns>Returns true if the ball has performed an action that finishes a player turn.</returns>
        public virtual bool Update(float elapsedSeconds, World.World worldState)
        {
            //bool ballMadeAction = false;
            if (!Ball.IsAlive)
            {
                Ball.IsAiming    = false;
                Ball.ShootCharge = 0f;
                Ball.IsCharging  = false;
            }
            else
            {
                var projectileInAir = (Weapon as Weapons.ChargedProjectileWeapon)?.ProjectileInAir;
                if (projectileInAir != null && !projectileInAir.Disposed)
                {
                    Game.Match.FocussedEntity = projectileInAir;
                }
                else if (Ball == Game.Match.ActivePlayer?.ActiveBall)
                {
                    Game.Match.FocussedEntity = Ball;
                }

                bool weaponSwitchAllowed = true;
                if (!(Game.Match.SessionLogic.Session.TurnState == TurnState.WaitingForEnd))
                {
                    Weapon?.Update(elapsedSeconds, KeyPressed, out ballMadeAction, out weaponSwitchAllowed);
                }
                //if (Ballz.The ().Match.SessionLogic.Session.UsePlayerTurns && ballMadeAction)
                else
                {
                    ballMadeAction      = false;
                    weaponSwitchAllowed = false;
                }
                CanSwitchWeapons &= weaponSwitchAllowed;

                if (Ball.IsCharging)
                {
                    Ball.ShootCharge += elapsedSeconds * 0.7f;
                    if (Ball.ShootCharge > 1f)
                    {
                        Ball.ShootCharge = 1f;
                    }
                }
                else
                {
                    Ball.ShootCharge = 0f;
                }

                JumpCoolDown -= elapsedSeconds;
            }
            return(ballMadeAction);
        }
Пример #25
0
 public Hero(string heroName, int health, int str, int agi, List <Armor> listOfArmor, List <Armor> listOfWeapons, List <Potion> potions, World.World worldHero, Map mapHero, int x, int y)
 {
     this.heroName      = heroName;
     this.health        = health;
     this.str           = str;
     this.agi           = agi;
     this.listOfArmor   = listOfArmor;
     this.listOfWeapons = listOfWeapons;
     this.potions       = potions;
     this.worldHero     = worldHero;
     this.mapHero       = mapHero;
     this.x             = x;
     this.y             = y;
 }
Пример #26
0
        public SingleplayerServer(World.World world)
        {
            _configuration = new ServerConfiguration
            {
                MOTD         = null,
                Singleplayer = true
            };

            World  = world;
            Server = new MultiPlayerServer(_configuration);

            world.BlockRepository = Server.BlockRepository;
            Server.AddWorld(world);
        }
Пример #27
0
        public override void Draw(GameTime gameTime)
        {
            //DrawSphere(Vector2.Zero, new Vector2(0.0f,1.0f));
            debugWorld = Game.World;
            foreach (Entity ball in debugWorld.Entities)
            {
                if (ball.Disposed)
                    continue;

                DrawSphere(ball.Position, ball.Rotation, ball.Radius, ball.PhysicsBody?.Awake ?? false);
            }
            drawTerrain();

            base.Draw(gameTime);
        }
Пример #28
0
        /// <summary>
        /// Checks whether or not a given building can be built at the given cursor location.
        /// </summary>
        /// <param name="world">The world to build in.</param>
        /// <param name="position">The position build at (will be adjusted by the buildings pivot).</param>
        /// <param name="building">The building to be built.</param>
        /// <returns>True if the position is a valid build location.</returns>
        public static bool CanBuildAt(World.World world, Vector2Int position, Building building)
        {
            var toCheck = PositionsUnderBuilding(position, building);

            foreach (var val in toCheck)
            {
                if (val.x < 0 || val.y < 0 || val.x > world.Width || val.y > world.Height)
                {
                    return(false);
                }
            }

            var validHeight = world[position].Height;

            return(toCheck.All(pos => world[pos].IsBuildable && Math.Abs(world[pos].Height - validHeight) < float.Epsilon));
        }
Пример #29
0
        /// <summary>
        /// Runs a single simulation step in the physics engine and syncs the state of the physics bodies back to the given world.
        /// </summary>
        public void PhysicsStep(World.World worldState, float elapsedSeconds)
        {
            // Update the physics world
            PhysicsWorld.Step(elapsedSeconds);
            worldState.Water.Step(worldState, elapsedSeconds);

            bool    useCustomGravity = worldState.StaticGeometry.HasGravityPoint;
            Vector2 gravityPoint     = worldState.StaticGeometry.GravityPoint;

            // Sync back the positions and velocities
            foreach (var e in worldState.Entities)
            {
                var body = e.PhysicsBody;

                if (e.PhysicsBody == null || e.Disposed)
                {
                    continue;
                }

                // Manually apply gravity
                if (useCustomGravity)
                {
                    body.ApplyForce(9.81f * Vector2.Normalize(gravityPoint - body.Position) * body.Mass);
                }
                else
                {
                    body.ApplyForce(9.81f * new Vector2(0, -1) * body.Mass);
                }

                e.Position = body.Position;
                e.Velocity = body.LinearVelocity;

                if (e is Ball)
                {
                    float eps = 0.01f;
                    if (e.Velocity.X > eps)
                    {
                        e.Rotation = (float)Math.PI * 0.5f;
                    }
                    else if (e.Velocity.X < -eps)
                    {
                        e.Rotation = -(float)Math.PI * 0.5f;
                    }
                }
            }
        }
Пример #30
0
        public void DrawWaterDebug(World.World world)
        {
            if (NOWATER || world.Water?.ParticleCount == 0)
            {
                return;
            }

            var blending = new BlendState();

            blending.AlphaSourceBlend      = Blend.SourceAlpha;
            blending.AlphaDestinationBlend = Blend.InverseSourceAlpha;
            blending.ColorSourceBlend      = Blend.SourceAlpha;
            blending.ColorDestinationBlend = Blend.InverseSourceAlpha;

            var water     = world.Water;
            var particles = water.Particles;

            VertexPositionColor[] lines = new VertexPositionColor[particles.Length * 6];

            for (int i = 0; i < particles.Length; i++)
            {
                var bottom = particles[i] + new Vector2(0, -DebugParticleSize);
                var right  = particles[i] + new Vector2(-DebugParticleSize, DebugParticleSize);
                var left   = particles[i] + new Vector2(DebugParticleSize, DebugParticleSize);
                lines[i * 6 + 0].Position = new Vector3(bottom, 0f);
                lines[i * 6 + 1].Position = new Vector3(right, 0f);
                lines[i * 6 + 2].Position = new Vector3(right, 0f);
                lines[i * 6 + 3].Position = new Vector3(left, 0f);
                lines[i * 6 + 4].Position = new Vector3(left, 0f);
                lines[i * 6 + 5].Position = new Vector3(bottom, 0f);

                lines[i * 6 + 0].Color = Color.White;
                lines[i * 6 + 1].Color = Color.White;
                lines[i * 6 + 2].Color = Color.White;
                lines[i * 6 + 3].Color = Color.White;
                lines[i * 6 + 4].Color = Color.White;
                lines[i * 6 + 5].Color = Color.White;
            }

            Game.GraphicsDevice.RasterizerState = new RasterizerState
            {
                CullMode = CullMode.None
            };
            Game.GraphicsDevice.DrawUserPrimitives(PrimitiveType.LineList, lines, 0, particles.Length * 3);
        }
Пример #31
0
        public void Initilize()
        {
            StartTime = DateTime.Now;

            //got to do this before the command list
            TagWrapper = new TagWrapper();
            World      = new World.World();
            Settings   = new Settings.Settings();
            Translator = new Language.Translator(new Language.TranslatorAlgorithm());



            CanMobDoSomething       = new CanMobDoSomething.CanMobDoSomething();
            CommandList             = new Commands.CommandList();
            Counters                = new Counters();
            CountersLog             = new List <ICounters>();
            DefaultValues           = new DefaultValues.DefaultValues();
            Engine                  = new Engine.Engine();
            EvaluateLevelDifference = new EvaluateLevelDifference();
            Experience              = new Exp.Experience();
            FileIO                  = new Shared.FileIO.FileIO();
            FindObjects             = new FindObjects.FindObjects();
            GameDateTime            = new InGameDateTime(new Time());
            GameStats               = new GameStats();
            GuildAbilities          = new Guild.GuildAbilities();
            Logger                  = new Logging.Logger();
            Map                 = new Map.Map();
            MoneyToCoins        = new MoneyToCoins.MoneyToCoins();
            MultiClassBonus     = new MultiClassBonus.MultiClassBonus();
            Notify              = new Notify.Notify();
            Parser              = new Commands.Parser();
            Random              = new Random.Random();
            RandomDropGenerator = new Random.RandomDropGenerator();
            Serialization       = new Serialization.JsonSerialization();
            StringManipulator   = new StringManuplation.StringManipulator();
            TickTimes           = new TickTimes.TickTimes();
            Time                = new Time();
            UpTime              = new UpTime.UpTime();
            ValidateAsset       = new ValidateAsset.ValidateAsset();



            //do these last as they depend on things above
            WeaponId = new WeaponId();
        }
Пример #32
0
 public override void Update(GameTime gameTime)
 {
     debugWorld = Game.World;
     updateTerrain();
     base.Update(gameTime);
 }
Пример #33
0
 public override void Initialize()
 {
     debugWorld = Game.World;
     base.Initialize();
 }
Пример #34
0
 public void HandleMessage(object sender, Messages.Message msg)
 {
     if (msg.Kind == Message.MessageType.InputMessage)
     {
         InputMessage ipmsg = (InputMessage)msg;
         if (ipmsg.Kind == InputMessage.MessageType.ControlsConsole && ipmsg.Pressed.HasValue && ipmsg.Pressed.Value)
         {
             Enabled = !Enabled;
             Visible = !Visible;
             debugWorld = Game.World;
         }
     }
 }