Exemplo n.º 1
0
        //Testing TODO List:
        //Find Maximum objects count to turn into constant for GameObjects array initialization, currently capped at 512 for dev
        //Further map out object array structure
        //Code TODO List:
        //TODO: Main Class that initializes the main thread
        //TODO: Object Properties Poker
        //TODO: Tag Properties Poker
        //TODO: LocalPlayer info thread
        //BugFixes TODO List:
        //TODO: doThreadedTagScan runs infinitely, using more resources
        public Goldputsch(GameProcess ElDorado)
        {
            //Initializa game handle
            this.ElDorado = ElDorado;

            //Memory Variables
            TlsAddress = this.ElDorado.TlsAddress;
            objectArrayAddress = getObjectArrayAddress(this.TlsAddress);
            currentTagArrayAddress = ElDorado.Memory.ReadUInt32(TagAddressArrayPointerAddress);
            MAX_TAGS = ElDorado.Memory.ReadUInt16(MaxTagCountAddress);

            //Initialize data structures
            activeObjects = new GameObjects(MAX_OBJECTS, objectArrayAddress);
            activeTags = new GameTags(MAX_TAGS, currentTagArrayAddress);

            //Initialize Encyclopedia
            MetaCache = new Encyclopedia();

            //Initialize controls
            gameCanScan = true;

            //Initialize Threads
            objectScanThread = new Thread(() => { doThreadedObjectScan(); });
            objectScanThread.IsBackground = true;
            objectScanThread.Start();

            tagScanThread = new Thread(() => { doThreadedTagScan(); });
            tagScanThread.IsBackground = true;
            tagScanThread.Start();
        }
Exemplo n.º 2
0
		internal override void Init(GameObjects.GOEntry entry, GameObjects.GOTemplate templ)
		{
			base.Init(entry, templ);

			m_goTransportEntry = Entry as GOMOTransportEntry;
			TransportMgr.TransportEntries.TryGetValue(m_entry.GOId, out m_transportEntry);
			m_isMOTransport = m_goTransportEntry != null && m_transportEntry != null;
		}
Exemplo n.º 3
0
 public bool AddEventEffect(GameObjects.TroopDetail.EventEffect.EventEffect e)
 {
     if (this.EventEffects.ContainsKey(e.ID))
     {
         return false;
     }
     this.EventEffects.Add(e.ID, e);
     return true;
 }
Exemplo n.º 4
0
        public void LoadObject(GameObjects type, Drawable tile)
        {
            Bitmap bitmap = Bitmap.CreateBitmap (objectSize, objectSize, Bitmap.Config.Argb8888);
            Canvas canvas = new Canvas (bitmap);

            tile.SetBounds (0, 0, objectSize, objectSize);
            tile.Draw (canvas);

            bitmaps [(int)type] = bitmap;
        }
Exemplo n.º 5
0
        public void Execute(GameObjects.Mob.IMob mob, string input)
        {
            if (mob is ServerPlayer)
                {
                    var player = mob as ServerPlayer;

                    mob.Send(new InformationalMessage("Disconnecting."));
                    player.Disconnect();
                }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Remove expired objects and those that flew away.
        /// </summary>
        private void ProcessExpiredAndAwayObjects()
        {
            var shipPos = _spaceship.GetComponent <PositionComponent>();

            // AsParallel seem to be slower in most cases (except when there are A LOT of objects)
            var objs = GameObjects
                       //.AsParallel()
                       .Where(x => x.IsExpired() || IsFlyByObject(x, shipPos)).ToArray();

            foreach (var toRemove in objs)
            {
                _gameObjects.Remove(toRemove);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Calls Initialise on the screen Managers and ScriptManager.
        /// Adds Initial Scripts to the ScriptManager
        /// </summary>
        public override void Initialise()
        {
            CheckShouldInitialise();

            Lights.Initialise();
            EnvironmentObjects.Initialise();
            GameObjects.Initialise();
            InGameUIObjects.Initialise();
            ScreenUIObjects.Initialise();

            Modules.Initialise();

            base.Initialise();
        }
Exemplo n.º 8
0
 public void Update(GameTime gameTime)
 {
     currState = Mouse.GetState().LeftButton;
     if (prevLKMState == ButtonState.Released && currState == ButtonState.Pressed)
     {
         Point      p = Mouse.GetState().Position;
         GameObject go;
         if (GameObjects.GetInstance().TryGetObjectAtPoint(p, out go))
         {
             go.OnClick();
         }
     }
     prevLKMState = currState;
 }
Exemplo n.º 9
0
 //下船,传入人物的name,把passenger中的改人物的位置置为空,以GameObject返回这个人物,否则返回null
 public GameObjects GetOffBoat(string passenger_name)
 {
     for (int i = 0; i < passenger.Length; i++)
     {
         if (passenger[i] != null && passenger[i].getName() == passenger_name)
         {
             GameObjects charactorCtrl = passenger[i];
             passenger[i] = null;
             return(charactorCtrl);
         }
     }
     Debug.Log("Cant find passenger in boat: " + passenger_name);
     return(null);
 }
Exemplo n.º 10
0
        private static void OnDraw(EventArgs args)
        {
            if (!Tracker.Menu["clone.track"]["show.clone"])
            {
                return;
            }

            foreach (var hero in GameObjects.Get <Obj_AI_Hero>().Where(o => o.IsVisible && o.IsEnemy && !o.IsDead && (o.ChampionName.ToLower().Contains("yorick") ||
                                                                                                                      o.ChampionName.ToLower().Contains("leblanc") || o.ChampionName.ToLower().Contains("monkeyking") || o.ChampionName.ToLower().Contains("shaco")) &&
                                                                       o.ServerPosition.IsOnScreen()))
            {
                Drawing.DrawCircle(hero.Position, 100, Color.LawnGreen);
            }
        }
Exemplo n.º 11
0
        private void DrawSceneToRenderTarget(GameTime gameTime)
        {
            Engine.Instance.GraphicsDevice.SetRenderTarget(RenderTarget);
            Engine.Instance.GraphicsDevice.Clear(Color.Transparent);

            spriteBatch.Begin();
            foreach (GameObject gameObject in GameObjects.Where(x => x.Visible))
            {
                gameObject.Draw(spriteBatch, gameTime);
            }
            spriteBatch.End();

            Engine.Instance.GraphicsDevice.SetRenderTarget(null);
        }
Exemplo n.º 12
0
 public IEnumerable <GameObject> GetNearbyGameObjects(Vector2 position, float radius, Func <GameObject, bool> match = null)
 {
     if (match == null)
     {
         return(GameObjects
                .Where(x => Vector2.DistanceSquared(position, x.Position) < radius * radius));
     }
     else
     {
         return(GameObjects
                .Where(x => Vector2.DistanceSquared(position, x.Position) < radius * radius)
                .Where(match));
     }
 }
Exemplo n.º 13
0
        public void insert(GameObject gameObject)
        {
            if (Nodes[0] != null)
            {
                List <int> indexes = GetIndex(gameObject);

                for (int i = 0; i < indexes.Count; i++)
                {
                    int index = indexes[i];
                    if (index != -1)
                    {
                        Nodes[index].insert(gameObject);
                        return;
                    }
                }
            }

            GameObjects.Add(gameObject);

            if (GameObjects.Count > MaxObjects && Level < MaxLevels)
            {
                if (Nodes[0] == null)
                {
                    split();
                }

                int i = 0;

                while (i < GameObjects.Count)
                {
                    List <int> indexes = GetIndex(GameObjects[i]);
                    GameObject obj     = GameObjects[i];

                    for (int j = 0; j < indexes.Count; j++)
                    {
                        int index = indexes[j];
                        if (index != -1)
                        {
                            Nodes[index].insert(obj);
                            GameObjects.Remove(obj);
                        }
                        else
                        {
                            i++;
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
        private void OnDailyTick()
        {
            foreach (var trigger in Triggers)
            {
                foreach (var gameObject in GameObjects.Where(go => go.GameObjectType == trigger.InitiatorType))
                {
                    if (gameObject.ToHero() == Hero.MainHero)
                    {
                        continue;
                    }

                    if (!trigger.CanStart(gameObject))
                    {
                        continue;
                    }

                    PlotManager.Add(trigger.DoStart(gameObject));
                }
            }


            foreach (var plot in PlotManager.GetPlots())
            {
                if (plot.CanAbort())
                {
                    plot.DoAbort();
                    PlotManager.Remove(plot);
                }
                else
                {
                    var behavior = plot.ActiveGoal.Behavior;
                    if (!behavior.CanEnd())
                    {
                        continue;
                    }

                    behavior.DoEnd();

                    if (plot.IsEndGoal())
                    {
                        PlotManager.Remove(plot);
                    }
                    else
                    {
                        plot.SetNextGoal();
                    }
                }
            }
        }
Exemplo n.º 15
0
        private void ResetGame()
        {
            // Create a single text object
            GameObjects.Clear();

            // Add a text object to display the accelerometer vector
            _accText             = new TextObject(this, Fonts["Kootenay"], new Vector2(20, 100), "Accelerometer data:");
            _accText.SpriteColor = Color.DarkBlue;
            GameObjects.Add(_accText);

            // Add a ball to roll around the screen
            _accBall        = new BallObject(this, new Vector2(240, 400), Textures["ShinyBall"]);
            _accBall.Origin = new Vector2(_accBall.SpriteTexture.Width, _accBall.SpriteTexture.Height) / 2;
            GameObjects.Add(_accBall);
        }
Exemplo n.º 16
0
        //This method usually spawns a well. It sometimes not spawning a well has 2 reasons:
        //#1: To add a little bit of randomness to the game.
        //#2: So the game screen doesn't get too cluttered. (If it doesn't find an empty space, it doesn't spawn)
        public void SpawnWell()
        {
            double xc = Random.NextDouble() * 5000.0;
            double yc = Random.NextDouble() * 5000.0;

            if (!NearOtherObject(xc, yc))
            {
                Well well = new Well(xc, yc);
                well.TicksLeft = WellDestabFreq + Random.Next(1001);
                StableWells.Add(well);
                GameObjects.Add(well);
                UpdateAnimationEvent(this, new AnimationEventArgs(false, AnimationType.Stable, StableWells.Count, 0, 0));
                well.ShockWave = new Shockwave(this, well);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Reset the game
        /// </summary>
        private void ResetGame()
        {
            // Clear any existing objects
            GameObjects.Clear();

            // Add the ground
            GameObjects.Add(new GroundObject(this, Textures["Ground"]));

            // Add the fairy
            GameObjects.Add(new FairyObject(this, Textures["Fairy"], MathHelper.ToRadians(2.0f)));
            GameObjects.Add(new FairyObject(this, Textures["Fairy"], MathHelper.ToRadians(-3.0f)));

            // Add the camera to the game
            Camera = new CameraObject(this);
        }
Exemplo n.º 18
0
    public GameObjects AddObject(string strTemplateKey)
    {
        ObjectTemplateData templateData =
            GetTemplate(strTemplateKey);

        if (templateData == null)
        {
            return(null);
        }

        GameObjects gameObjects = new GameObjects();

        gameObjects.SetTemplate(templateData);
        return(gameObjects);
    }
Exemplo n.º 19
0
        public override void PuckCollision(GameObject obj)
        {
            if (obj == null || CurrentStage != GameStage.Playing || !obj.Active)
            {
                return;
            }

            obj.Active = false;

            _scoreHUD.Value += 1;
            PlayAudio(_bonusSoundUri);
            AddTarget();

            GameObjects.Remove(obj);
        }
Exemplo n.º 20
0
        public static void Render(int centerTileX, int centerTileY, int renderRange)
        {
            Buffer.Bind();

            GL.ClearColor(Color.Black);
            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
            GL.Enable(EnableCap.DepthTest);

            Terrain.Render(centerTileX, centerTileY, renderRange);
            Buildings.Render(centerTileX, centerTileY, renderRange);

            GameObjects.Render();

            Buffer.RenderTexture();
        }
Exemplo n.º 21
0
        /// <summary>
        /// Reset this game mode
        /// </summary>
        public override void Reset()
        {
            int ballSpeed;

            base.Reset();

            // Get the ball speed
            ballSpeed = SettingsManager.GetValue("Speed", 1);

            // Add some balls, observing the speed
            for (int i = 0; i < 10; i++)
            {
                GameObjects.Add(new BallObject(_game, _game.Textures["Ball"], ballSpeed));
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// Queues up any music for this screen
        /// </summary>
        public override void Begin()
        {
            base.Begin();

            Lights.Begin();
            EnvironmentObjects.Begin();
            GameObjects.Begin();
            InGameUIObjects.Begin();
            ScreenUIObjects.Begin();

            Modules.Begin();

            AddMusic();
            AddInitialCommands();
        }
Exemplo n.º 23
0
        void AddAndRemoveObjects()
        {
            foreach (GameObject gameObject in m_AddedGameObjects)
            {
                GameObjects.Add(gameObject);
            }

            foreach (GameObject gameObject in m_RemovedGameObjects)
            {
                GameObjects.Remove(gameObject);
            }

            m_AddedGameObjects.Clear();
            m_RemovedGameObjects.Clear();
        }
Exemplo n.º 24
0
 private void LoadAssetBundle(string assetBundleLocation)
 {
     try
     {
         AssetBundle = AssetBundle.LoadFromFile(assetBundleLocation);
         foreach (GameObject gameObject in AssetBundle.LoadAllAssets <GameObject>())
         {
             GameObjects.Add(gameObject.name, gameObject);
         }
     }
     catch (Exception e)
     {
         Utilities.Logger.Error($"Failed to load {AssetBundleName} : {e.ToString()}");
     }
 }
Exemplo n.º 25
0
        private static void OnDoCastDelayedLC(AIBaseClientProcessSpellCastEventArgs args)
        {
            if (SP)
            {
                AAPassive = false;
            }
            else
            {
                AAPassive = Player.HasBuff("LucianPassiveBuff");
            }
            if (args.Target is AIMinionClient && args.Target.IsValid)
            {
                if (Orbwalker.ActiveMode == OrbwalkerMode.LaneClear && Player.ManaPercent > LMinMana)
                {
                    var Minions = GameObjects.GetMinions(Player.GetRealAutoAttackRange(), MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.Health);
                    if (Minions[0].IsValid && Minions.Count != 0)
                    {
                        if (!LT)
                        {
                            return;
                        }

                        if (E.IsReady() && !AAPassive && LE)
                        {
                            E.Cast(Player.Position.Extend(Game.CursorPos, 70));
                        }
                        if (Q.IsReady() && (!E.IsReady() || (E.IsReady() && !LE)) && LQ != 0 && !AAPassive)
                        {
                            var QMinions  = GameObjects.GetMinions(Q.Range);
                            var exminions = GameObjects.GetMinions(Q1.Range);
                            foreach (var Minion in QMinions)
                            {
                                var QHit = new Geometry.Rectangle(Player.Position, Player.Position.Extend(Minion.Position, Q1.Range), Q1.Width);
                                if (exminions.Count(x => !QHit.IsOutside(x.Position.ToVector2())) >= LQ)
                                {
                                    Q.Cast(Minion);
                                    break;
                                }
                            }
                        }
                        if ((!E.IsReady() || (E.IsReady() && !LE)) && (!Q.IsReady() || (Q.IsReady() && LQ == 0)) && LW && W.IsReady() && !AAPassive)
                        {
                            W.Cast(Minions[0].Position);
                        }
                    }
                }
            }
        }
Exemplo n.º 26
0
        public void Update(GameTime gameTime)
        {
            ICollection <IGameObject>       renderedObjects = GameObjects.Where(e => _camera.IsRendered(e, 15)).ToList();
            ICollection <IPhysicsObject>    toDoPhysics     = InterfaceListUtil.GameObjectListToPhysicsObjectList(renderedObjects).Where(e => e.PhysicsDuringLesserState >= CurrentWorldState).ToList();
            ICollection <ICollidableObject> toDoCollisions  = InterfaceListUtil.GameObjectListToCollidableObjectList(renderedObjects).Where(e => e.CollideDuringLesserState >= CurrentWorldState).ToList();

            foreach (IPlayer player in Players)
            {
                if (player.Position.X > _camera.CameraPosition.X + _camera.Viewport.Width / _camera.Zoom - 22)
                {
                    player.Position = new Vector2(_camera.CameraPosition.X + _camera.Viewport.Width / _camera.Zoom - 22, player.Position.Y);
                }
                else if (player.Position.X < _camera.CameraPosition.X + 6)
                {
                    player.Position = new Vector2(_camera.CameraPosition.X + 6, player.Position.Y);
                }

                if (player != Players[0] && player.Position.Y >
                    _camera.CameraPosition.Y + _camera.Viewport.Height / _camera.Zoom)
                {
                    player.Position = Players[0].Position;
                }
            }
            ICollection <IGameObject> toBeUpdated = GameObjects.Where(e => _camera.IsRendered(e) && e.UpdateDuringLesserState >= CurrentWorldState).ToList();

            Physics.DoPhysics(toDoPhysics, gameTime);
            CollisionHandler.Instance.HandleCollisions(toDoCollisions);
            foreach (IGameObject gameObject in toBeUpdated)
            {
                gameObject.Update();
            }
            _camera.Update();

            if (SoundManager.Instance.GetSoundEffect("obtainItem").State.ToString().Equals("Stopped") &&
                SoundManager.Instance.GetSoundEffect("brinstarLevel").State.ToString().Equals("Paused")
                )
            {
                SoundManager.Instance.ResumeSong("brinstarLevel");
                SetWorldState(WorldUtil.WorldState.Playing);
            }

            _timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds;
            if (_timeSinceLastFrame > MillisecondsPerFrame)
            {
                _timeSinceLastFrame = 0;
                UpdateFrames();
            }
        }
Exemplo n.º 27
0
        private static void HarassLogic()
        {
            if (mainMenu["Harass"].GetValue <MenuSlider>("mana%").Value <= GameObjects.Player.ManaPercent)
            {
                var target = TargetSelector.GetTarget(E.Range, DamageType.Magical);
                if (!target.IsValidTarget())
                {
                    return;
                }
                if (W.IsReady() && mainMenu["Harass"].GetValue <MenuBool>("Wuse").Enabled&& target.IsValidTarget(500))
                {
                    W.Cast();
                }
                if (Q.IsReady() && mainMenu["Harass"].GetValue <MenuBool>("Q1use").Enabled)
                {
                    CastQ1();
                }
                if (Q.IsReady() && mainMenu["Harass"].GetValue <MenuBool>("Quse").Enabled)
                {
                    target = TargetSelector.GetTarget(Q.Range + 500, DamageType.Physical);
                    var allMinion = GameObjects.GetMinions(target.Position, Q.Range, MinionTypes.All, MinionTeam.Enemy);
                    if (target.IsValidTarget(Q.Range))
                    {
                        Q.Cast(target);
                    }
                    var nearestMinion =
                        allMinion.Where(
                            minion =>
                            minion.Distance(ObjectManager.Player) <= target.Distance(ObjectManager.Player) &&
                            target.Distance(minion) < 450)
                        .OrderBy(minion => minion.Distance(ObjectManager.Player))
                        .FirstOrDefault();
                    {
                        if (nearestMinion != null && nearestMinion.IsValidTarget(Q.Range))
                        {
                            Q.CastOnUnit(nearestMinion);
                        }
                    }
                }



                if (E.CanCast(target) && mainMenu["Harass"].GetValue <MenuBool>("Euse").Enabled)
                {
                    E.Cast(target);
                }
            }
        }
Exemplo n.º 28
0
        public void i_get_no_items_back()
        {
            using (var gameObjects = new GameObjects())
            {
                //prepare
                var expectedMessage = "After searching the room you find nothing";

                gameObjects.Player.GetCurrentRoom().RemoveAllItems();

                //execute
                var commandOutput = Command.Get(gameObjects, "search");

                //assert
                Assert.Equal(expectedMessage, commandOutput.Output);
            }
        }
Exemplo n.º 29
0
        public void NewTarget(Vector3D position)
        {
            GameObject newTarget      = new GameObject();
            var        targetMaterial = new ModelMaterial()
            {
                TextureFile = "Target.3ds.jpg"
            };

            newTarget.ObjectType      = "Target";
            newTarget.Active          = true;
            newTarget.Position        = position;
            newTarget.Model.ModelFile = "target.3ds";
            newTarget.Model.Materials.Add(targetMaterial);

            GameObjects.Add(newTarget);
        }
Exemplo n.º 30
0
 private bool disposedValue = false; // 偵測多餘的呼叫
 protected override void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (disposing)
         {
             EffectObjects.Clear();
             GameObjects.Clear();
             UIObjects.Clear();
             RoundTimer.Enabled = false;
             RoundTimer.Dispose();
         }
         disposedValue = true;
     }
     base.Dispose(disposing);
 }
Exemplo n.º 31
0
        /// <summary>
        /// 回合動作
        /// </summary>
        protected virtual void Round()
        {
            OnBeforeRound();
            EffectObjects.AllDoBeforeRound();
            GameObjects.AllAction();
            EffectObjects.AllDoAfterRound();
            OnAfterRound();

            UIObjects.AllAction();
            EffectObjects.AllSettlement();

            GameObjects.ClearAllDead();
            UIObjects.ClearAllDead();
            EffectObjects.ClearAllDisabled();
            Drawing();
        }
Exemplo n.º 32
0
        public void Load()
        {
            if (Index > NovelInfo.Count - 1)
            {
                return;
            }
            GameObjects.RemoveAll(gameObject => gameObject.Tags.Contains("initObject"));
            var objects = NovelInfo[Index].Init(this);

            foreach (var obj in objects)
            {
                obj.Tags.Add("initObject");
            }

            GameObjects.AddRange(objects);
        }
Exemplo n.º 33
0
    void Start()
    {
        GO = this;
        // players = new GameObject[numPlayers,4];

        // debugPlayer2 = GameObject.Find("Player10");
        //
        // if (debugPlayer2 == null)
        //     Debug.Log("Cant find Player");
        //
        // // Assigning Player Variables using Find
        // for (int i = 0; i < numPlayers; i++)
        //     for (int j = 0; j < 4; j++)
        //         if ( !(i == 0 && j == 0))
        //             players[i, j] = GameObject.Find($"Player{i}{j}");
    }
Exemplo n.º 34
0
        public void i_get_the_location_weapon_and_inventory_items()
        {
            using (var gameObjects = new GameObjects())
            {
                //prepare
                var expectedMessage = "You are in the EntranceThis is the entrance of the cave." +
                                      "You entered from the door to the south. There is an entrance to the north" +
                                      "You have no weapon equippedYou have nothing in your inventory";

                //execute
                var commandOutput = Command.Get(gameObjects, "status");

                //assert
                Assert.Equal(expectedMessage, CleanText.Run(commandOutput.Output));
            }
        }
Exemplo n.º 35
0
        // Life cycle.

        private void Start()
        {
            // Validate steady references.
            GameObjects.ValidateReference(map, nameof(map));
            GameObjects.ValidateReference(unitSystem, nameof(unitSystem));

            // Setup unit system event handlers.
            unitSystem.ExecuteWhenBuilt(this, () => {
                unitSystemPresentation = unitSystem.Presentation;
                currentState           = unitSystemPresentation.State;
                foreach (var unit in unitSystemPresentation)
                {
                    UpdateNode(unit);
                }
            });
        }
Exemplo n.º 36
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="n">Name</param>
        /// <param name="mID">ModelID</param>
        /// <param name="hP">Hit points</param>
        /// <param name="bD">Base damage</param>
        /// <param name="s">Speed(x,y)</param>
        /// <param name="r">radius</param>
        /// <param name="p">Start position</param>
        /// <param name="aiMode">AI</param>
        /// <param name="l">loot gold</param>
        /// <param name="x">xp when killed</param>
        /// <param name="sc">score</param>
        public Enemy(string n, bool anim, int mID, int hP, int bD, Vector2 s, int r, Vector3 p, GameObjects.EnemyHandler.AI aiMode, int l, int x, int sc, int partSysId)
        {
            alignmentsList = new List<Spell.Alignments>();
            imuneAlignments = new List<Spell.Alignments>();

            Random rndSpeed = new Random();

            particleSystemId = partSysId;
            speed = (float)(s.X + (rndSpeed.NextDouble() * s.Y));
            baseDamage = bD;
            modelID = mID;
            position = p;
            active = true;
            radius = r;
            ai = aiMode;
            loot = l;
            xp = x;
            score = sc;
            health = hP;
            maxHealth = hP;
            name = n;
            isDOT = false;
            animated = anim;
        }
Exemplo n.º 37
0
 public void AddGameObject(GameObjects.GameObject gameObject)
 {
     if (CanPlaceGameObject(gameObject.Rect))
     {
         gameObject.LoadContent(ScreenManager.Content);
         gameObjects.Add(gameObject);
         mapGameObjects.Add(gameObject.Clone() as GameObjects.GameObject);
     }
     else
     {
         // Play area taken sound?
     }
 }
Exemplo n.º 38
0
 public static void notifyParticleSpawn(Champion source, GameObjects.Target target, string particleName)
 {
     var sp = new SpawnParticle(source, target, particleName, Game.GetNewNetID());
     PacketHandlerManager.getInstace().broadcastPacket(sp, Channel.CHL_S2C);
 }
Exemplo n.º 39
0
        public SpawnParticle(Champion owner, GameObjects.Target t, string particle, int netId) : base(PacketCmdS2C.PKT_S2C_SpawnParticle, owner.getNetId())
        {
            buffer.Write((short)1); // number of particles
            buffer.Write(owner.getChampionHash());
            buffer.Write(RAFManager.getInstance().getHash(particle));
            buffer.Write((int)0x00000020); // flags ?
            buffer.Write((int)0); // unk
            buffer.Write((short)0); // unk
            buffer.Write((short)1); // number of targets ?
            buffer.Write(owner.getNetId());
            buffer.Write(netId); // Particle net id ?
            buffer.Write(owner.getNetId());

            if (t.isSimpleTarget())
                buffer.Write((int)0);
            else
                buffer.Write((t as GameObject).getNetId());

            buffer.Write((int)0); // unk

            for (var i = 0; i < 3; ++i)
            {

                buffer.Write((short)((t.getX() - MAP_WIDTH) / 2));
                buffer.Write(50.0f);
                buffer.Write((short)((t.getY() - MAP_HEIGHT) / 2));
            }

            buffer.Write((int)0); // unk
            buffer.Write((int)0); // unk
            buffer.Write((int)0); // unk
            buffer.Write((int)0); // unk
            buffer.Write(1.0f); // unk

        }
Exemplo n.º 40
0
Arquivo: Portal.cs Projeto: jariz/jZm
 internal void trigger(Portal p, GameObjects.Player pp)
 {
     if (PortalTriggered != null)
         PortalTriggered(p, pp);
 }
Exemplo n.º 41
0
 public void ChangeFaction(GameObjects.Faction faction)
 {
     this.Status = PersonStatus.Normal;
     this.YearJoin = base.Scenario.Date.Year;
     this.InitialLoyalty();
 }
Exemplo n.º 42
0
 public void SetObject(GameObjects tile, int x, int y)
 {
     gameObjects [x, y] = tile;
 }
Exemplo n.º 43
0
    static void Main()
    {
        // player playing field dimensions
        int playFieldWidth = 30;
        int playFieldHeight = 20;

        // dwarf creation
        Dwarf dwarf = new Dwarf();
        dwarf.colOne = (playFieldWidth / 2) - 1;
        dwarf.colTwo = (playFieldWidth / 2);
        dwarf.colThree = (playFieldWidth / 2) + 1;
        dwarf.row = playFieldHeight - 1;
        dwarf.color = ConsoleColor.Yellow;
        dwarf.signOne = '(';
        dwarf.signTwo = '0';
        dwarf.signThree = ')';

        // for random color generation
        ConsoleColor[] randomColor = new ConsoleColor[5];
        randomColor[0] = ConsoleColor.Green;
        randomColor[1] = ConsoleColor.Magenta;
        randomColor[2] = ConsoleColor.Cyan;
        randomColor[3] = ConsoleColor.Blue;
        randomColor[4] = ConsoleColor.White;

        // for random char generation
        char[] randomChar = new char[11];
        randomChar[0] = '^';
        randomChar[1] = '@';
        randomChar[2] = '*';
        randomChar[3] = '&';
        randomChar[4] = '+';
        randomChar[5] = '%';
        randomChar[6] = '$';
        randomChar[7] = '#';
        randomChar[8] = '!';
        randomChar[9] = '.';
        randomChar[10] = ';';

        // random numbers generator
        Random randomGenerator = new Random();

        // rocks
        List<GameObjects> rocks = new List<GameObjects>();

        // game field and cursor visibility
        Console.CursorVisible = false;
        Console.BufferHeight = Console.WindowHeight = 20;
        Console.BufferWidth = Console.WindowWidth = 60;
        int gameFieldBoundaries = playFieldWidth + 1;

        // game end conditions, speed and score
        int lives = 3;
        double sleepTime = 0.5;
        double speed = 150;
        int score = 0;

        // Game Rules
        PrintStringOnField(0, 0, "Welcome to the game Falling Rocks!", ConsoleColor.White);
        PrintStringOnField(0, 1, "You are a brave dwarf who is facing a rock-hurling troll!", ConsoleColor.White);
        PrintStringOnField(0, 2, "For each rock you avoid you gain 10 points.", ConsoleColor.White);
        PrintStringOnField(0, 3, "You lose 50 points and 1 life for each rock that hits you!", ConsoleColor.White);
        PrintStringOnField(0, 4, "The game speed increases over time.", ConsoleColor.White);
        PrintStringOnField(0, 5, "Good Luck!!!", ConsoleColor.White);
        PrintStringOnField(0, 6, "To start the game press \"y\", to exit press \"n\"", ConsoleColor.Green);
        Console.SetCursorPosition(0, 7);
        ConsoleKeyInfo yesOrNo = Console.ReadKey(true);
        if (yesOrNo.Key == ConsoleKey.Y)
        // game start
        {
            while (true)
            {
                // game speed
                speed += sleepTime;
                if (speed > 425)
                {
                    speed = 425;
                }

                // hit flag
                bool hit = false;

                // create rocks
                for (int i = 0; i < randomGenerator.Next(0, 5); i++)
                {
                    GameObjects newRock = new GameObjects();
                    newRock.color = randomColor[randomGenerator.Next(0, 4)];
                    newRock.col = randomGenerator.Next(0, playFieldWidth);
                    newRock.row = 0;
                    newRock.sign = randomChar[randomGenerator.Next(0, 10)];
                    rocks.Add(newRock);
                }
                // Move Dwarf
                while (Console.KeyAvailable)
                {
                    ConsoleKeyInfo pressedKey = Console.ReadKey(true);
                    while (Console.KeyAvailable)
                    {
                        Console.ReadKey(true);
                    }
                    if (pressedKey.Key == ConsoleKey.LeftArrow || pressedKey.Key == ConsoleKey.A)
                    {
                        if (dwarf.colOne - 1 > 0)
                        {
                            dwarf.colOne = dwarf.colOne - 1;
                            dwarf.colTwo = dwarf.colTwo - 1;
                            dwarf.colThree = dwarf.colThree - 1;
                        }
                    }
                    if (pressedKey.Key == ConsoleKey.RightArrow || pressedKey.Key == ConsoleKey.D)
                    {
                        if (dwarf.colThree + 1 < playFieldWidth)
                        {
                            dwarf.colOne = dwarf.colOne + 1;
                            dwarf.colTwo = dwarf.colTwo + 1;
                            dwarf.colThree = dwarf.colThree + 1;
                        }
                    }
                }

                // Move Rocks
                List<GameObjects> newList = new List<GameObjects>();
                for (int i = 0; i < rocks.Count; i++)
                {
                    GameObjects oldRock = rocks[i];
                    GameObjects newRock = new GameObjects();
                    newRock.col = oldRock.col;
                    newRock.row = oldRock.row + 1;
                    newRock.sign = oldRock.sign;
                    newRock.color = oldRock.color;
                    if (newRock.row == dwarf.row && (newRock.col == dwarf.colOne || newRock.col == dwarf.colTwo || newRock.col == dwarf.colThree)) // unit collision
                    {
                        hit = true;
                        lives -= 1;
                        if (lives <= 0)
                        {
                            PrintStringOnField(10, 9, "GAME OVER!", ConsoleColor.Red);
                            PrintStringOnField(6, 10, "Your score is: " + score, ConsoleColor.Red);
                            PrintStringOnField(5, 11, "Press [Enter] to exit", ConsoleColor.Red);
                            Console.ReadLine();
                            Environment.Exit(0);
                        }
                    }
                    if (newRock.row < playFieldHeight)
                    {
                        newList.Add(newRock);
                    }
                    else          // scoring system
                    {
                        score += 10;
                    }
                }
                rocks = newList;

                // Clear the console
                Console.Clear();

                // ReDraw playfield

                if (hit)
                {
                    rocks.Clear();
                    if (score <= 50)
                    {
                        score = 0;
                    }
                    else
                    {
                        score -= 50;
                    }

                    PrintOnField(dwarf.colOne, dwarf.row, 'X', ConsoleColor.Red);
                    PrintOnField(dwarf.colTwo, dwarf.row, 'X', ConsoleColor.Red);
                    PrintOnField(dwarf.colThree, dwarf.row, 'X', ConsoleColor.Red);
                }
                else
                {
                    PrintDwarfOnField(dwarf.colOne, dwarf.colTwo, dwarf.colThree, dwarf.row,
                        dwarf.signOne, dwarf.signTwo, dwarf.signThree, dwarf.color); // drawing the dwarf
                }

                foreach (GameObjects rock in rocks)
                {
                    PrintOnField(rock.col, rock.row, rock.sign, rock.color);
                }

                for (int i = 0; i < playFieldHeight; i++)  // playfield boundaries
                {
                    PrintOnField(playFieldWidth, i, '|', ConsoleColor.Gray);
                }

                // Print Score
                PrintStringOnField(40, 9, "Lives: " + lives, ConsoleColor.White);
                PrintStringOnField(40, 10, "Speed: " + speed, ConsoleColor.White);
                PrintStringOnField(40, 11, "Score: " + score, ConsoleColor.White);

                // Slow down the console
                Thread.Sleep(500 - (int)speed);
            }
        }
        if (yesOrNo.Key == ConsoleKey.N)
            return;
        else
        {
            Main();
        }
    }
Exemplo n.º 44
0
 public bool IsHirable(GameObjects.Faction faction)
 {
     if (faction.Leader != null)
     {
         if (this.ProhibitedFactionID == faction.Leader.ID)
         {
             return false;
         }
         if (GlobalVariables.IdealTendencyValid && (this.IdealTendency != null))
         {
             bool flag = GetIdealOffset(this, faction.Leader) <= this.IdealTendency.Offset;
             if (!flag)
             {
                 foreach (GameObjects.Faction faction2 in base.Scenario.Factions)
                 {
                     if ((faction2 != faction) && (faction2.Leader != null))
                     {
                         flag = GetIdealOffset(this, faction2.Leader) <= this.IdealTendency.Offset;
                         if (flag)
                         {
                             return false;
                         }
                     }
                 }
                 return true;
             }
         }
         return true;
     }
     return false;
 }
Exemplo n.º 45
0
 public List<Unit> getUnitsInRange(GameObjects.Target t, float range, bool isAlive = false)
 {
     var units = new List<Unit>();
     foreach (var kv in objects)
     {
         var u = kv.Value as Unit;
         if (u != null && t.distanceWith(u) <= range)
             if (isAlive && !u.isDead() || !isAlive)
                 units.Add(u);
     }
     return units;
 }
Exemplo n.º 46
0
 public void AddWater(GameObjects.Water water)
 {
     water.LoadContent(ScreenManager.Content);
     waterObjects.Add(water);
 }
Exemplo n.º 47
0
 public void RemoveGameObject(GameObjects.GameObject gameObject)
 {
     if(gameObjects.Contains(gameObject))
     {
         gameObjects.Remove(gameObject);
     }
 }
Exemplo n.º 48
0
 public void ChangeFaction(GameObjects.Faction faction)
 {
     if (this.BelongedFaction != null)
     {
         if (this.LocationTroop != null)
         {
         }
         this.BelongedFaction.RemovePerson(this);
     }
     faction.AddPerson(this);
     this.InitialLoyalty();
 }
Exemplo n.º 49
0
 public List<Champion> getChampionsInRange(GameObjects.Target t, float range, bool isAlive = false)
 {
     var champs = new List<Champion>();
     foreach (var kv in champions)
     {
         var c = kv.Value;
         if (t.distanceWith(c) <= range)
             if (isAlive && !c.isDead() || !isAlive) //TODO: check
                 champs.Add(c);
     }
     return champs;
 }