//Method to be re written when serialisation/deserialisation implemented. public Game NewGame(Player newPlayer) { Game game = new Game(newPlayer); GameObject mayorSpawn = GameObject.Find("MayorSpawnLocation-Beach"); GameObject ethanSpawn = GameObject.Find("EthanSpawnLocation-Hut"); GameObject jennaSpawn = GameObject.Find("JennaSpawnPoint-forest"); GameObject fisherSpawn = GameObject.Find("FisherSpawnPoint-headland"); Npc mayor = new Npc("Mayor", "Mayor", mayorSpawn.transform.position, 1f, true); Npc ethan = new Npc("Ethan", "Ethan", ethanSpawn.transform.position, 0.2f, true); Npc jenna = new Npc("Jenna", "npc1", jennaSpawn.transform.position,0.3f, true); Npc fisher = new Npc("Fisher", "fisher", fisherSpawn.transform.position,0f, false); game.AddNpc(mayor); game.AddNpc(ethan); game.AddNpc(jenna); game.AddNpc(fisher); RecyclePoint beachPoint = new RecyclePoint("BeachRecyclePoint", 50); game.RecyclePoints.Add(beachPoint); game.CheckPoints.Add ("SpokenToMayorFirst"); game.CheckPoints.Add ("SpokenToEthan"); game.CheckPoints.Add ("FirstEthanMeetingPositive"); game.CheckPoints.Add ("MayorLeaveBeach"); game.CheckPoints.Add ("BeachRecyclePointFull"); game.CheckPoints.Add ("StartSortingMiniGame"); game.IsNewGame = false; return game; }
public GameLoader(string fileName, Assembly [] preloads, Action<string> die) { Game = new Game(this, die); string extention = null; try { extention = fileName.Substring(fileName.LastIndexOf('.')); } catch (Exception) { die("File " + fileName + " could Not be loaded"); return; } if (".kgl" == extention) { loaderUtility = new KGLLoaderUtility(fileName, this); } else { die("File " + fileName + " could Not be loaded"); } foreach (Assembly loaded in preloads) { string name = Path.GetFileName(loaded.Location); if (!LoadedFiles.ContainsKey(name)) { LoadedFiles.Add(name, loaded); ClassFactory.LoadServicesAndManagers(loaded); } } }
void OnStartGame() { game = GameObject.Find("Game").GetComponent<Game>(); UI = GameObject.Find("UICanvas").GetComponent<GameUIManager>(); SetScore(); SpawnBall(); for (int i = 0; i < actors.Count; i++) { bool homeTeam = actors[i].Team == "Home"; actors[i].OnGameReset(); if(homeTeam) actors[i].SetTeamKit(Home); else actors[i].SetTeamKit(Away); if(actors[i].tag == "AI") { (actors[i] as AIPlayer).SetupAI(game); } else if(actors[i].tag == "Keeper") { (actors[i] as AIKeeper).SetupAI(game); } } state = GameState.GAME; }
public DxMesh( Game renderer, List<AdnMeshData> meshDataList) { _center = new Vector3(0, 0, 0); _meshEntities = new Dictionary<string, DxMeshEntity>(); foreach (AdnMeshData meshData in meshDataList) { _center += new Vector3( meshData.Center[0], meshData.Center[1], meshData.Center[2]); _meshEntities.Add( meshData.Id, new DxMeshEntity( renderer, meshData)); } _center.X = -_center.X / meshDataList.Count; _center.Y = -_center.Y / meshDataList.Count; _center.Z = -_center.Z / meshDataList.Count; }
public static void Main(string[] args) { using (var game = new Game()) { game.Run(); } }
/// <summary> /// Constructs a new screen manager component. /// </summary> public ScreenManager(Game game) : base(game) { // we must set EnabledGestures before we can query for them, but // we don't assume the game wants to read them. TouchPanel.EnabledGestures = GestureType.None; }
public static void CreateArsenal(ushort gID, Game.ConquerStructures.Society.ArsenalType Type) { if (!ContainsArsenal(gID)) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("guild_arsenals").Insert("guild_uid", gID).Execute(); } else { string val = ""; switch (Type) { case ArsenalType.Headgear: val = "head_allowed"; break; case ArsenalType.Armor: val = "armor_allowed"; break; case ArsenalType.Weapon: val = "weapon_allowed"; break; case ArsenalType.Ring: val = "ring_allowed"; break; case ArsenalType.Boots: val = "boots_allowed"; break; case ArsenalType.Necklace: val = "neck_allowed"; break; case ArsenalType.Fan: val = "fan_allowed"; break; case ArsenalType.Tower: val = "tower_allowed"; break; } if (val != "") { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("guild_arsenals").Set(val, 1).Execute(); } } }
public static void Inscribe(Game.ConquerStructures.Society.ArsenalType Type, uint Donation, Interfaces.IConquerItem item, Game.Entity Entity) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("guild_arsenalsdonation").Insert("d_uid", Entity.UID).Insert("guild_uid", Entity.GuildID).Insert("name", Entity.Name).Insert("item_uid", item.UID).Insert("item_donation", Donation).Insert("item_arsenal_type", (byte)Type).Execute(); cmd = new MySqlCommand(MySqlCommandType.UPDATE); cmd.Update("items").Set("Inscribed", 1).Where("UID", item.UID).Execute(); }
/// <summary> /// Initializes a new instance of the <see cref="MemorySecret"/> class with /// the specified values. /// </summary> /// <param name="game">The game.</param> /// <param name="gameId">The game id.</param> /// <param name="memory">The memory.</param> /// <param name="isReturnSecret">if set to <c>true</c> is return secret.</param> public MemorySecret(Game game, short gameId, Memory memory, bool isReturnSecret) { GameID = gameId; TargetGame = game; Memory = memory; IsReturnSecret = isReturnSecret; }
/// <summary> /// /// </summary> /// <param name="Game"></param> internal Mouse ( Game Game ) : base(Game) { this.device = Game.InputDevice; device.MouseScroll += device_MouseScroll; device.MouseMove += device_MouseMove; }
protected bool Tick( Game game, float gravity, double delta ) { hitTerrain = false; lastPos = Position = nextPos; byte curBlock = GetBlock( game, (int)Position.X, (int)Position.Y, (int)Position.Z ); float minY = Utils.Floor( Position.Y ) + game.BlockInfo.MinBB[curBlock].Y; float maxY = Utils.Floor( Position.Y ) + game.BlockInfo.MaxBB[curBlock].Y; if( !CanPassThrough( game, curBlock ) && Position.Y >= minY && Position.Y < maxY && CollideHor( game, curBlock ) ) return true; Velocity.Y -= gravity * (float)delta; int startY = (int)Math.Floor( Position.Y ); Position += Velocity * (float)delta * 3; int endY = (int)Math.Floor( Position.Y ); if( Velocity.Y > 0 ) { // don't test block we are already in for( int y = startY + 1; y <= endY && TestY( game, y, false ); y++ ); } else { for( int y = startY; y >= endY && TestY( game, y, true ); y-- ); } nextPos = Position; Position = lastPos; return base.Tick( game, delta ); }
bool CollideHor( Game game, byte block ) { Vector3 min = game.BlockInfo.MinBB[block] + FloorHor( Position ); Vector3 max = game.BlockInfo.MaxBB[block] + FloorHor( Position ); return Position.X >= min.X && Position.Z >= min.Z && Position.X < max.X && Position.Z < max.Z; }
public void AnyLiveCellWithFewerThanTwoLiveNeighboursDies() { var game = new Game(3); game.Tick(); Assert.False(game.NextLife[2, 0].IsAlive); }
/// <summary> /// /// </summary> /// <param name="game"></param> /// <param name="stream"></param> /// <param name="requestedType"></param> /// <param name="assetPath"></param> /// <returns></returns> public override object Load( Game game, Stream stream, Type requestedType, string assetPath ) { var bytes = stream.ReadAllBytes(); if (assetPath.ToLowerInvariant().Contains("|default")) { return Encoding.Default.GetString( bytes ); } if (assetPath.ToLowerInvariant().Contains("|utf8")) { return Encoding.UTF8.GetString( bytes ); } if (assetPath.ToLowerInvariant().Contains("|utf7")) { return Encoding.UTF7.GetString( bytes ); } if (assetPath.ToLowerInvariant().Contains("|utf32")) { return Encoding.UTF32.GetString( bytes ); } if (assetPath.ToLowerInvariant().Contains("|ascii")) { return Encoding.ASCII.GetString( bytes ); } return Encoding.Default.GetString( bytes ); }
void Start() { game = GameObject.Find("Networking").GetComponent<Game>(); sender = GameObject.Find("Networking").GetComponent<PacketSender>(); chat = GameObject.Find("Chat").GetComponent<Chat>(); side = GameObject.Find("SideObjects").GetComponent<SideObjects>(); }
public override void OnHitEntity(Game game, OnUseEntityArgs e) { Entity entity = game.entities[e.entityId]; if (entity == null) { return; } if (entity.drawArea == null) { return; } entity.drawArea.visible = !entity.drawArea.visible; }
public Control(Game game) { this.game = game; textTexture = new Text(game.ClientSize, new Size(0, 0), new Point(0, 0)); textTexture.Update(""); this.text = ""; }
public Control(Game game, string text) { this.game = game; textTexture = new Text(game.ClientSize, new Size(0, 0), new Point(0, 0)); textTexture.Update(text); this.text = text; }
public DefaultTowerSelectionPanelForTesting(Vector2D position, Game game) { towerPanel = new Scene(); clickedPosition = position; this.game = game; DisplayTowerSelectionPanel(); }
public static void ElecticityUpdate(Game game, Node center) { Node tmp = center; int Volt = game.getScore(); int In = game.getScore(); ElectricityCalcul(tmp, ref Volt, In, true, tmp); }
public void DrawCompass(Game game) { if (!CompassInActiveMaterials(game)) return; if (compassid == -1) { compassid = game.GetTexture("compass.png"); needleid = game.GetTexture("compassneedle.png"); } float size = 175; float posX = game.Width() - 100; float posY = 100; float playerorientation = -((game.player.position.roty / (2 * Game.GetPi())) * 360); compassvertex += (playerorientation - compassangle) / 50; compassvertex *= (one * 9 / 10); compassangle += compassvertex; // compass game.Draw2dTexture(compassid, posX - size / 2, posY - size / 2, size, size, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false); // compass needle game.GLPushMatrix(); game.GLTranslate(posX, posY, 0); game.GLRotate(compassangle, 0, 0, 90); game.GLTranslate(-size / 2, -size / 2, 0); game.Draw2dTexture(needleid, 0, 0, size, size, null, 0, Game.ColorFromArgb(255, 255, 255, 255), false); game.GLPopMatrix(); }
void Start () { CreatureCard c0 = new CreatureCard(3, 2, "Knight", 3, CardType.Creature, CardEffectName.Effect1, 0); SpellCard c1 = new SpellCard("Horse", 3, CardType.Spell, CardEffectName.Effect1, 1); SpellCard c2 = new SpellCard("Spearman", 1, CardType.Spell, CardEffectName.Effect1, 1); CreatureCard c3 = new CreatureCard(2, 1, "Bishop", 2, CardType.Creature, CardEffectName.Effect1, 0); CreatureCard c4 = new CreatureCard(2, 5, "King", 4, CardType.Creature, CardEffectName.Effect1, 0); Game game = new Game(p1, p2); p1.deck.Add(c1); p1.deck.Add(c0); p1.deck.Add(c2); p1.deck.Add(c3); p1.deck.Add(c4); p1.deck.Add(c1); p1.deck.Add(c0); p1.deck.Add(c2); p1.deck.Add(c3); p2.deck.Add(c1); p2.deck.Add(c0); p2.deck.Add(c2); p2.deck.Add(c3); p2.deck.Add(c4); p2.deck.Add(c1); p2.deck.Add(c0); p2.deck.Add(c2); p2.deck.Add(c3); ShuffleDeck(p1); ShuffleDeck(p2); }
public void Extract( string path, Game game ) { path = Path.Combine( Dir, path ); path = Path.Combine( Program.AppDirectory, path ); using( Stream fs = new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.Read ) ) Extract( fs, game ); }
public static void Main(string[] args) { bool fullscreen = false; string sc_cd_dir = ConfigurationManager.AppSettings["StarcraftCDDirectory"]; string bw_cd_dir = ConfigurationManager.AppSettings["BroodwarCDDirectory"]; /* catch this pathological condition where someone has set the cd directories to the same location. */ if (sc_cd_dir != null && bw_cd_dir != null && bw_cd_dir == sc_cd_dir) { Console.WriteLine ("The StarcraftCDDirectory and BroodwarCDDirectory configuration settings must have unique values."); return; } // I am a bad hacker for doing this on !OSX try { NSApplicationLoad (); } catch {} Game g = new Game (ConfigurationManager.AppSettings["StarcraftDirectory"], sc_cd_dir, bw_cd_dir); if (args.Length > 0) if (args[0] == "/fullscreen") fullscreen = true; g.Startup(fullscreen); }
public LoadLevelScreen( Game game ) : base(game) { titleText = "Select a level"; string dir = Path.Combine( Program.AppDirectory, "maps" ); string[] rawFiles = Directory.GetFiles( dir ); int count = 0; // Only add map files for( int i = 0; i < rawFiles.Length; i++ ) { string file = rawFiles[i]; if( file.EndsWith( ".cw" ) || file.EndsWith( ".dat" ) || file.EndsWith( ".fcm" ) || file.EndsWith( ".lvl" ) ) { count++; } else { rawFiles[i] = null; } } entries = new string[count]; for( int i = 0, j = 0; i < rawFiles.Length; i++ ) { string file = rawFiles[i]; if( file == null ) continue; entries[j] = Path.GetFileName( file ); j++; } Array.Sort( entries ); }
public EnemyCollection(ref Texture2D texture,Vector2 Position, Rectangle rect, Game game) : base(game) { this.Texture = texture; this.Rectangle = rect; this.Position = Position; this.game = game; }
private static IEnumerable<IPlayerMoveForUpdate> GenerateTradeMoves(Game game) { var uni = game.CurrentUniversity; return uni.GetDegreeTradingRates() .Where(rate => uni.HasStudentsFor(rate)) .SelectMany(GetTradingMoves); }
public FrameRateCounter(Game game) : base(game) { frameRate = 0; frameCounter = 0; secondsPassed = 0; }
// Use this for initialization void Start() { // Get the object used to communicate with the server. /*request = (FtpWebRequest)WebRequest.Create("ftp://www.funwall.net/"); request.Method = WebRequestMethods.Ftp.UploadFile; // This example assumes the FTP site uses anonymous logon. request.Credentials = new NetworkCredential ("funwalladmin",""); // Copy the contents of the file to the request stream. StreamReader sourceStream = new StreamReader("testfile.txt"); byte [] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd()); sourceStream.Close(); request.ContentLength = fileContents.Length; Stream requestStream = request.GetRequestStream(); requestStream.Write(fileContents, 0, fileContents.Length); requestStream.Close(); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription); response.Close();*/ instance = this; _game = new Game(); _game.Players.Add(new player("john", "img/avatars/ninja.png", 3403)); _game.Players.Add(new player("Reese", "img/avatars/cptamerica.png", 3403)); _game.Players.Add(new player("Belvedier", "img/avatars/ironman.png", 8458)); _game.Players.Add(new player("Excelcisior", "img/avatars/alien.png", 8384)); _game.Players.Add(new player("Blue", "img/avatars/thor.png", 8223)); _game.Players.Add(new player("Xavier", "img/avatars/geek.png", 3483)); }
/// <summary> /// Handles the logical part of the scene /// </summary> /// <param name="game">Game manager</param> public void Update(Game game) { // If any key was pressed if (game.KeyboardManager.AnyTriggered != null) // Goes back to the title scene game.SceneManager.NextScene = new SceneTitle(); }
private void OnTick(object sender, EventArgs e) { // 3D markers if (Mod.config.draw3dMarkers) { foreach (Fence fence in Mod.config.fences) { if (World.GetDistance(Game.Player.Character.Position, new Vector3(fence.locX, fence.locY, fence.locZ)) <= 150) { World.DrawMarker(MarkerType.VerticalCylinder, new Vector3(fence.locX, fence.locY, fence.locZ - fence.locZ / fence.locZ), Vector3.Zero, Vector3.Zero, new Vector3(1.5f, 1.5f, 0.5f), Color.Yellow); } } } // Actual looting stuff if (!Game.Player.Character.IsInVehicle()) { // LOOTING Vehicle[] vehicles = World.GetNearbyVehicles(Game.Player.Character, 25.5f); foreach (Vehicle veh in vehicles) { FreightCar car = null; foreach (FreightCar fc in Mod.config.cars) { if (new Model(fc.modelName) == veh.Model) { car = fc; } } if (car != null && !robbedCars.Contains(veh) && veh.IsAlive) { if (veh.HasBone(car.bone)) { Vector3 rearPos = veh.GetBoneCoord(veh.GetBoneIndex(car.bone)); if (World.GetDistance(rearPos, Game.Player.Character.Position) <= car.radius) { // The player can rob the train UI.ShowHelpMessage("Press ~y~E ~w~to rob the train", 1, true); if (Game.IsControlJustPressed(0, GTA.Control.Talk)) { // Fading effect when robbing if (!Mod.config.debugMode) { Game.FadeScreenOut(1500); Wait(3000); } SearchTrain(veh); if (!Mod.config.debugMode) { Game.FadeScreenIn(1500); } } } } } } // END OF LOOTING // FENCES Inventory inventory = InventoryManager.GetInventory((PedHash)Game.Player.Character.Model.GetHashCode()); foreach (Fence shop in Mod.config.fences) { if (World.GetDistance(Game.Player.Character.Position, new Vector3(shop.locX, shop.locY, shop.locZ)) <= 1.25f && inventory.items.Count >= 1) { UI.ShowSubtitle($"Press ~y~E ~w~to sell your loot to the fence (${inventory.totalValue})", 1); if (Game.IsControlJustPressed(0, GTA.Control.Talk)) { Game.FadeScreenOut(1000); Game.Player.Character.FreezePosition = true; Wait(1000); int itemCount = inventory.items.Count; int itemValue = inventory.totalValue; inventory.items.Clear(); inventory.totalValue = 0; InventoryManager.SaveInventories(); World.CurrentDayTime = new TimeSpan(World.CurrentDayTime.Hours + new Random().Next(1, itemCount), new Random().Next(1, 59), new Random().Next(1, 59)); Wait(500); Game.Player.Character.FreezePosition = false; Game.FadeScreenIn(1000); Game.Player.Money = Game.Player.Money + itemValue; if (itemCount > 1) { UI.Notify($"You just sold {itemCount} items for ${itemValue}!"); } else if (itemCount == 1) { UI.Notify($"You just sold {itemCount} item for ${itemValue}!"); } } } } // END OF FENCES } }
// Unity Event function, called when component is enabled private void OnEnable() { Instance = this; Random.InitState((int)DateTime.Now.Ticks); emojiSprites.Shuffle(); }
public GuiManager(Game game) : base(game) { _singleton = this; }
public Cursor(Game game) : base(game) { }
public Level9(string email, int stud, int num, int score, double totaltime) { Email = email; id = stud; Score = score; InitializeComponent(); Num = num; clicked = 0; Starttime = DateTime.Now.ToLocalTime(); NavigationPage.SetHasNavigationBar(this, false); Totaltime = totaltime; games[0] = new Game() { Pic0 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbutterfly1.png", Pic1 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackcar2.png", Pic2 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbutterfly2.png", Pic3 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackflower2.png", Pic4 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbug2.png", sound = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/Visual+closing/Vclosing.mp3" }; games[1] = new Game() { Pic0 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackcar1.png", Pic1 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackcar2.png", Pic2 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbutterfly2.png", Pic3 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackflower2.png", Pic4 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbug2.png", sound = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/Visual+closing/Vclosing.mp3" }; games[2] = new Game() { Pic0 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbug1.png", Pic1 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackcar2.png", Pic2 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbutterfly2.png", Pic3 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackflower2.png", Pic4 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbug2.png", sound = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/Visual+closing/Vclosing.mp3" }; games[3] = new Game() { Pic0 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackflower1.png", Pic1 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackcar2.png", Pic2 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbutterfly2.png", Pic3 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackflower2.png", Pic4 = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbug2.png", sound = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/Visual+closing/Vclosing.mp3" }; // https://s3.ap-south-1.amazonaws.com/cloudgamingapp/Blue+face.png pic0.Source = games[num].Pic0; pic1.Source = games[num].Pic1; pic2.Source = games[num].Pic2; pic3.Source = games[num].Pic3; pic4.Source = games[num].Pic4; file = new MediaFile(games[Num].sound); CrossMediaManager.Current.Play(file); CrossMediaManager.Current.MediaFinished += Current_MediaFinished; Question_label.GestureRecognizers.Add( new TapGestureRecognizer() { Command = new Command(() => { CrossMediaManager.Current.Play(file); CrossMediaManager.Current.MediaFinished += Current_MediaFinished; }) }); switch (Num) { case 0: theRightAnswer = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbutterfly2.png"; break; case 1: theRightAnswer = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackcar2.png"; break; case 2: theRightAnswer = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackbug2.png"; break; case 3: theRightAnswer = "https://s3.amazonaws.com/cloudgamingmulitmediabucket/audio/blackflower2.png"; break; } }
// Unity Event function, called when component is disabled private void OnDisable() { Instance = null; }