示例#1
0
        public static ExtendendList <Cart> CreateNewCarts(Game.Mode gameMode)
        {
            ExtendendList <Class.Cart> lstCarts = new ExtendendList <Class.Cart>();

            if (gameMode == Game.Mode.OneSuit)
            {
                for (int i = 0; i <= 7; i++)
                {
                    for (int y = 1; y <= 13; y++)
                    {
                        lstCarts.Add(new Class.Cart((Class.Cart.cType)y, GameMode.Black));
                    }
                }
            }
            else
            {
                for (int i = 0; i <= 7; i++)
                {
                    bool addFlag = false;
                    for (int y = 1; y <= 13; y++)
                    {
                        lstCarts.Add(new Class.Cart((Class.Cart.cType)y, (addFlag ? GameMode.Black : GameMode.Red)));
                        addFlag = !addFlag;
                    }
                }
            }
            // List is filled now.
            Cart.Shuffle <Cart>(lstCarts);
            return(lstCarts);
        }
示例#2
0
        /// <summary>
        /// Creates new set of parameters.
        /// </summary>
        /// <param name="boardSize"> Amount of fields on one side of the square board. </param>
        /// <param name="gameMode"> Preferred game mode. </param>
        /// <param name="userMark"> Mark chosen for user. If game mode is 'User Vs Computer', it must have value. </param>
        public GameParams(int boardSize, Game.Mode gameMode, Game.MarkType?userMark)
        {
            BoardSize = boardSize;
            switch (gameMode)
            {
            case Game.Mode.UserVsComputer:
                if (userMark is null)
                {
                    throw new ArgumentNullException(nameof(userMark), Properties.Resources.UserMarkNotDefined);
                }
                Player1 = new User(userMark.Value);
                Player2 = new Computer(userMark.Value == Game.MarkType.X ? Game.MarkType.O : Game.MarkType.X);
                break;

            case Game.Mode.ComputerVsComputer:
                Player1 = new Computer(Game.MarkType.X);
                Player2 = new Computer(Game.MarkType.O);
                break;

            case Game.Mode.UserVsUser:
                Player1 = new User(Game.MarkType.X);
                Player2 = new User(Game.MarkType.O);
                break;
            }
        }
示例#3
0
    public string GameModeToString(Game.Mode mode)
    {
        string s = "";

        switch (mode)
        {
        case Game.Mode.LASTHAT:
            s = "Free For All";
            break;

        case Game.Mode.TEAMS:
            s = "Teams";
            break;

        case Game.Mode.STOCK:
            s = "Stock";
            break;

        case Game.Mode.TIME:
            s = "Time";
            break;

        case Game.Mode.SURVIVAL:
            s = "Survival Mode";
            break;

        default:
            s = "";
            break;
        }

        return(s);
    }
示例#4
0
    public void SetGameMode(Game.Mode mode, int modeValue)
    {
        switch (mode)
        {
        case Game.Mode.LASTHAT:
            currentGameMode = Mode.LASTHAT;
            roundsPerGame   = modeValue;
            livesPerRound   = 1;
            break;

        case Game.Mode.TEAMS:
            currentGameMode = Mode.TEAMS;
            roundsPerGame   = modeValue;
            livesPerRound   = 1;
            break;

        case Game.Mode.STOCK:
            currentGameMode = Mode.STOCK;
            livesPerRound   = modeValue;
            break;

        case Game.Mode.TIME:
            currentGameMode   = Mode.TIME;
            timeLimitPerRound = modeValue * 60;
            timeRemaining     = timeLimitPerRound;
            livesPerRound     = 1;
            break;

        case Game.Mode.PRACTICE:
            currentGameMode   = Mode.PRACTICE;
            timeLimitPerRound = modeValue * 60;
            timeRemaining     = timeLimitPerRound;
            livesPerRound     = 1;
            break;

        case Game.Mode.SURVIVAL:
            currentGameMode = Mode.SURVIVAL;
            roundsPerGame   = 10000;
            livesPerRound   = 3;
            break;

        default:
            break;
        }

        SetStartingPlayerLives();
    }
 private void OnGameModeChanged(Game.Mode mode, object context)
 {
     SetDeploymentZoneVisible(mode == Game.Mode.CallUnits && (Defines.UnitType)context == _unitType);
 }
示例#6
0
    //////////////////////////////////////////////////////////////////////

    void do_game_move(Game.Mode next_mode)
    {
        float time_span       = move_end_time - move_start_time;
        float delta_time      = Time.realtimeSinceStartup - move_start_time;
        float normalized_time = delta_time / time_span; // 0..1

        // arrived at the end of the movement, what happened
        if (normalized_time >= 0.95f)
        {
            // update the blocks anyway
            current_level.update_block_positions(current_move_vector * move_distance);
            current_level.update_block_graphics();
            current_level.update_hit_blocks(current_move_vector);
            Color final_color = stuck_color;
            current_level.current_mode = next_mode;

            if (current_move_result == Level.move_result.hit_solution)
            {
                current_level.current_mode = Game.Mode.winner;
                final_color = win_color;
            }
            else if (current_move_result == Level.move_result.hit_side)
            {
                final_color = fail_color;
                current_level.current_mode = Game.Mode.failed;
            }
            else
            {
                // collide and landed on the solution at the same time
                bool all_stuck = current_level.count_free_blocks() == 0;
                if (all_stuck && current_level.is_solution_complete(int2.zero))
                {
                    current_level.current_mode = Game.Mode.winner;
                    final_color = win_color;
                }
            }
            foreach (Block b in current_level.blocks)
            {
                if (b.stuck)
                {
                    set_color(b.game_object, final_color);
                }
            }
            cube_angle_velocity = new float3(current_move_vector.y, -current_move_vector.x, 0) * 2;
        }
        else
        {
            foreach (Block b in current_level.blocks)
            {
                if (b.stuck)
                {
                    float3 org      = current_level.board_coordinate(b.position);
                    float  t        = block_movement_curve.Evaluate(normalized_time);
                    float  d        = move_distance * t * square_size;
                    float3 movement = new float3(current_move_vector.x * d, current_move_vector.y * d, block_depth);
                    float3 new_pos  = org + movement;
                    b.game_object.transform.position = new Vector3(new_pos.x, new_pos.y, block_depth);
                }
            }
        }
    }
示例#7
0
 private void OnGameModeChanged(Game.Mode mode, object context)
 {
     _curUnitsProvider   = (mode == Game.Mode.CallUnits) ? GetUnitsProvider((Defines.UnitType)context) : null;
     _curAbilityProvider = (mode == Game.Mode.CallAbility) ? GetAbilityProvider((Defines.AbilityType)context) : null;
 }
 private void OnGameModeChanged(Game.Mode mode, object context)
 {
     SetAffectedAreaMarkerVisible(mode == Game.Mode.CallAbility && (Defines.AbilityType)context == _abilityType);
 }