Example #1
0
        public LevelScene()
        {
            GameInformation.Instance.GameState = GameState.InGame;

            MobileList     = new List <Mobile>();
            WeatherHandler = new WeatherHandler();
            ThorSatellite  = new ThorSatellite();

            MineList            = new List <Mobile>();
            ToBeRemovedMineList = new List <Mobile>();

            //Popup related
            isLeaveGamePopupRendered = false;

            //Spawning units on the selected coordinates
            RoomMetadata room = GameInformation.Instance.RoomMetadata;

            ownedMobile = null;

            foreach (KeyValuePair <int, int[]> coordinate in room.SpawnPositions)
            {
                foreach (Player p in room.PlayerList)
                {
                    if (p.ID == coordinate.Key)
                    {
                        Mobile mob = ActorBuilder.BuildMobile(p.PrimaryMobile, p, new Vector2(coordinate.Value[0], coordinate.Value[1]));

                        MobileList.Add(mob);

                        if (p.ID == GameInformation.Instance.PlayerInformation.ID)
                        {
                            ownedMobile = mob;
                        }
                    }
                }
            }

            SpawnMapElements();

            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameStartMatch, StartMatchAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestShot, RequestShotAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestItemUsage, RequestItemAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRefreshSyncMobile, RefreshSyncMobileAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestNextPlayerTurn, RequestNextPlayerTurnAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestDeath, RequestDeathAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestGameEnd, RequestGameEndAsyncCallback);
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestDisconnect, RequestDisconnectAsyncCallback);

            //Gold Handler
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerInGameRequestDamage, ReceiveGoldUpdateRequest);

            //Textbox handlers
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerChatSendPlayerMessage, (o) => HUD.OnReceiveMessageAsyncCallback(o, 0));
            ServerInformationBroker.Instance.ActionCallbackDictionary.AddOrReplace(NetworkObjectParameters.GameServerChatSendSystemMessage, (o) => HUD.OnReceiveMessageAsyncCallback(o, 1));

            //Threads
            TerminateThreads = false;
            StartTurnRequesterThread();
        }
Example #2
0
 public ThorProjectile(Mobile mobile, ThorSatellite thor, Vector2 position, float beamAngle)
     : base(mobile, position, beamAngle, Parameter.ProjectileThorExplosionRadius, 0, Parameter.ProjectileThorBaseDamage + thor.Level * Parameter.ProjectileThorBaseDamagePerLevel, 0, BeamEmitterType.Thor, thor.Position)
 {
     this.thor = thor;
 }