예제 #1
0
        public void ChangeGameMode(GameModes gameMode, bool demoMode, MapData mapData)
        {
            framework_Canvas.Children.Remove(framework_Game.GetGame_Grid());
            framework_Game.DeactivateGame();

            switch (gameMode)
            {
            case GameModes.Training:
                framework_Game = new Training(this, demoMode, mapData);
                break;

            case GameModes._1v1:
                framework_Game = new _1v1(this, demoMode, mapData);
                break;

            case GameModes._4PlayerFFA:
                framework_Game = new _4PlayerFFA(this, demoMode, mapData);
                break;
            }

            if (framework_Game != null)
            {
                Panel.SetZIndex(framework_Game.GetGame_Grid(), 0);
            }
            if (framework_Menu != null)
            {
                Panel.SetZIndex(framework_Menu.GetMenu_Canvas(), 1);
            }
        }
예제 #2
0
        public void Play(GameModes mode)
        {
            GamePlaying = true;
            GameMode    = mode;
            CandyCount  = MAX_CANDIES;

            if (GameMode == GameModes.SinglePlayer)
            {
                ai = new RandomGameAI();
                Message(AI_PLAY_MESSAGE);
                Message(string.Format(AI_TURN_MESSAGE, Moves.One));
                CandyCount -= 1;
            }
            else if (GameMode == GameModes.SinglePlayerHard)
            {
                ai = new SmartGameAI();
                Message(SMART_AI_PLAY_MESSAGE);
                Message(string.Format(AI_TURN_MESSAGE, Moves.One));
                CandyCount -= 1;
            }
            else
            {
                Message(string.Format(PLAY_MESSAGE, mode));
            }
        }
예제 #3
0
    /// <summary>
    /// Unity Start Function ( initialise variables )
    /// </summary>
    private void Start()
    {
        // Get Components
        m_gameMode       = GameObject.FindGameObjectWithTag("BattleScene").GetComponent <GameModes>();
        m_Animator       = GetComponent <Animator>();
        m_swipeComponent = GetComponent <Touch_Swipe>();
        m_rigidBody      = GetComponent <Rigidbody>();
        ParticleParent   = GameObject.FindGameObjectWithTag("ParticlesHolder");

        // Initialising Variables
        m_bSpawn               = false;
        m_bStunned             = false;
        m_swipeDirection.Value = (int)m_swipeComponent.SwipeDirection;
        m_originalPlayerIndex  = m_playerLaneIndex;

        // Send Player Obj
        ES_Event_Object temp = m_cameraPlayer as ES_Event_Object;

        temp.RaiseEvent(gameObject);

        // Initialising Player States
        m_stateMachine = new StateMachine();
        m_stateMachine.AddState(new StatePlayerIdle("Idle", gameObject));
        m_stateMachine.AddState(new StatePlayerLose("PlayerLose", gameObject));
        m_stateMachine.AddState(new StatePlayerVictory("PlayerVictory", gameObject));
        m_stateMachine.SetNextState("Idle");
    }
예제 #4
0
    public void SetGameOver()
    {
        audioPlayer.SetMusicDefaults();
        questionManager.StopAllCoroutines();
        questionManager.Confetti.Stop();
        if (questionManager.Score >= WinScore)
        {
            questionManager.Confetti.Stop();
            audioPlayer.SetMusicPitch(1.25f);
            EndQuote.text  = "Y O U\nD I D\nG R E A T !";
            EndQuote.color = questionManager.DefaultColour[2];
        }
        else
        {
            audioPlayer.SetMusicPitch(0.75f);
            audioPlayer.PlaySFX(Lose);
            EndQuote.text  = "P L E A S E\nT R Y\nA G A I N !";
            EndQuote.color = questionManager.DefaultColour[4];
        }

        Panels[0].DOAnchorPos(new Vector2(0, -1750), 0.25f);
        Panels[1].DOAnchorPos(new Vector2(0, 1750), 0.25f);
        Panels[2].DOAnchorPos(Vector2.zero, 0.25f).SetDelay(0.25f);

        gameMode = GameModes.GameOver;
    }
예제 #5
0
 public override void OnSomeOneIsDead(int id)
 {
     if (!Round.IsWinning && !Round.IsLosing)
     {
         GameModes.CheckGameEnd();
     }
 }
예제 #6
0
 protected override void OnPanelDisable()
 {
     rect  = null;
     left  = null;
     right = null;
     GameModes.Save();
 }
예제 #7
0
        private void ReadHeader()
        {
            if (_reader == null)
            {
                throw new NullReferenceException("_reader");
            }

            GameMode           = (GameModes)_reader.ReadByte();
            Version            = _reader.ReadInt32();
            BeatmapHash        = ReadString();
            PlayerName         = ReadString();
            ReplayHash         = ReadString();
            Count300           = _reader.ReadUInt16();
            Count100           = _reader.ReadUInt16();
            Count50            = _reader.ReadUInt16();
            CountGeki          = _reader.ReadUInt16();
            CountKatu          = _reader.ReadUInt16();
            CountMiss          = _reader.ReadUInt16();
            TotalScore         = _reader.ReadInt32();
            MaxCombo           = _reader.ReadUInt16();
            Perfect            = _reader.ReadBoolean();
            EnabledMods        = (Mods)_reader.ReadInt32();
            LifebarGraphString = ReadString();
            TimeStamp          = ReadDateTime();
        }
예제 #8
0
    void OnGameEnded()
    {
        Ball.BallDissapeared -= OnBallDissapared;
        Destroy(_activeBall.gameObject);

        if (_gameMode == GameModes.Offline)
        {
            if (_offlinePlayer != null)
            {
                Destroy(_offlinePlayer.gameObject);
            }
        }
        else
        {
            if (_onlinePlayer != null)
            {
                Destroy(_onlinePlayer.gameObject);
            }
        }

        _gameMode   = GameModes.Menu;
        _activeBall = null;

        if (PhotonNetwork.connected)
        {
            PhotonNetwork.Disconnect();
        }
    }
예제 #9
0
        public Match AddNewMatch(MatchInfo matchInfo, Models.Server server)
        {
            var match = new Match
            {
                Server      = server,
                Timestamp   = matchInfo.Timestamp,
                Map         = Maps.FindOrAddMap(matchInfo.Map),
                GameMode    = GameModes.FindOrAddGameMode(matchInfo.GameMode),
                FragLimit   = matchInfo.FragLimit,
                TimeLimit   = matchInfo.TimeLimit,
                TimeElapsed = matchInfo.TimeElapsed
            };

            foreach (var scoreInfo in matchInfo.Scoreboard)
            {
                var score = new Score
                {
                    Match    = match,
                    Position = scoreInfo.Position,
                    Player   = Players.FindOrAddPlayer(scoreInfo.Name),
                    Frags    = scoreInfo.Frags,
                    Kills    = scoreInfo.Kills,
                    Deaths   = scoreInfo.Deaths
                };

                match.Scoreboard.Add(score);
            }

            match.IsProcessedForStatistics = false;

            Matches.Add(match);

            return(match);
        }
예제 #10
0
        void LaunchSettingsPage(GameModes gameMode)
        {
            AudioManager.PlayClick();
            Page settingsPage = new SettingsPage(new GameSettings(gameMode));

            Navigation.PushModalAsync(settingsPage);
        }
예제 #11
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
예제 #12
0
    ///Switches the Game's mode
    void Switch_Game_Mode(GameModes toMode)
    {
        try{
            switch (toMode)
            {
            //Race
            case GameModes.Race:

                break;

            //Tag
            case GameModes.Tag:

                break;

            //Battle
            case GameModes.Battle:

                break;
            }
            game_Mode = toMode;
        }catch {
            Debug.LogAssertion("ASSERT ERROR: GameMode Switch Error.");
        }
    }
예제 #13
0
        private void reset()
        {
            ID         = 0;
            EID        = GameModes.nothing;
            isGame     = false;
            isStarted  = false;
            infCounter = 15;
            cleanPlayers();
            wipe();

            foreach (BasePlayer player in playerList)
            {
                player.MovePosition(spawn);
            }
            foreach (BasePlayer player in playerList2)
            {
                player.MovePosition(spawn);
            }

            playerList  = new List <BasePlayer>();
            playerList2 = new List <BasePlayer>();
            playerList3 = new List <BasePlayer>();
            voteMap     = new List <int>();
            voteMap.Add(0);
            voteMap.Add(0);
            voteMap.Add(0);
            playerNumbers  = new List <int>();
            playerNumbers2 = new List <int>();

            voteMap[0] = 0;
            voteMap[1] = 0;
            MID        = Maps.nothing;
        }
예제 #14
0
        public bool OnHit(BaseController self, ProjectileHandler projectile)
        {
            cooldown = 5;

            if (!projectile || shield <= 0)
            {
                return(!Remaining);
            }

            Transform debrisParent = GameModes.GetDebrisTransform(self.team);

            if (shield >= projectile.damage)
            {
                ShieldHealth(-projectile.damage, self);
                Shielded(projectile.transform.position, debrisParent);
                projectile.active = false;

                return(!Remaining);
            }

            projectile.damage -= shield;
            ShieldHealth(-shield, self);
            Shielded(projectile.transform.position, debrisParent);

            return(!Remaining);
        }
예제 #15
0
        private bool CheckDefault()
        {
            DsFilter defaultFilter = new DsFilter();

            if (MinDuration == defaultFilter.MinDuration &&
                MaxDuration == defaultFilter.MaxDuration &&
                MinArmy == defaultFilter.MinArmy &&
                MinIncome == defaultFilter.MinIncome &&
                MaxLeaver == defaultFilter.MaxLeaver &&
                MinKills == defaultFilter.MinKills &&
                PlayerCount == defaultFilter.PlayerCount &&
                Mid == defaultFilter.Mid &&
                !(GameModes.Except(new List <int>()
            {
                (int)Gamemode.Commanders, (int)Gamemode.CommandersHeroic
            }).Any() ||
                  (new List <int>()
            {
                (int)Gamemode.Commanders, (int)Gamemode.CommandersHeroic
            }).Except(GameModes).Any()) &&
                !Players.Any() &&
                DefaultTime
                )
            {
                return(true);
            }
            return(false);
        }
예제 #16
0
파일: Program.cs 프로젝트: JOCP9733/tank
        private static void OnSelectionCallback(int selection)
        {
            GameModes mode = (GameModes)selection;

            _game.RemoveScene();
            switch (mode)
            {
            case GameModes.Network:
                //the following 3 lines are everything you need for a menu
                UiManager uiManager = new UiManager();
                uiManager.ShowListMenu("create server?", "tank.Code.YESORNOCHOOSENOW", ServerSelectionCallback);
                _game.AddScene(uiManager.Scene);
                break;

            case GameModes.Testing:
                GameMode = new TestingMode();
                _game.AddScene(GameMode.Scene);
                break;

            case GameModes.LocalMultiplayer:
                GameMode = new LocalMultiplayer();
                _game.AddScene(GameMode.Scene);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }
예제 #17
0
    protected ProjectileHandler SpawnProjectile(
        BaseController sender, Vector2 direction,
        WeaponStats stats, float damage, float statsMod = 1)
    {
        GameObject projectile = Instantiate(projectilPrefab,
                                            GameModes.GetDebrisTransform(sender.team));

        projectile.name = $"{gameObject.name}_Projectile";

        projectile.transform.position =
            (Vector2)transform.position + direction;

        ProjectileHandler handler = projectile
                                    .GetComponent <ProjectileHandler>();

        handler.onUpdate = OnProjectileUpdate;
        handler.onHit    = OnProjectileHit;

        Collider2D collider = handler.body
                              .GetComponent <Collider2D>();

        Physics2D.IgnoreCollision(collider, sender.body.Collider);

        handler.SetStats(sender, damage * statsMod,
                         (life + stats.life) / statsMod,
                         ((speed + stats.speed) / statsMod) * direction.normalized,
                         ((force + stats.force) / 4) * statsMod);

        sender.perks.Activate <IProjectileFired>(1, perk =>
                                                 perk.OnFire(handler));

        return(handler);
    }
예제 #18
0
        public Replay(Replay replay)
        {
            GameMode     = replay.GameMode;
            Filename     = replay.Filename;
            FileFormat   = replay.FileFormat;
            MapHash      = replay.MapHash;
            PlayerName   = replay.PlayerName;
            ReplayHash   = replay.ReplayHash;
            TotalScore   = replay.TotalScore;
            Count300     = replay.Count300;
            Count100     = replay.Count100;
            Count50      = replay.Count50;
            CountGeki    = replay.CountGeki;
            CountKatu    = replay.CountKatu;
            CountMiss    = replay.CountMiss;
            MaxCombo     = replay.MaxCombo;
            IsPerfect    = replay.IsPerfect;
            Mods         = replay.Mods;
            LifeFrames   = replay.LifeFrames;
            PlayTime     = replay.PlayTime;
            ReplayLength = replay.ReplayLength;
            ReplayFrames = new List <ReplayFrame>();
            replay.ReplayFrames.ForEach((x) => ReplayFrames.Add((ReplayFrame)x.Clone()));
            Seed = replay.Seed;

            culture      = new CultureInfo("en-US", false);
            headerLoaded = replay.headerLoaded;
        }
예제 #19
0
        /// <summary>
        /// Start a new game
        /// </summary>
        public void GameStartUp(GameModes mode)
        {
            // Reset variables and flags
            red.Reset();                    //Reset Red variables
            green.Reset();                  //Reset Green variables

            // Reset game varibles
            redSwitchTurnedOn   = false;
            greenSwitchTurnedOn = false;
            speedMode           = false;
            redTower            = -1;
            greenTower          = -1;
            selectedTowerCombo  = -1;

            //Switch Game Mode to Reset Field
            gameMode = fc.ChangeGameMode(GameModes.reset);
            Thread.Sleep(200);

            //Clear all the nodes' information
            fc.ClearNodeState();
            fc.GetNodeState();

            // Set game field to ready
            gameMode = fc.ChangeGameMode(GameModes.ready);
            Thread.Sleep(1000);

            // Set to mode and start game
            gameMode = fc.ChangeGameMode(mode);

            GameLog("Game Started");
        }
예제 #20
0
    public void ToggleSettings(bool isShown, bool isAnimated)
    {
        phone.SetActive(isShown);
        if (isShown)
        {
            prevMode = InitStateManager.currGameMode;
            if (prevMode != GameModes.Menu)
            {
                InitStateManager.currGameMode = GameModes.Menu;
            }
        }


        if (isAnimated && isShown)
        {
            phoneAnim.enabled = true;
            phoneAnim.Play("PhonePopUP");
            AudioManager.instance.PlayAtRandomPitch("PhonePullOutSFX");
        }
        else if (isAnimated && !isShown)
        {
            phoneAnim.enabled = true;
            phoneAnim.Play("PhonePopDown");
            AudioManager.instance.PlayAtRandomPitch("PhonePullOutSFX");
        }
    }
예제 #21
0
 public override void OnSomeOneIsDead(int id)
 {
     if (!Round.IsWinning && !Round.IsLosing)
     {
         FengGameManagerMKII.FGM.StartCoroutine(GameModes.CheckGameEnd());
     }
 }
예제 #22
0
        public Lobby(
            string gameID,
            string host,
            string hostID,
            ObservableCollection <Player> players,
            GameModes gameMode,
            DifficultyLevel difficulty,
            int playersCount,
            int nPlayersMax,
            Languages language,
            int nbRounds
            )
        {
            PlayersCount = playersCount;
            Players      = players;
            PlayersMax   = nPlayersMax;

            ID         = gameID;
            Host       = host;
            HostID     = hostID;
            Mode       = gameMode;
            Difficulty = difficulty;
            Language   = language;
            Rounds     = nbRounds;

            Duration = CalculateDuration();
        }
예제 #23
0
        private void RefreshModes()
        {
            if (_dispatcher.CheckAccess() == false)
            {
                _dispatcher.Invoke(new Action(RefreshModes));
                return;
            }
            Log.Info("Refreshing modes");
            GameModes.Clear();

            if (Game == null)
            {
                Log.Warn("Game is null, can't refresh modes. User probably uninstalled the game.");
                return;
            }
            //pack://application:,,,/OCTGN;component/Resources/gamemode.png"
            var mode = new GameMode();

            mode.Name  = "Back";
            mode.Image = "pack://application:,,,/OCTGN;component/Resources/circle-back-button.png";
            GameModes.Add(mode);
            foreach (var m in Game.Modes)
            {
                if (m.Image == null)
                {
                    m.Image = "pack://application:,,,/OCTGN;component/Resources/gamemode.png";
                }
                GameModes.Add(m);
            }
            Log.Info("Refreshed modes");
        }
예제 #24
0
파일: GUIManager.cs 프로젝트: Zulban/viroid
 public void endLevel()
 {
     gameMode = GameModes.endlevel;
     setGameState (true);
     PlayerCounter pc=(PlayerCounter)FindObjectOfType(typeof(PlayerCounter));
     ScoreCalculator.setScoreDialogue(endLevelMenu,pc,worldManager.getFinalVoxelCount());
 }
예제 #25
0
        static void TurnLoops()
        {
            while (true)
            {
                var game = GameModes.FullNewStratego(null, null);
                game.rules.LoggingSettings = new GameRules.LogSettings()
                {
                    logTime = false,
                    showEachPlayersPlanning = false,
                    showStatePerTurn        = false,
                    showMovePerTurn         = false,
                    pausePerMove            = false,
                    listMoveSeqenceAtEnd    = true,
                };
                game.rules.MaxPhysicalTurns = 200;

                Console.WriteLine("New game: ");
                Console.WriteLine(game.CurrentBoard.ToAsciiLayout());

                Console.WriteLine(" press enter to begin turns");
                //Console.ReadLine();

                var results = game.Run();

                Console.WriteLine($"Turns: {results.turnsElapsed}, Time: {results.timeElapsed.ToReadable()},  Winners: ");
                foreach (Player p in results.Winners)
                {
                    Console.WriteLine("- " + p.FriendlyName);
                }

                Console.WriteLine("---- end of game ---- press <enter> to continue");
                //Console.ReadLine();
            }
        }
예제 #26
0
 /// <summary>
 /// Add all game modes by default
 /// </summary>
 public LobbySearchFilter()
 {
     foreach (var value in Enum.GetNames(typeof(GameMode)))
     {
         GameModes.Add((GameMode)Enum.Parse(typeof(GameMode), value));
     }
 }
예제 #27
0
        // On Update

        internal void Update()
        {
            if ((MenuManager.Instance.IsReturningToMainMenu || Global.IsApplicationClosing) && CurrentGame != GameModes.NONE)
            {
                CurrentGame = GameModes.NONE;
                if (!PhotonNetwork.isNonMasterClientInRoom)
                {
                    StopGameplay("The host has left the game!");
                }
            }

            if (CustomKeybindings.GetKeyDown(MenuKey))
            {
                PvPGUI.Instance.ShowGUI = !PvPGUI.Instance.ShowGUI;
            }

            // make sure game is running
            if (Global.Lobby.PlayersInLobbyCount < 1 || NetworkLevelLoader.Instance.IsGameplayPaused)
            {
                return;
            }

            // update custom gameplay
            if (CurrentGame != GameModes.NONE)
            {
                UpdateGameplay();
            }
        }
예제 #28
0
        internal void Update()
        {
            if ((MenuManager.Instance.IsReturningToMainMenu || Global.IsApplicationClosing) && CurrentGame != GameModes.NONE)
            {
                CurrentGame = GameModes.NONE;
                if (!PhotonNetwork.isNonMasterClientInRoom)
                {
                    StopGameplay("The host has left the game!");
                }
            }

            // make sure game is running
            if (Global.Lobby.PlayersInLobbyCount < 1 || NetworkLevelLoader.Instance.IsGameplayPaused)
            {
                return;
            }

            // handle player input
            foreach (PlayerSystem ps in Global.Lobby.PlayersInLobby.Where(x => x.ControlledCharacter.IsLocalPlayer))
            {
                if (CustomKeybindings.m_playerInputManager[ps.PlayerID].GetButtonDown(MenuKey))
                {
                    PvPGUI.Instance.showGui = !PvPGUI.Instance.showGui;
                }
            }

            // update custom gameplay
            if (CurrentGame != GameModes.NONE)
            {
                UpdateGameplay();
            }
        }
예제 #29
0
        public void SetModeCheck(GameModes mode)
        {
            switch (mode)
            {
            case GameModes.EASY:
                beginnerToolStripMenuItem.Checked     = true;
                intermediateToolStripMenuItem.Checked = false;
                advancedToolStripMenuItem.Checked     = false;
                customToolStripMenuItem.Checked       = false;
                break;

            case GameModes.INTERMEDIATE:
                intermediateToolStripMenuItem.Checked = true;
                beginnerToolStripMenuItem.Checked     = false;
                advancedToolStripMenuItem.Checked     = false;
                customToolStripMenuItem.Checked       = false;
                break;

            case GameModes.ADVANCED:
                advancedToolStripMenuItem.Checked     = true;
                intermediateToolStripMenuItem.Checked = false;
                beginnerToolStripMenuItem.Checked     = false;
                customToolStripMenuItem.Checked       = false;
                break;

            case GameModes.CUSTOM:
                customToolStripMenuItem.Checked       = true;
                intermediateToolStripMenuItem.Checked = false;
                beginnerToolStripMenuItem.Checked     = false;
                advancedToolStripMenuItem.Checked     = false;
                break;
            }
        }
예제 #30
0
        private void setGameMode(GameModes gameMode)
        {
            switch (gameMode)
            {
            case GameModes.SecondTimeThrough:
                useDifficultyEnhancer1();
                useDifficultyEnhancer3();
                break;

            case GameModes.Veteran:
                useDifficultyEnhancer1();
                useDifficultyEnhancer5();
                useDifficultyEnhancer6();
                break;

            case GameModes.Expert:
                useDifficultyEnhancer1();
                useDifficultyEnhancer3();
                useDifficultyEnhancer4();
                break;

            case GameModes.HellInSpace:
                useDifficultyEnhancer1();
                useDifficultyEnhancer3();
                useDifficultyEnhancer4();
                useDifficultyEnhancer5();
                break;

            case GameModes.Custom:
                useDifficultyEnhancer3();
                break;
            }
        }
예제 #31
0
    public void SetState(GameModes newMode, bool open)
    {
        if (open)
        {
            open = false;

            for (int i = 0; i < supportedModes.Length; i++)
            {
                if (newMode == supportedModes[i])
                {
                    open = true;
                    break;
                }
            }
        }


        if (open)
        {
            doorCollider.enabled  = false;
            portalTrigger.enabled = true;
            anim.SetBool("Open", true);
        }
        else
        {
            doorCollider.enabled  = true;
            portalTrigger.enabled = false;
            anim.SetBool("Open", false);
        }
    }
예제 #32
0
        public Server(int port, int maxConnections, GameModes auth, string password)
        {
            this.maxConnections = maxConnections;
            this.port = port;
            this._listener = new TcpListener(ip, port);
            this.Connections = new Dictionary<int, Client>(maxConnections);
            this.listenThread = new Thread(StartListening);
            this.logPackets = Program.Settings["logPackets"];
            this.acceptServers = Program.Settings["acceptServerSockets"];

            this.Blacklist = new List<string>();

            Password = password;
            GameMode = auth;
        }
예제 #33
0
        public void NewGame()
        {
            GameMode = GameModes.Playing;

            _characters[0] = new Character(new Vector2(100f, 100f), CharDefs[(int)CharacterType.Guy], 0,
                Character.TeamGoodGuys) { Map = _map };
            _characters[0].Hp = _characters[0].Mhp = 100;
            for (var i = 1; i < _characters.Length; i++) _characters[i] = null;

            _particleManager.Reset();
            _map.Path = "start";
            _map.GlobalFlags = new MapFlags(64);
            _map.Read();
            _map.TransDir = TransitionDirection.Intro;
            _map.TransInFrame = 1f;
        }
예제 #34
0
파일: God.cs 프로젝트: choephix/G11
    internal static void OnModeChange( GameModes newMode, GameModes oldMode )
    {
        Debug.Log( "GameMode changed from " + oldMode + " to " + newMode );

        //switch( oldMode ) {
        //    case GameMode.ATTACK:
        //        targetedUnitN = 0;
        //        break;
        //    default:
        //        break;
        //}

        switch( newMode ) {
            case GameModes.PickUnit:
                CameraMode.Set( CameraMode.TARGET );
                break;
            case GameModes.PickTile:
            default:
                targetedUnit = null;
                allUnits.ForEach( u => u.collider.enabled = true );
                CameraMode.Set( CameraMode.FREE );
                break;
        }
    }
예제 #35
0
    internal static bool Set( GameModes value )
    {
        if( !Is( GameModes.GameOver ) ) {

            if( value == GameModes.Default ) {
                value = @default;
            }

            if( value == GameModes.Disabled && current != GameModes.Disabled ) {
                last = current;
            }

            if( value == current ) {
                return false;
            }

            eventChanged( value, current );
            current = value;
            return true;

        }

        return false;
    }
 /// <summary>
 /// returns all free-for-all start points for the given game mode
 /// </summary>
 /// <param name="gameMode"></param>
 /// <returns></returns>
 public IEnumerable<SpawnPoint> GetFFAStartPoints(GameModes gameMode)
 {
     return spawnPoints.Where(sp => sp.UsableInFreeForAll && (sp.UsableInAnyGameMode || sp.ValidGameModes.Contains(gameMode)) && sp.IsStartPoint);
 }
예제 #37
0
 /// <summary>
 /// Gets the aggregated stats of the summoner.
 /// </summary>
 /// <param name="accountID">The account ID.</param>
 /// <param name="gameMode">The game mode enum.</param>
 /// <param name="season">The season enum.</param>
 /// <param name="callback">The callback method.</param>
 public void GetAggregatedStats(int accountID, GameModes gameMode, Seasons season, AggregatedStats.Callback callback)
 {
     AggregatedStats cb = new AggregatedStats(callback);
     InvokeWithCallback("playerStatsService", "getAggregatedStats", new object[] { accountID, StringEnum.GetStringValue(gameMode), StringEnum.GetStringValue(season) }, cb);
 }
예제 #38
0
        /// <summary>
        /// Gets the mode configuration.
        /// </summary>
        /// <returns>The mode configuration.</returns>
        /// <param name="mode">Mode.</param>
        /// <param name="difficulty">Difficulty.</param>
        public ModeConfigurationItem GetModeConfiguration(GameModes mode, GameDifficulties difficulty)
        {
            foreach (var config in ModesConfiguration) {
                if (config.Mode == mode && config.Difficulty == difficulty) {
                    return config;
                }
            }

            return null;
        }
예제 #39
0
        public void MouseClicked(int x, int y, GameMaster sender)
        {
            Rectangle mouseClickRect = new Rectangle(x, y, 10, 10);

            Rectangle backButtonRect = new Rectangle((int)(Width * 0.009765625), (int)Height - (int)(Height * 0.104167), leftArrowButton.Width, leftArrowButton.Height);
            Rectangle playButtonRect = new Rectangle((int)Width - rightArrowButton.Width - (int)(Width * 0.009765625), (int)Height - (int)(Height * 0.104167), rightArrowButton.Width, rightArrowButton.Height);

            //Left and right buttons to control the numbers of players
            Rectangle leftPlayerButton = new Rectangle(screenCenter.X - (int)(Width * 0.1953125) - leftArrowButton.Width, (int)(Height * 0.7161458333), leftArrowButton.Height, leftArrowButton.Width);
            Rectangle rightPlayerButton = new Rectangle(screenCenter.X + (int)(Width * 0.1953125), (int)(Height * 0.7161458333), rightArrowButton.Height, rightArrowButton.Width);

            //Left and right buttons to control the game mode
            Rectangle leftGameButton = new Rectangle(screenCenter.X - (int)(Width * 0.1953125) - leftArrowButton.Width, (int)(Height * 0.8463541667), leftArrowButton.Height, leftArrowButton.Width);
            Rectangle rightGameButton = new Rectangle(screenCenter.X + (int)(Width * 0.1953125), (int)(Height * 0.8463541667), rightArrowButton.Height, rightArrowButton.Width);

            if (mouseClickRect.Intersects(backButtonRect))
            {
                sender.GraphicsDevice.Clear(Color.Black);
                sender.screenNumber = 0;
            }

            else if (mouseClickRect.Intersects(playButtonRect))
            {
                sender.GraphicsDevice.Clear(Color.Black);
                sender.screenNumber = 2;
                sender.playerSetup = new PlayerSetup(sender.BoardWidth, sender.BoardHeight, 0, 0);
                sender.playerSetup.Initialize(sender);
                sender.playerSetup.numScreens = numPlayers;
            }

            else if (mouseClickRect.Intersects(leftPlayerButton))
            {
                if (numPlayers > 1)
                {
                    numPlayers--;
                }

            }

            else if (mouseClickRect.Intersects(rightPlayerButton))
            {
                numPlayers++;
            }

            else if (mouseClickRect.Intersects(leftGameButton))
            {
                if (gameMode == GameModes.Classic)
                {
                    gameMode = GameModes.GhostHunt;
                }
                else if (gameMode == GameModes.GhostHunt)
                {
                    gameMode = GameModes.Classic;
                }
            }

            else if (mouseClickRect.Intersects(rightGameButton))
            {
                if (gameMode == GameModes.Classic)
                {
                    gameMode = GameModes.GhostHunt;
                }
                else if (gameMode == GameModes.GhostHunt)
                {
                    gameMode = GameModes.Classic;
                }
            }
        }
예제 #40
0
 public GameModeState(GameModes.GameModeBase game, GameClient client)
 {
     myclient = client;
     myclient.GameMode = game;
 }
예제 #41
0
 internal static bool Is( GameModes value )
 {
     return current == value;
 }
예제 #42
0
        private void OnNeighborAdd(Cube cube1, Cube.Side side1, Cube cube2, Cube.Side side2)
        {
            Log.Debug("Neighbor add: {0}.{1} <-> {2}.{3}", cube1.UniqueId, side1, cube2.UniqueId, side2);

              CubeWrapper wrapper1 = (CubeWrapper)cube1.userData;
              CubeWrapper wrapper2 = (CubeWrapper)cube2.userData;

              if (wrapper1 != null && wrapper2 != null) {
            if ((wrapper1.mType == CubeType.SELECTOR && wrapper2.mType == CubeType.SELECTABLE) || (wrapper2.mType == CubeType.SELECTOR && wrapper1.mType == CubeType.SELECTABLE)) {
              Cube.Side selectorSide;
              Cube.Side selectableSide;
              CubeWrapper selectorWrapper;
              CubeWrapper selectableWrapper;

              if (wrapper1.mType == CubeType.SELECTOR) {
            selectorSide = side1;
            selectableSide = side2;
            selectorWrapper = wrapper1;
            selectableWrapper = wrapper2;
              }

              else {
            selectorSide = side2;
            selectableSide = side1;
            selectorWrapper = wrapper2;
            selectableWrapper = wrapper1;
              }

              if (selectorSide == Cube.Side.BOTTOM) {
            switch (currentPhase) {
                        case (PhaseType.MODESELECT):
                            if (selectableSide == Cube.Side.TOP) {
                                currentMode = GameModes.FREELIB;
                                currentPhase = PhaseType.NAMESELECT;
                                readyToChangeState = true;
                            }
                            else if (selectableSide == Cube.Side.BOTTOM) {
                                currentMode = GameModes.FREETHEME;
                                currentPhase = PhaseType.NAMESELECT;
                                readyToChangeState = true;
                            }

                            break;

                        case (PhaseType.NAMESELECT):

                            currentPlayer = nameSelector(selectableSide, selectableWrapper);
                            currentPhase = PhaseType.THEMESELECT;
                            readyToChangeState = true;
                            break;

                        case (PhaseType.BEATSELECT):

                            string sample = beatSelector(selectableSide, selectableWrapper);
                            sampleMusic = Sounds.CreateSound(sample);

                            if (mMusic.IsPlaying) mMusic.Pause();

                            sampleMusic.Play(1, -1);
                            currentPhase = PhaseType.BEATSELECT2;
                            readyToChangeState = true;
                            break;

                        case (PhaseType.THEMESELECT):

                            currentTheme = themeSelector(selectableSide, selectableWrapper);
                            currentPhase = PhaseType.BEATSELECT;
                            readyToChangeState = true;
                            break;

                        default:
                            break;

            }
             	  }
            }
              }
        }
예제 #43
0
 public static ValidationReport ValidateGameMode(GameModes gameMode)
 {
     return new ValidationReport(Binding.FCE_Validation_GameMode((int)gameMode));
 }
예제 #44
0
        public void NewGame()
        {
            gameMode = GameModes.Playing;

            particleManager.Reset();

            map.Path = "start";
            gameType = GameType.Solo;
            players = 1;

            for (int i = 0; i < players; i++)
            {
                characters[i]
                    = new Character(new Vector2(300f
                    + (float)i * 200f, 100f),
                    characterDefinitions[(int)CharacterType.Player1],
                    i,
                    Character.TEAM_PLAYERS);
                characters[i].HP = characters[i].MHP = 100;
            }
            for (int i = players; i < characters.Length; i++)
                characters[i] = null;

            map.GlobalFlags = new MapFlags(64);
            map.Read();
            map.TransDir = TransitionDirection.Intro;
            map.transInFrame = 1f;
        }
 public GlobalGameMode(OrbIt game)
 {
     this.game = game;
     playersHurtPlayers = new Toggle<float>(1f, true);
     nodesHurtPlayers = new Toggle<float>(1f, false);
     playersHurtNodes = new Toggle<float>(1f, true);
     nodesHurtNodes = new Toggle<float>(1f, false);
     scoringMode = ScoringModes.playerKills;
     _gameMode = GameModes.FreeForAll;
     SetUpTeams();
     globalColor = Color.Purple;
 }
예제 #46
0
파일: GameMode.cs 프로젝트: JOCP9733/tank
 public GameMode(GameModes mode = GameModes.Testing)
 {
     Mode = mode;
     Scene = new Scene();
 }
예제 #47
0
 private void loadHeader()
 {
     GameMode = (GameModes)Enum.Parse(typeof(GameModes), replayReader.ReadByte().ToString(culture));
     FileFormat = replayReader.ReadInt32();
     MapHash = replayReader.ReadNullableString();
     PlayerName = replayReader.ReadNullableString();
     ReplayHash = replayReader.ReadNullableString();
     Count300 = replayReader.ReadUInt16();
     Count100 = replayReader.ReadUInt16();
     Count50 = replayReader.ReadUInt16();
     CountGeki = replayReader.ReadUInt16();
     CountKatu = replayReader.ReadUInt16();
     CountMiss = replayReader.ReadUInt16();
     TotalScore = replayReader.ReadUInt32();
     MaxCombo = replayReader.ReadUInt16();
     IsPerfect = replayReader.ReadBoolean();
     Mods = (Mods)replayReader.ReadInt32();
     headerLoaded = true;
 }
 /// <summary>
 /// returns all start points that are for the given team number in the given game mode
 /// </summary>
 /// <param name="team"></param>
 /// <param name="gameMode"></param>
 /// <returns></returns>
 public IEnumerable<SpawnPoint> GetStartPointsForTeam(int team, GameModes gameMode)
 {
     return spawnPoints.Where(sp => sp.UsableInTeamModes && (sp.UsableInAnyGameMode || sp.ValidGameModes.Contains(gameMode)) && sp.Team == team && sp.IsStartPoint);
 }
예제 #49
0
        public static void Parse()
        {
            var dialog = new OpenFileDialog
            {
                InitialDirectory = Path.GetPath(),
                Filter = Resources.mouseMoverThread_parse_osr_files____osr____osr,
                FilterIndex = 1,
                RestoreDirectory = true
            };
            if (dialog.ShowDialog() != DialogResult.OK) return;
            var path = dialog.FileName;
            Rep.Clear();
            var originalReplay = new Replay(path, true);
            _mode = originalReplay.GameMode;
            var index = 0;
            while (index < originalReplay.ReplayFrames.Count - 2)
            {
                var thisFrame = originalReplay.ReplayFrames[index];

                if (thisFrame.Time < 0) { index++; continue; } // i don't like negative time :)

                var futureFrame = originalReplay.ReplayFrames[index + 1];
                var frame = new ReplayFrame
                {
                    X = thisFrame.X,
                    Y = thisFrame.Y,
                    Time = thisFrame.Time,
                    Keys = thisFrame.Keys
                };
                Rep.Add(frame);

                //Smooth linear moving
                if (thisFrame.Time > 0 && futureFrame.TimeDiff > 19)
                {
                    var steps = futureFrame.TimeDiff / 10;
                    var xMult = (futureFrame.X - thisFrame.X) / steps;
                    var yMult = (futureFrame.Y - thisFrame.Y) / steps;

                    var startX = thisFrame.X;
                    var startY = thisFrame.Y;
                    var startTime = thisFrame.Time;
                    var startBtn = thisFrame.Keys;
                    for (var i = 0; i < steps; i++)
                    {
                        startX = startX + xMult;
                        startY = startY + yMult;
                        startTime = startTime + 10;
                        var smoothFrame = new ReplayFrame
                        {
                            X = startX,
                            Y = startY,
                            Time = startTime,
                            Keys = startBtn
                        };
                        Rep.Add(smoothFrame);
                    }
                }

                index++;
            }

            var speedFrame = new ReplayFrame
            {
                X = 0,
                Y = 0,
                Keys = KeyData.None,
                Time = 999999999
            };
            for (var i = 0; i < 4; i++) // I'm use it for speed up... Really, it don't good...
            {
                Rep.Add(speedFrame);
            }

            Menu.ReplayParsed = true;
        }
예제 #50
0
파일: GUIManager.cs 프로젝트: Zulban/viroid
 private void setPause()
 {
     gameMode = GameModes.paused;
     setGameState (true);
 }
예제 #51
0
        private void SwitchMode(GameModes mode)
        {
            switch (mode)
            {
                case GameModes.PLAY:
                    StartGame();
                    break;

                case GameModes.SETTINGS:
                    StopGame();
                    break;
            }

            // In every case reset value on timer
            btnTimer.Content = SelectedTime;
        }
예제 #52
0
파일: GUIManager.cs 프로젝트: Zulban/viroid
 private void setResume()
 {
     gameMode = GameModes.gameplay;
     setGameState (false);
 }
예제 #53
0
 public void OnGameModeChanged( GameModes newMode, GameModes oldMode )
 {
 }
예제 #54
0
파일: GUIManager.cs 프로젝트: Zulban/viroid
 private void setSandbox()
 {
     gameMode = GameModes.sandbox;
     gameHUD.showSandboxTip=false;
     setGameState (true);
 }
예제 #55
0
    internal static bool Toggle( GameModes value )
    {
        if( value == current ) {
            Set( GameModes.Default );
            return false;
        }

        Set( value );
        return true;
    }
예제 #56
0
 internal static void SetDefault( GameModes value )
 {
     @default = value;
 }
예제 #57
0
        /// <summary>
        /// Starts a new game.
        /// </summary>
        /// <param name="arena">Specifies whether this is an arena game.  We'll use an arena game for multiplayer games, covered in Chapter 12.</param>
        public void NewGame(bool arena)
        {
            gameMode = GameModes.Playing;

            pManager.Reset();

            if (arena)
            {
                map.path = "arena";
                gameType = GameType.Arena;
                players = 2;
            }
            else
            {
                map.path = "start";
                gameType = GameType.Solo;
                players = 1;
            }

            for (int i = 0; i < players; i++)
            {
                character[i]
                    = new Character(new Vector2(300f
                    + (float)i * 200f, 100f),
                    charDef[(int)CharacterDefinitions.Guy],
                    i,
                    Character.TEAM_GOOD_GUYS);
                character[i].HP = character[i].MHP = 100;
            }
            for (int i = players; i < character.Length; i++)
                character[i] = null;

            map.GlobalFlags = new MapFlags(64);
            map.Read();
            map.TransDir = TransitionDirection.Intro;
            map.transInFrame = 1f;
        }
    //------------------------------------------------
    private void setDataUsingScriptRefrences()
    {
        //Debug.Log("in setDataUsingScriptRefrences");

        _background = Random.Range(1,3); // pick randomly background
        //-------- Place Available Shapes
        shapesControllerSR.placeAvailableShapes(pgDataManager.getAvailableShapes(),pgDataManager.getQuestionTitle());

        //-------- Place Available Landmasses
        islandControllerSR.placeIslandsAndLandmasses(shapesControllerSR.getAnswerSpriteIndex(),pgDataManager.getAnswersListCount(),_background);

        // -------------- Show/Hide Land
        if(_background==1){
            if(landControllerSR!=null)
            landControllerSR.showLand();
            else Debug.Log("land is null");
        }
        else if(landControllerSR!=null){
            landControllerSR.hideLand();

        }else Debug.Log("land is null");

        // ------ Change background
        backgroundControllerSR.setBackground(_background);

        if(pgDataManager.getShowReferent())
        referentShapeControllerSR.setReferentSprite(shapesControllerSR.getAnswerSpriteIndex());  // Setting Referent Sprite
        else referentShapeControllerSR.setReferentSprite(500);  // Setting

        referentHintControllerSR.setShapeName(shapesControllerSR.getAnswerSpriteIndex());

        // ------- Play VO w.r.t game mode
        if((int)pgDataManager.gameModeSwitching()==(int)GameModes.mode_different)
        {
            currentMode = GameModes.mode_different;
            int _different = Random.Range(1,3);
            questionInstructionVO =(new string[]{PG_Constants._soundclipPath + PG_Constants._differentMode + string.Format("all_diff_todo_{0}" , _different)});

        }
        else if((int)pgDataManager.gameModeSwitching()==(int)GameModes.mode_same || (int)pgDataManager.gameModeSwitching()==(int)GameModes.mode_similiar)
        {
            currentMode			 =  GameModes.mode_same;
            int shapesCount      = pgDataManager.getAnswersListCount();
            string shapeName	 = pgDataManager.getQuestionTitle();
            string shapeClipName = null;
            if(shapesCount==1)
            shapeClipName = "word_"+ shapeName.ToLower();
            else shapeClipName = "word_"+shapeName.ToLower()+"s";

            questionInstructionVO= (new string[]{PG_Constants._soundclipPath + PG_Constants._find + "all_same_todo_one_2", PG_Constants._soundclipPath+ PG_Constants._basicShapes + shapeClipName});

        }
        else if((int)pgDataManager.gameModeSwitching()==(int)GameModes.mode_counting){
            currentMode			 = GameModes.mode_counting;
            int shapesCount      = pgDataManager.getAnswersListCount();
            string shapeName	 = pgDataManager.getQuestionTitle();
            string shapeClipName = null;
            if(shapesCount==1)
            shapeClipName = "word_"+ shapeName.ToLower();
            else shapeClipName = "word_"+shapeName.ToLower()+"s";

            questionInstructionVO =(new string[]{PG_Constants._soundclipPath + PG_Constants._find + "pond_count_todo_1a" , PG_Constants._soundclipPath+ PG_Constants._counting + string.Format("number_{0}",shapesCount),
            PG_Constants._soundclipPath+ PG_Constants._basicShapes + shapeClipName});

        }

        isUserPlayedTheQuestion = false;
        loadingQuestionOrLevelInProgress = false;
        shapeContainerStatControllerSR.playAnimation();

        // ------- Hard mode Implementation
        if(hardModeTime>0){
            hardModeTime +=4;
            _hardModeCount=0;
        }
    }
예제 #59
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            Point pDestination = new Point(-1, -1);
            if ((e.KeyCode == Keys.Down) || (e.KeyCode == Keys.Up))
            {
                RelativeDirection rdMoveDirection = (e.KeyCode == Keys.Up) ? RelativeDirection.Forward : RelativeDirection.Backward;
                pDestination = oPlayerOrientation.GetAdjacentPoint(rdMoveDirection, pPosition);
                if (mMaze.PathExist(pPosition, pDestination))
                {
                    pPosition = pDestination;
                    sCurrentMessage = mgMazeGuide.GetHint(pPosition, oPlayerOrientation, true);
                }
            }
            if ((e.KeyCode == Keys.Left) || (e.KeyCode == Keys.Right))
            {
                if (e.KeyCode == Keys.Left)
                    oPlayerOrientation.Turn(RelativeDirection.Left);
                else if (e.KeyCode == Keys.Right)
                    oPlayerOrientation.Turn(RelativeDirection.Right);

                sCurrentMessage = mgMazeGuide.GetDirectionHint(pPosition, oPlayerOrientation, true);
            }
            else if (e.KeyCode == Keys.Tab)
            {
                if (gmCurrentGameMode == GameModes.CityMap)
                    gmCurrentGameMode = GameModes.CityStreet;
                else if (gmCurrentGameMode == GameModes.CityStreet)
                    gmCurrentGameMode = GameModes.CityMap;

                else if (gmCurrentGameMode == GameModes.MazeRoom)
                    gmCurrentGameMode = GameModes.MazeMap;
                else if (gmCurrentGameMode == GameModes.MazeRoom)
                    gmCurrentGameMode = GameModes.MazeMap;
            }

            Invalidate();
        }
예제 #60
0
 // TODO: Not working because return type is only an object array
 /// <summary>
 /// Retrieves the top played champions of summoner by account ID.
 /// </summary>
 /// <param name="accountID">The account ID.</param>
 /// <param name="gameMode">The game mode enum.</param>
 /// <param name="callback">The callback method.</param>
 public void RetrieveTopPlayedChampions(int accountID, GameModes gameMode, TopPlayedChampions.Callback callback)
 {
     TopPlayedChampions cb = new TopPlayedChampions(callback);
     InvokeWithCallback("playerStatsService", "retrieveTopPlayedChampions", new object[] { accountID, StringEnum.GetStringValue(gameMode) }, cb);
 }