Inheritance: MonoBehaviour
    // Use this for initialization
    void Start()
    {
        //Dictionary<Storage.UnitTypes, uint> dUnits = new Dictionary<Storage.UnitTypes, uint>();
        //Dictionary<Storage.BuildingTypes, uint> dBuildings = new Dictionary<Storage.BuildingTypes, uint>();
        missionsToComplete = 0;
        GameInformation info = GameObject.Find("GameInformationObject").GetComponent <GameInformation>();

        battle = info.GetBattle();
        foreach (Battle.MissionDefinition mission in battle.GetMissions())
        {
            switch (mission.purpose)
            {
            case Battle.MissionType.DESTROY:
                switch (mission.target)
                {
                case Storage.EntityType.UNIT:
                    destroyedUnitsWinners.Add(mission.targetType.unit, 0);
                    //dUnits.Add(mission.targetType.unit, mission.amount);
                    missionsToComplete++;
                    break;

                case Storage.EntityType.BUILDING:
                    destroyedBuildingsWinners.Add(mission.targetType.building, 0);
                    //dBuildings.Add(mission.targetType.building, mission.amount);
                    missionsToComplete++;
                    break;
                }
                break;
            }
        }
    }
        public FormShapShots(Model.Model modelIn, GameInformation gameInformationIn)
        {
            var model = modelIn;

            InitializeComponent();

            foreach (var snapShot in model.ShapShots)
            {
                if (snapShot.User == model.CurrentUser)
                {
                    if (snapShot.GameId == gameInformationIn.SaveDir)
                    {
                        ListViewItem lvi = new ListViewItem(snapShot.Folder);
                        lvi.SubItems.Add(snapShot.Comment);

                        listView1.Items.Add(lvi);
                    }
                }
            }

            for (int c = 0; c < listView1.Columns.Count; ++c)
            {
                listView1.AutoResizeColumn(c, ColumnHeaderAutoResizeStyle.ColumnContent);
                listView1.AutoResizeColumn(c, ColumnHeaderAutoResizeStyle.HeaderSize);
            }
        }
Exemple #3
0
    void HandleFirstInput()
    {
        HexCoordinates hexCoords = GetInput();

        if (hexCoords != new HexCoordinates(1000, 1000))
        {
            if (GameInformation.IndexOfCharacter(hexCoords) != -1)
            {
                currentCharacter = GameInformation.characters [GameInformation.IndexOfCharacter(hexCoords)];
                if (currentCharacter.team1 == GameInformation.player1Turn)
                {
                    pathStarted = true;
                    if (!GameInformation.currentPath.InPath(hexCoords))
                    {
                        List <HexCoordinates> coordList = new List <HexCoordinates> ();
                        coordList.AddRange(GameInformation.currentPath.hexCoords);
                        coordList.Add(hexCoords);
                        GameInformation.currentPath = new CharacterPath(coordList.ToArray(), currentCharacter);
                    }
                }
            }
            else
            {
                pathStarted = false;
            }
        }
    }
Exemple #4
0
    void HandleAttackInput()
    {
        HexCoordinates hexCoords = GetInput();

        if (hexCoords != new HexCoordinates(1000, 1000))
        {
            if (GameInformation.IndexOfCharacter(hexCoords) != -1)
            {
                currentCharacter = GameInformation.characters [GameInformation.IndexOfCharacter(hexCoords)];
                if (GameInformation.currentAttackPath.InPath(hexCoords))
                {
                    if (GameInformation.IndexOfCharacter(hexCoords) != -1)
                    {
                        Character tempCharacter = GameInformation.currentlySelectedCharacter;
                        if (GameInformation.characters [GameInformation.IndexOfCharacter(hexCoords)].team1 != tempCharacter.team1)
                        {
                            if (tempCharacter.team1 != currentCharacter.team1)
                            {
                                tempCharacter.charMovement.LookAt(currentCharacter.position);
                                tempCharacter.charAnimation.Attacking = true;
                                tempCharacter.attacked = true;
                                currentCharacter.TakeDamage(tempCharacter.damage);
                                GameInformation.attackButton.Attack();
                            }
                        }
                    }
                }
            }
        }
    }
Exemple #5
0
 public void InflictDamage(float damage)
 {
     if (!GameInformation.IsPVP() || (controllable && GameInformation.IsPVP()))
     {
         healthLevel -= damage;
     }
 }
Exemple #6
0
 public void Win()
 {
     GameInformation.CompletedLevel(LevelManager.GetLevel());
     GameInformation.CheckHighScore(LevelManager.GetLevel(), scoreScript.GetFinalScore());
     SaveLoad.SaveGameInformation();
     winBoard.SetActive(true);
 }
Exemple #7
0
    private void InitializeBattle()
    {
        BattleInformation.RoundNum    = 1;
        BattleInformation.Turn        = 1;
        BattleInformation.IsDwarfTurn = true;
        BattleInformation.PlayerHasMadeAnActionInHisTurn = false;
        BattleInformation.DwarfPlayer = GameInformation.GetCurrentPlayer();

        if (PlayerPrefs.GetInt(Constants.gameIsVsIAKey) == 1)
        {
            BattleInformation.TrollPlayer = new Player("IA");
        }
        else if (PlayerPrefs.GetInt(Constants.gameIsOnlineKey) == 1)
        {
            BattleInformation.TrollPlayer = new Player("Online Player");
        }
        else
        {
            BattleInformation.TrollPlayer = GameInformation.GetPlayer2();
        }

        BattleInformation.Player1Point    = 0;
        BattleInformation.Player2Point    = 0;
        BattleInformation.TakenDwarfCount = 0;
        BattleInformation.TakenTrollCount = 0;

        HudLink.player1TakenPawnGrid.UpdateGrid();
        HudLink.player2TakenPawnGrid.UpdateGrid();

        HudLink.turnText.UpdateText();

        ShowTurnBanner();
    }
Exemple #8
0
 public void RepairDamage(float repairAmount)
 {
     if (!GameInformation.IsPVP() || (controllable && GameInformation.IsPVP()))
     {
         healthLevel += repairAmount;
     }
 }
Exemple #9
0
 public void Attack()
 {
     if (GameInformation.attackMode)
     {
         GameInformation.ResetAttackingPath();
         buttonText.text = "Attack";
     }
     else
     {
         try {
             currentCharacter = GameInformation.currentlySelectedCharacter;
             if (currentCharacter.team1 == GameInformation.player1Turn)
             {
                 if (currentCharacter.attacked == false)
                 {
                     List <HexCoordinates> tempCoords = new List <HexCoordinates>();
                     foreach (HexCoordinates neighbour in currentCharacter.position.CellNeighbours)
                     {
                         tempCoords.Add(neighbour);
                     }
                     if (tempCoords.Count != 0)
                     {
                         CharacterPath attackingPath = new CharacterPath(tempCoords.ToArray(), currentCharacter);
                         GameInformation.currentAttackPath = attackingPath;
                         buttonText.text            = "Cancel";
                         GameInformation.attackMode = true;
                     }
                 }
             }
         } catch {
             GameInformation.attackMode = false;
             buttonText.text            = "Attack";
         }
     }
 }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        info = (GameInformation)GameObject.Find("GameInformationObject").GetComponent("GameInformation");
        this.GetComponent<AudioListener>().enabled = false;

        _camera = this.GetComponent<Camera>();
        _camera.orthographic = true;

        depth = 10;
        
        //Assign camera viewport
        _camera.rect = this.recalcViewport();

        mainCam = GameObject.Find("Main Camera").GetComponent<Camera>();

        initializeCameraPars();

        // moves camera to show the whole map
        if (Terrain.activeTerrain)
        {
            float diagonal = Mathf.Sqrt(Mathf.Pow(Terrain.activeTerrain.terrainData.size.x, 2) + Mathf.Pow(Terrain.activeTerrain.terrainData.size.y, 2));
            _camera.transform.position = new Vector3(Terrain.activeTerrain.terrainData.size.x * 0.5f, Terrain.activeTerrain.terrainData.size.x * 0.6f,Terrain.activeTerrain.terrainData.size.z * 0.5f);
            _camera.transform.rotation = Quaternion.Euler(90f, 135f,0); 
            _camera.orthographicSize = diagonal * 0.95f; // a hack
            _camera.farClipPlane = Terrain.activeTerrain.terrainData.size.x * 1.5f;
            _camera.clearFlags = CameraClearFlags.Depth;
            instantiateMask();
        }

        createMarker();

    }
 public void AddPointTo(bool isDwarfPlayer, int earnPoint)
 {
     if (isDwarfPlayer)
     {
         if (BattleInformation.DwarfPlayer.ID == GameInformation.GetCurrentPlayer().ID)
         {
             DebugLog.DebugMessage("Player 1, who play dwarfs, win " + earnPoint + " points ! ", true);
             BattleInformation.Player1Point += earnPoint;
         }
         else
         {
             DebugLog.DebugMessage("Player 2, who play dwarfs, win " + earnPoint + " points ! ", true);
             BattleInformation.Player2Point += earnPoint;
         }
     }
     else
     {
         if (BattleInformation.TrollPlayer.ID == GameInformation.GetCurrentPlayer().ID)
         {
             DebugLog.DebugMessage("Player 1, who play trolls, win " + earnPoint + " points ! ", true);
             BattleInformation.Player1Point += earnPoint;
         }
         else
         {
             DebugLog.DebugMessage("Player 2, who play trolls, win " + earnPoint + " points ! ", true);
             BattleInformation.Player2Point += earnPoint;
         }
     }
 }
Exemple #12
0
    public bool checkGameOver()
    {
        GameObject      gameI    = GameObject.Find("Display Game Information");
        GameInformation gameInfo = gameI.GetComponent <GameInformation>();

        if (ShipContainer.checkIfEarthLost())
        {
            if (GlobalVariables.local)
            {
                SceneManager.LoadScene("MarsWins", LoadSceneMode.Single);
                return(true);
            }
            else
            {
                FindObjectOfType <NetworkEndSceneHandler>().loadSceneOnClient("MarsWins");
                return(true);
            }
        }

        if (ShipContainer.checkIfMarsLost())
        {
            if (GlobalVariables.local)
            {
                SceneManager.LoadScene("EarthWins", LoadSceneMode.Single);
                return(true);
            }
            else
            {
                FindObjectOfType <NetworkEndSceneHandler>().loadSceneOnClient("EarthWins");
                return(true);
            }
        }
        return(false);
    }
Exemple #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="model"></param>
 /// <param name="gameInfo"></param>
 public static void WriteIni(Model.Model model, GameInformation gameInfo)
 {
     if (GetVersion(model, gameInfo).Folder != null)
     {
         using (StreamWriter sw = new StreamWriter(Path.Combine(GetVersion(model, gameInfo).Folder, "cemuhook.ini")))
         {
             sw.WriteLine("[CPU]");
             sw.WriteLine("customTimerMode = " + GetCustomTimerMode(gameInfo.CemuHookSetting.CustomTimerMode));
             sw.WriteLine("customTimerMultiplier = " + GetCustomTimerMultiplier(gameInfo.CemuHookSetting.CustomTimerMultiplier));
             sw.WriteLine("disableLZCNT = " + (gameInfo.CemuHookSetting.DisableLzcnt ? "true" : "false"));
             sw.WriteLine("disableMOVBE =  " + (gameInfo.CemuHookSetting.DisableLzcnt ? "true" : "false"));
             sw.WriteLine("disableAVX =  " + (gameInfo.CemuHookSetting.DisableLzcnt ? "true" : "false"));
             sw.WriteLine("[Input]");
             sw.WriteLine("motionSource = " + GetMotionSource(gameInfo.CemuHookSetting.MotionSource));
             if (model.Settings.CemuHookServerIp != "")
             {
                 sw.WriteLine("serverIP = " + model.Settings.CemuHookServerIp);
             }
             if (model.Settings.CemuHookServerPort != "")
             {
                 sw.WriteLine("serverPort  = " + model.Settings.CemuHookServerPort);
             }
             sw.WriteLine("[Debug]");
             sw.WriteLine("mmTimerAccuracy = " + GetMmTimerAccuracy(gameInfo.CemuHookSetting.MotionSource));
             sw.WriteLine("[Graphics]");
             sw.WriteLine("ignorePrecompiledShaderCache = " + (gameInfo.CemuHookSetting.IgnorePrecompiledShaderCache ? "true" : "false"));
         }
     }
 }
Exemple #14
0
        private void browseButton_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                foreach (string gamePath in openFileDialog.FileNames)
                {
                    // Check to see if it exists
                    if (_cache[gamePath] != null)
                    {
                        continue;
                    }

                    GameInformation game = this.LoadGameFromUmd(gamePath);
                    if (game != null)
                    {
                        _cache.Add(game);
                        umdGameListing.AddGame(game);

                        umdGameListing_SelectionChanged(umdGameListing, EventArgs.Empty);
                    }
                }

                _cache.Save();
            }
        }
Exemple #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="game"></param>
        /// <param name="getSaveDir"></param>
        /// <param name="cemuOnly"></param>
        /// <param name="cemuIn"></param>
        /// <param name="start"></param>
        /// <param name="shiftUp"></param>
        /// <param name="forceFullScreen"></param>
        private void PopulateStartInfo(GameInformation game, bool getSaveDir, bool cemuOnly, string cemuIn, ProcessStartInfo start, bool shiftUp, bool forceFullScreen = false)
        {
            // Enter in the command line arguments, everything you would enter after the executable name itself
            if (!cemuOnly)
            {
                SetGameLaunchParameters(game, getSaveDir, start, shiftUp, forceFullScreen);
            }

            // Enter the executable to run, including the complete path
            if (Model.Settings.WineExe.Length > 1)
            {
                start.FileName  = Model.Settings.WineExe;
                start.Arguments = Path.Combine(Directory.GetCurrentDirectory(), runningVersion.Folder, cemuIn) + " " + start.Arguments;
            }
            else
            {
                start.FileName = cemuIn;
            }

            // Do you want to show a console window?
            start.CreateNoWindow = true;

            if (game != null)
            {
                game.PlayCount++;

                game.LastPlayed = DateTime.Now;

                if (parent != null)
                {
                    parent.RefreshList(game);
                }
            }
        }
Exemple #16
0
        private void SetCemuCpuPrioty(GameInformation game)
        {
            if (runningProcess.HasExited)
            {
                return;
            }
            try
            {
                if (game != null)
                {
                    switch (game.GameSetting.CpuMode)
                    {
                    case GameSettings.CpuModeType.DualCoreCompiler: runningProcess.PriorityClass = GetProcessPriority(Model.Settings.DualCorePriority);
                        break;

                    case GameSettings.CpuModeType.TripleCoreCompiler: runningProcess.PriorityClass = GetProcessPriority(Model.Settings.TripleCorePriority);
                        break;

                    default: runningProcess.PriorityClass = GetProcessPriority(Model.Settings.SingleCorePriority);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                parent.Model.Errors.Add(ex.Message);
            }
        }
Exemple #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void proc_Exited(object sender, EventArgs e)
        {
            if (runningVersion != null)
            {
                if (runningGame != null)
                {
                    foreach (var controller in ContollerFileNames)
                    {
                        SafeCopy(runningVersion, controller[1], controller[0]);
                    }

                    if (!runningGame.SaveDir.StartsWith("??"))
                    {
                        CopyShaderCaches();

                        CopySaves();
                    }
                }
            }

            if (runningGame != null)
            {
                runningGame.PlayTime += (long)(DateTime.Now - startTime).TotalSeconds;
            }
            runningGame = null;
            ClearRunningVersion();

            if (parent != null)
            {
                parent.ProcessExited();
            }
        }
Exemple #18
0
        public void LaunchGame(GameInformation game)
        {
            game.IgnoreDispose = true;
            if (game.HostPath != null)
            {
                // Need to have the UMD instance reload to the game
                string gamePath = game.HostPath;
                Debug.Assert(gamePath != null);

                _emulator.Umd.Eject();
                if (_emulator.Umd.Load(gamePath, false) == false)
                {
                    // Failed to load
                }

                // Regrab game info
                game = GameLoader.FindGame(_emulator.Umd);

                Properties.Settings.Default.LastPlayedGame = gamePath;
                Properties.Settings.Default.Save();
            }

            _emulator.SwitchToGame(game);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Exemple #19
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            AdvancedGameListing listing;

            if (whidbeyTabControl1.SelectedTab == whidbeyTabPage1)
            {
                listing = umdGameListing;
            }
            else
            {
                listing = msGameListing;
            }
            GameInformation game = listing.SelectedGame;

            if ((game == null) ||
                (game.HostPath == null))
            {
                return;
            }

            string gamePath = game.HostPath;

            _cache.Remove(gamePath);
            _cache.Save();

            listing.RemoveGame(game);

            umdGameListing_SelectionChanged(umdGameListing, EventArgs.Empty);
        }
        public void Initialize(Game2D game, ILevelDataProvider levelDataProvider)
        {
            _gameInformation = new GameInformation(game, levelDataProvider)
            {
                Width = BombGame.Tilesize * 15
            };

            _graphicsDevice  = game.GraphicsDevice;
            _levelData       = levelDataProvider;
            _context         = new Render3DContext(game);
            _objectsToRender = new List <IRenderObject> {
                new Level(game.GraphicsDevice, game.Content, levelDataProvider)
            };
            _bombGeometry             = new ModelGeometry(this, game.GraphicsDevice, game.Content.Load <Model>("Models/Bomb/BombMesh"), _context.ToonEffect);
            _playerGeometry           = new ModelGeometry(this, game.GraphicsDevice, game.Content.Load <Model>("Models/Player/bomberman"), _context.ToonEffect);
            _baseItemGeometry         = new ModelGeometry(this, game.GraphicsDevice, game.Content.Load <Model>("Models/items/itemBase"), _context.ToonEffect);
            _fireOverlayGeometry      = new ModelGeometry(this, game.GraphicsDevice, game.Content.Load <Model>("Models/items/fireoverlay"), _context.ToonEffect);
            _explosionFragmentManager = new ExplosionFragmentManager(game, _levelData);

            _players = new List <Player>();
            foreach (var figure in _levelData.Figures)
            {
                var player = new Player(figure, _playerGeometry);
                AddRenderObject(player);
                _players.Add(player);
            }

            foreach (var itemDataProvider in _levelData.ItemData)
            {
                AddRenderObject(new Item3D(itemDataProvider, _baseItemGeometry, _fireOverlayGeometry));
            }
        }
        private void GenerateGameInformation()
        {
            GameInformation = new GameInformation();

            foreach (KeyValuePair <uint, List <INetFieldExportGroup> > exportKvp in ExportGroups)
            {
                foreach (INetFieldExportGroup exportGroup in exportKvp.Value)
                {
                    switch (exportGroup)
                    {
                    case SupplyDropLlamaC llama:
                        GameInformation.UpdateLlama(exportKvp.Key, llama);
                        break;

                    case FortPlayerState playerState:
                        break;

                    case GameStateC gameState:
                        if (gameState.GoldenPoiLocationTags != null)
                        {
                        }
                        break;
                    }
                }
            }
        }
 void Start()
 {
     databaseClient = GameObject.FindGameObjectWithTag("DatabaseClient").GetComponent<DatabaseClientScript>();
     gameInfo = GameObject.FindGameObjectWithTag("GameInformation").GetComponent<GameInformation>();
     chatClient = GameObject.FindGameObjectWithTag("ChatClient").GetComponent<ChatClientScript>();
     personCurrent = 0;
 }
Exemple #23
0
 private void OnDestroy()
 {
     if (instance == this)
     {
         instance = null;
     }
 }
        private bool CheckIfEndGame()
        {
            int  playerOneCoinsCounter = 0;
            int  playerTwoCoinsCounter = 0;
            bool isEndGame             = false;

            GameInformation.eWinner winnerID;
            if (GameInformation.IsEndOfGame())
            {
                isEndGame = true;
                winnerID  = GameInformation.CheckWhoWon(ref playerOneCoinsCounter, ref playerTwoCoinsCounter);
                if (winnerID == GameInformation.eWinner.Player1)
                {
                    GameInformation.PlayerOneScore++;
                    showEndGameMessage(k_PlayerOneColor, playerOneCoinsCounter, playerTwoCoinsCounter);
                }
                else if (winnerID == GameInformation.eWinner.Player2)
                {
                    GameInformation.PlayerTwoScore++;
                    showEndGameMessage(k_PlayerTwoColor, playerOneCoinsCounter, playerTwoCoinsCounter);
                }
                else
                {
                    showEndGameMessage("Tie", playerOneCoinsCounter, playerTwoCoinsCounter);
                }
            }
            return(isEndGame);
        }
Exemple #25
0
    public virtual void Start()
    {
        GameObject gameInformationObject = GameObject.Find("GameInformationObject");

        terrain = GameObject.Find("Terrain").GetComponent <Terrain>();
        _info   = gameInformationObject.GetComponent <GameInformation>();
    }
 public void AddTakenPawn(bool isDwarfPlayer, int count)
 {
     for (int i = 0; i < count; i++)
     {
         if (isDwarfPlayer)
         {
             if (BattleInformation.DwarfPlayer.ID == GameInformation.GetCurrentPlayer().ID)
             {
                 HudLink.player1TakenPawnGrid.AddTakenPawn();
             }
             else
             {
                 HudLink.player2TakenPawnGrid.AddTakenPawn();
             }
         }
         else
         {
             if (BattleInformation.TrollPlayer.ID == GameInformation.GetCurrentPlayer().ID)
             {
                 HudLink.player1TakenPawnGrid.AddTakenPawn();
             }
             else
             {
                 HudLink.player2TakenPawnGrid.AddTakenPawn();
             }
         }
     }
 }
Exemple #27
0
        public static void SaveNewPlayer(Player player)
        {
            int newPlayerIndex = GameInformation.GetAllPlayers().Count;

            player.ID = newPlayerIndex;
            Save(Constants.commonPlayerKey + newPlayerIndex, player);
        }
Exemple #28
0
        public ReplayMetadata(GameInformation info)
        {
            if (info == null)
                throw new ArgumentNullException("info");

            GameInfo = info;
        }
Exemple #29
0
        public SubmitGame(GameInformation game)
            : this()
        {
            Debug.Assert(game != null);
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }
            _game = game;

            this.Icon   = IconUtilities.ConvertToIcon(Properties.Resources.ReportIcon);
            _googleIcon = Properties.Resources.Google;

            _service = new Service();
            _service.ListGamesCompleted  += new ListGamesCompletedEventHandler(ServiceListGamesCompleted);
            _service.AddGameCompleted    += new AddGameCompletedEventHandler(ServiceAddGameCompleted);
            _service.AddReleaseCompleted += new AddReleaseCompletedEventHandler(ServiceAddReleaseCompleted);

            if (_gameList == null)
            {
                _service.ListGamesAsync();
                _outstandingRefresh = true;
            }
            else
            {
                this.ServiceListGamesCompleted(null, null);
            }

            this.titleLabel.Text    = _game.Parameters.Title;
            this.discIdLabel.Text   = _game.Parameters.DiscID;
            this.firmwareLabel.Text = _game.Parameters.SystemVersion.ToString();
            this.regionLabel.Text   = _game.Parameters.Region.ToString();
            this.versionLabel.Text  = _game.Parameters.GameVersion.ToString();

            Image gameImage;

            if (_game.Icon != null)
            {
                _game.Icon.Position = 0;
                gameImage           = Image.FromStream(_game.Icon);
            }
            else
            {
                gameImage = Image.FromStream(new MemoryStream(Resources.InvalidIcon, false));
            }
            this.iconPictureBox.Image = gameImage;

            _release               = new GameRelease();
            _release.Title         = _game.Parameters.Title;
            _release.DiscID        = _game.Parameters.DiscID;
            _release.Region        = _game.Parameters.Region;
            _release.SystemVersion = VersionToSingle(_game.Parameters.SystemVersion);
            _release.GameVersion   = VersionToSingle(_game.Parameters.GameVersion);
            if (_game.Icon != null)
            {
                _game.Icon.Position = 0;
                using (BinaryReader reader = new BinaryReader(_game.Icon))
                    _iconBytes = reader.ReadBytes(( int )_game.Icon.Length);
            }
        }
Exemple #30
0
    public void Spawn()
    {
        int manaCost = character.manaCost;

        if (GameInformation.player1Turn == true && manaCost <= GameInformation.currentMana1)
        {
            Character initialCharacter = Instantiate(character.gameObject).GetComponent <Character>();
            initialCharacter.name = Time.time.ToString();
            GameInformation.SpawnCharacter(initialCharacter);
            GameInformation.currentMana1 -= manaCost;
            GameInformation.cardDeck.cardArray.Remove(this);
            GameInformation.cardDeck.UpdateDeck();
            Destroy(this.gameObject);
        }
        if (GameInformation.player1Turn == false && manaCost <= GameInformation.currentMana2)
        {
            Character initialCharacter = Instantiate(character.gameObject).GetComponent <Character>();
            initialCharacter.name = Time.time.ToString();
            GameInformation.SpawnCharacter(initialCharacter);
            GameInformation.currentMana2 -= manaCost;
            GameInformation.cardDeck.cardArray.Remove(this);
            GameInformation.cardDeck.UpdateDeck();
            Destroy(this.gameObject);
        }
    }
Exemple #31
0
        public static void DeletePlayer(Player player)
        {
            //Store all players
            List <Player> playerList = GameInformation.GetAllPlayers();

            //Remove player to delete of the storage list
            foreach (Player tempPlayer in playerList.ToArray())
            {
                if (tempPlayer.ID == player.ID)
                {
                    playerList.Remove(tempPlayer);
                }
            }

            DeleteAllPlayers();

            //Put all player but the deleted one in the PlayerPrefs
            int playerIndex = 0;

            foreach (Player tempPlayer in playerList)
            {
                tempPlayer.ID = playerIndex;
                Save(Constants.commonPlayerKey + playerIndex, tempPlayer);
                playerIndex++;
            }
        }
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        if (_firstClear = false)
        {
            PlayerPrefs.DeleteAll();
            GameInformation.FirstClear = true;
            SaveInformation.SaveAllInformation();
        }

        GameInformation.SpeechAutoPlay = true;
        SaveInformation.SaveAllInformation();

        //LoadInformation.LoadAllInformation();
        Debug.Log(GameInformation.CorrectPreQuestions.Count);
    }
        /// <summary>
        ///
        /// </summary>
        /// <param name="informationIn"></param>
        /// <param name="installedVersionsIn"></param>
        internal FormEditGameSettings(GameInformation informationIn, List <InstalledVersion> installedVersionsIn)
        {
            InitializeComponent();
            information = informationIn;

            comboBox1.Items.Add("Latest");
            if (installedVersionsIn != null)
            {
                comboBox1.Items.AddRange(installedVersionsIn.OrderByDescending(version => version.Name).Select(a => a.Name).ToArray());
            }

            trackBar1.SetRange(0, 100);

            PopulateGameSettings();
            PopulateGraphicsPack();
            PopulateGameInformation();

            Text = information.Name;
            if (information.Name != "The Legend of Zelda Breath of the Wild")
            {
                label52.Visible        = false;
                comboBox32.Visible     = false;
                checkBox1.Visible      = false;
                numericUpDown1.Visible = false;
            }
        }
Exemple #34
0
		public SpawnOccupant(GameInformation.Player player)
		{
			Color = player.Color;
			ClientIndex = player.ClientIndex;
			PlayerName = player.Name;
			Team = player.Team;
			Country = player.FactionId;
			SpawnPoint = player.SpawnPoint;
		}
Exemple #35
0
 // Use this for initialization
 void Start()
 {
     info = (GameInformation) GameObject.Find("GameInformationObject").GetComponent("GameInformation");
     raceSelected = false;
     difficultySelected = false;
     gameModeSelected = false;
     prefabs = new Object[3];
     prefabs[0] = Resources.Load("Prefabs/ErrorMessages/SelectCivilizationMessageError");
     prefabs[1] = Resources.Load("Prefabs/ErrorMessages/ChooseGameModeMessageError");
     prefabs[2] = Resources.Load("Prefabs/ErrorMessages/SkillLevelMessageError");
 }
    void Awake()
    {
        //Check if instance already exists : if not, set instance to this
        if (instance == null) instance = this;

        //If instance already exists and it's not this:
        else if (instance != this) Destroy(gameObject);

        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad(gameObject);
    }
Exemple #37
0
 // Use this for initialization
 void Start()
 {
     if (GameObject.Find("GameInformationObject"))
         info = (GameInformation)GameObject.Find("GameInformationObject").GetComponent("GameInformation");
     bm = new Managers.BuildingsManager();
     sounds = GameObject.Find("GameController").GetComponent<Managers.SoundsManager>();
     if (info) info.LoadHUD();
     StartGame();
     
     UserInput inputs = gameObject.AddComponent<UserInput>();
     bm.Inputs = inputs;
     LoadInitialScreen();
 }
        public SlippiConnection(TcpClient client, NetworkStream stream)
        {
            //Populated MAC and IP
            DeviceIp = ((IPEndPoint)client.Client.RemoteEndPoint).Address;

            //Make new game info
            GameInfo = new GameInformation();

            //Handle receiving messages
            Observable.Start(async () =>
            {
                try
                {
                    while(client.Connected)
                    {
                        //First always start by reading the size of the message
                        var lengthBytes = await stream.ReadExactBytesAsync(4);
                        var messageLength = BitConverter.ToInt32(lengthBytes.Reverse().ToArray(), 0);

                        //Make sure message length isn't too long
                        if (messageLength > MAX_MESSAGE_LENGTH || messageLength < 0) throw new Exception("Message length was too long or too short. Length: " + messageLength);

                        //Read messageLength bytes
                        var message = await stream.ReadExactBytesAsync(messageLength);

                        //foreach (byte b in message) System.Diagnostics.Trace.WriteLine(string.Format("[{0:X2}]", b));

                        //Pass off message to GameInfo
                        GameInfo.ProcessMessage(message);
                        //var buf = new byte[32];
                        //var amountRead = stream.Read(buf, 0, 32);
                        //for (int i = 0; i < amountRead; i++) System.Diagnostics.Trace.WriteLine(string.Format("[{0:X2}]", buf[i]));
                    }

                    logger.Info("Client connected flag is no longer true.");
                }
                catch (Exception ex)
                {
                    logger.Info(ex, "Connection threw an exception.");
                }
                finally
                {
                    stream.Close();
                    Dispose();
                }
            }, System.Reactive.Concurrency.TaskPoolScheduler.Default);
        }
Exemple #39
0
        ReplayMetadata(FileStream fs, string path)
        {
            FilePath = path;

            // Read start marker
            if (fs.ReadInt32() != MetaStartMarker)
                throw new InvalidOperationException("Expected MetaStartMarker but found an invalid value.");

            // Read version
            var version = fs.ReadInt32();
            if (version != MetaVersion)
                throw new NotSupportedException("Metadata version {0} is not supported".F(version));

            // Read game info (max 100K limit as a safeguard against corrupted files)
            var data = fs.ReadString(Encoding.UTF8, 1024 * 100);
            GameInfo = GameInformation.Deserialize(data);
        }
Exemple #40
0
 public GameInformation R4IGetGameName()
 {
     var info = new GameInformation();
     var retBuffer = SendCommand(GetHeaderBytes, GetHeaderResponse);
     var stringBytes = new byte[12];
     if (retBuffer == null)
         return info;
     Buffer.BlockCopy(retBuffer,0x40,stringBytes,0,stringBytes.Length);
     info.Name = stringBytes[0] != 0 ? Encoding.ASCII.GetString(stringBytes) : "0x" + retBuffer[0x240].ToString("X") + retBuffer[0x241].ToString("X") + retBuffer[0x242].ToString("X");
     if (stringBytes[0] == 0) //3DS ?
         info.SaveFlashSize = retBuffer[0x242] == 0x11 ? 0x20000 : retBuffer[0x242] == 0x13 ? 0x80000 : 0;
     else
     {
         info.SaveFlashSize = 512; //Don't know ???
     }
     
     return info;
 }
        /// <summary>
        /// Retrieve or instantiate the required components
        /// </summary>
        private bool LoadRequiredComponents()
        {
            //Checks if informationObject exists
            if (!informationObject)
            {
                informationObject = GameObject.Find("GameInformationObject");
                if (informationObject) return false;

                informationObject = new GameObject("GameInformationObject");
                informationObject.AddComponent<GameInformation>();
                gameInfo = informationObject.GetComponent<GameInformation>();
                gameInfo.setGameMode(GameInformation.GameMode.SKIRMISH);
                _destroyWelcome = true;
            }

            return true;

        }
 public GameMakerFile()
 {
     Sprites = new SpriteCollection();
       Sounds = new SoundCollection();
       Backgrounds = new BackgroundCollection();
       Paths = new PathCollection();
       Scripts = new ScriptCollection();
       Fonts = new FontCollection();
       TimeLines = new TimeLineCollection();
       Objects = new ObjectCollection();
       Rooms = new RoomCollection();
       Triggers = new TriggerCollection();
       Includes = new IncludedFileCollection();
       Constants = new ConstantCollection();
       Information = new GameInformation();
       Settings = new GameSettings();
       ResourceTree = new ResourceTree();
 }
Exemple #43
0
 public string serialize(GameInformation saveData, string fileName)
 {
     BinaryFormatter formatter = new BinaryFormatter();
     if (!Directory.Exists(Application.persistentDataPath + "/SaveGames/"))
     {
         Directory.CreateDirectory(Application.persistentDataPath + "/SaveGames/");
     }
     try
     {
         Stream file = new FileStream(Application.persistentDataPath + "/SaveGames/" + fileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
         formatter.Serialize(file, saveData);
         file.Close();
         return "saved";
     }
     catch
     {
         return "error";
     }
 }
Exemple #44
0
    public void Setup(GameInformation gi)
    {
        info = gi;
        if (info.gameName != null) {
            name = info.gameName;
        } else {
            name = "Unnamed Game";
            info.gameName = "Unnamed Game";
        }

        if (info.imagePath != null) {
            WWW www = new WWW (info.imagePath);
            loadImageUrl (www);

            renderer.material.mainTexture = www.texture;
            www.Dispose ();
            www = null;
        } else {
            renderer.material.mainTexture = MenuManager.Instance.GetNoImageTex ();
        }
    }
Exemple #45
0
    void Awake()
    {
        if(instanceRef == null)
        {
            instanceRef = this;
            audioSource = gameObject.GetComponent<AudioSource>();

            if (PlayerPrefs.HasKey("VolumeLevel"))
            {
                audioSource.volume = PlayerPrefs.GetFloat("VolumeLevel", 1.0f);
            }

            DontDestroyOnLoad(gameObject);
        }
        else
        {
            DestroyImmediate(gameObject);
        }

        SaveLoad.LoadGameInformation();
    }
    void Start()
    {
        objCamera = (tk2dCamera) GameObject.FindWithTag("MainCamera").GetComponent<tk2dCamera>();
        objPlayer = (GameObject)GameObject.FindWithTag("Player");
        ptrScriptVariable = (VariableScript)objPlayer.GetComponent(typeof(VariableScript));
        objGameInfo = GameObject.FindGameObjectWithTag("GameInformation").GetComponent<GameInformation>();

        // Get turret GameObjects
        turrets = GameObject.FindGameObjectsWithTag("Turret");
        //Debug.Log("PlayerController:Start - turrets.Count = " +turrets.Length);

        enemySpawner = GameObject.FindGameObjectWithTag("EnemySpawner");
    }
Exemple #47
0
 // Use this for initialization
 void Start()
 {
     gameInformationScript = GameObject.Find ("ScriptContainer").GetComponent<GameInformation> ();
     textOnStartTimeBtn = GameObject.FindGameObjectWithTag ("TimeStartButton").GetComponent<Text> ();
     UIDataScript = GameObject.Find ("ScriptContainer").GetComponent<UIdataImporter>();
     textOnBuyLandBtn = GameObject.FindGameObjectWithTag ("TextOnBuyLandBtn").GetComponent<Text> ();
     dataReaderScript = GameObject.Find ("ScriptContainer").GetComponent<DataReader> ();
     inputFiledAtComboBox = GameObject.FindGameObjectWithTag ("inputFiledAtComboBox").GetComponent<InputField> ();
     buyLandButton = GameObject.Find ("BuyLandBtn").GetComponent<Button> ();
 }
 void Awake()
 {
     Instance = this;
     GameState = GameState.PreGame;
 }
 protected abstract void ProcessResource( GameInformation aGameInformation );
Exemple #50
0
 public void Process(GameInformation info)
 {
     title.GetComponent<TextMesh> ().text = WordWrap (info.gameName, titleWidth);
     description.GetComponent<TextMesh> ().text = WordWrap (info.description, descriptionWidth);
     authors.GetComponent<TextMesh> ().text = WordWrap (System.String.Join ("\n", info.authors), authorsWidth);
 }
 void Start()
 {
     gameInformation = new GameInformation ();
 }
    void Start()
    {
        chatClient = GameObject.FindGameObjectWithTag("ChatClient");
        gameInformation = GameObject.FindGameObjectWithTag("GameInformation").GetComponent<GameInformation>();
        peopleInformation = GameObject.FindGameObjectWithTag("PeopleInformation").GetComponent<PeopleInformation>();
        databaseClient = GameObject.FindGameObjectWithTag("DatabaseClient").GetComponent<DatabaseClientScript>();
        userChatText = GameObject.FindGameObjectWithTag("UserChatText").GetComponent<Text>();
        optionOne = GameObject.FindGameObjectWithTag("OptionOne");
        optionOneText = optionOne.GetComponent<Text>();
        optionTwo = GameObject.FindGameObjectWithTag("OptionTwo");
        optionTwoText = optionTwo.GetComponent<Text>();
        optionThree = GameObject.FindGameObjectWithTag("OptionThree");
        optionThreeText = optionThree.GetComponent<Text>();
        leftBtn = GameObject.FindGameObjectWithTag("LeftButton").GetComponent<Button>();
        rightBtn = GameObject.FindGameObjectWithTag("RightButton").GetComponent<Button>();
        sendBtn = GameObject.FindGameObjectWithTag("SendButton").GetComponent<Button>();
        skipBtn = GameObject.FindGameObjectWithTag("SkipButton").GetComponent<Button>();

        sendBtn.interactable = false;
        leftBtn.interactable = false;
        rightBtn.interactable = false;
        optionOne.SetActive(false);
        optionTwo.SetActive(false);
        optionThree.SetActive(false);
    }
        protected override void ProcessResource( GameInformation aInformation )
        {
            string pathDocument = null;

              OnCategoryProcessing( ResourceTypes.Information );

              if ( aInformation.RtfInformation != null ) {
            pathDocument = "GameInformation.rtf";

            using ( var file = File.Create( pathDocument ) )
              file.Write( aInformation.RtfInformation, 0, aInformation.RtfInformation.Length );
              }

              var document =
            new XElement( "GameInformation",
              new XElement( "Caption", aInformation.Caption ),
              new XElement( "WindowX", aInformation.WindowX ),
              new XElement( "WindowY", aInformation.WindowY ),
              new XElement( "WindowWidth", aInformation.WindowWidth ),
              new XElement( "WindowHeight", aInformation.WindowHeight ),
              new XElement( "SeperateWindow", aInformation.SeperateWindow ),
              new XElement( "ShowNonClientArea", aInformation.ShowNonClientArea ),
              new XElement( "SizeableWindow", aInformation.SizeableWindow ),
              new XElement( "AlwaysOnTop", aInformation.AlwaysOnTop ),
              new XElement( "StopGame", aInformation.StopGame ),
              new XElement( "BackgroundColor", ColorTranslator.ToHtml( aInformation.BackgroundColor ) ),
              new XElement( "InformationFile", pathDocument )
            );

              SaveDocument( document, Filenames.GameInformation + ".xml" );
              OnCategoryProcessed( ResourceTypes.Information );
        }
Exemple #54
0
 void Start()
 {
     objGameInfo = GameObject.FindGameObjectWithTag("GameInformation").GetComponent<GameInformation>();
 }
    void CreateGameInformationObject()
    {
        Debug.Log("GameOverController:CreateGameInformationObject()");

        objGameInfo = new GameInformation();
    }
    void Start()
    {
        Screen.showCursor = true;

        GameObject oTemp = GameObject.FindGameObjectWithTag("GameInformation");

        objGameInfo = new GameInformation();

        if (oTemp != null)
        {
            objGameInfo = oTemp.GetComponent<GameInformation>();
        }
        else
        {
            Debug.Log("GameOverController:Start1() - oTemp == null");

            objGameInfo = new GameInformation();
        }

        StartCoroutine(LoadScoreBoard());

        objFlashText.text = string.Format("You got {0} points in {1:0.000} seconds!",
            GameInfoManager.Instance.Score,
            GameInfoManager.Instance.TimeAlive);
        objFlashText.Commit();
    }
 void Start()
 {
     databaseClient = GameObject.FindGameObjectWithTag("DatabaseClient");
     gameInformation = GameObject.FindGameObjectWithTag("GameInformation").GetComponent<GameInformation>();
     peopleInformation = GameObject.FindGameObjectWithTag("PeopleInformation").GetComponent<PeopleInformation>();
     idText = GameObject.FindGameObjectWithTag("ID").GetComponent<Text>();
     firstnameText = GameObject.FindGameObjectWithTag("Firstname").GetComponent<Text>();
     surnameText = GameObject.FindGameObjectWithTag("Surname").GetComponent<Text>();
     subjectText = GameObject.FindGameObjectWithTag("Subject").GetComponent<Text>();
     cardnameText = GameObject.FindGameObjectWithTag("Cardname").GetComponent<Text>();
     cardnumText = GameObject.FindGameObjectWithTag("Cardnum").GetComponent<Text>();
     expirationdateText = GameObject.FindGameObjectWithTag("ExpirationDate").GetComponent<Text>();
     codeText = GameObject.FindGameObjectWithTag("Code").GetComponent<Text>();
     statusText = GameObject.FindGameObjectWithTag("Status").GetComponent<Text>();
     cardnameInput = GameObject.FindGameObjectWithTag("CardNameInput").GetComponent<InputField>();
     cardnumInput = GameObject.FindGameObjectWithTag("CardNumberInput").GetComponent<InputField>();
     expirationdateInput = GameObject.FindGameObjectWithTag("ExpirationDateInput").GetComponent<InputField>();
     codeInput = GameObject.FindGameObjectWithTag("SecurityCodeInput").GetComponent<InputField>();
     submitBtn = GameObject.FindGameObjectWithTag("SubmitBtn").GetComponent<Button>();
     clientBtn = GameObject.FindGameObjectWithTag("ClientBtn").GetComponent<Button>();
 }