Example #1
0
    public void StartGame()
    {
        string s;

        if (GetGameIsReady(out s))
        {
            if (singleplayer)
            {
                PlayerPrefManager.SetInt("game_playercount", 1);
                PlayerPrefManager.SetString("game_p1_plane", p1Plane.ToString());
                PlayerPrefManager.SetString("game_p1_input", PlayerInput.InputType.DUAL.ToString());
            }
            else
            {
                PlayerPrefManager.SetInt("game_playercount", 2);
                PlayerPrefManager.SetString("game_p1_plane", p1Plane.ToString());
                PlayerPrefManager.SetString("game_p1_input", p1Input.ToString());
                PlayerPrefManager.SetString("game_p2_plane", p2Plane.ToString());
                PlayerPrefManager.SetString("game_p2_input", p2Input.ToString());
            }
            PlayerPrefManager.SetString("game_difficulty", difficulty.ToString());
            PlayerPrefManager.SetString("game_currentstage", stage.ToString());
            LevelLoader.current.LoadStage(stage);
        }
        else
        {
            Debug.LogError("this line shouldnt be reachable since the button should be disabled if the game cant be started");
        }
    }
Example #2
0
 public void CycleCPP2Plane()
 {
     p2Plane = NextFromArray <Player.PlaneType>(p2Plane, planes);
     coopP2PlaneText.text = p2Plane.ToString();
     UpdateGameReadiness();
     planePreview.ShowPlane(p2Plane, gameReady);
 }
Example #3
0
 public void CycleSPPlane()
 {
     p1Plane = NextFromArray <Player.PlaneType>(p1Plane, planes);
     singleplayerPlaneText.text = p1Plane.ToString();
     UpdateGameReadiness();
     planePreview.ShowPlane(p1Plane, gameReady);
 }
    public void ShowPlane(Player.PlaneType planeType, bool bright)
    {
        HideAll();
        MeshRenderer planeMR;

        switch (planeType)
        {
        case Player.PlaneType.GRIFFON:
            planeMR = griffonMR;
            break;

        case Player.PlaneType.RAZORBACK:
            planeMR = razorbackMR;
            break;

        case Player.PlaneType.SPECTRE:
            planeMR = spectreMR;
            break;

        case Player.PlaneType.WASP:
            planeMR = waspMR;
            break;

        default:
            throw new UnityException("Unknown plane type (" + planeType.ToString() + ")");
        }
        planeMR.enabled = true;
        SetMaterial(planeMR, bright);
    }
Example #5
0
    public void Initialize(Player.PlaneType planeType)
    {
        switch (planeType)
        {
        case Player.PlaneType.RAZORBACK:
            livesImage.sprite = razorbackPlaneSprite;
            spwImage.sprite   = razorbackSPWSprite;
            break;

        case Player.PlaneType.WASP:
            livesImage.sprite = waspPlaneSprite;
            spwImage.sprite   = waspSPWSprite;
            break;

        case Player.PlaneType.GRIFFON:
            livesImage.sprite = griffonPlaneSprite;
            spwImage.sprite   = griffonSPWSprite;
            break;

        case Player.PlaneType.SPECTRE:
            livesImage.sprite = spectrePlaneSprite;
            spwImage.sprite   = spectreSPWSprite;
            break;

        default:
            throw new UnityException("Unknown plane type \"" + planeType.ToString() + "\"");
        }
    }
Example #6
0
    void InstantiateAndInitializePlayer(int playerNumber, out Player player)
    {
        GameObject playerObject = Instantiate(playerPrefab) as GameObject;
        char       numberChar   = playerNumber.ToString().ToCharArray()[0];
        string     inputKey     = "game_p#_input".Replace('#', numberChar);
        string     planeKey     = "game_p#_plane".Replace('#', numberChar);

        PlayerInput.InputType input = PlayerInput.ParseInputType(PlayerPrefManager.GetString(inputKey));
        Player.PlaneType      plane = Player.ParsePlaneType(PlayerPrefManager.GetString(planeKey));
        playerObject.name = "Player " + playerNumber + " (" + plane.ToString() + ", " + input.ToString() + ")";
        player            = playerObject.GetComponent <Player>();
        player.Initialize(input, plane);
        player.SetFurtherInitData(playerNumber, this, gui.ActivateAndGetPlayerGUI(playerNumber), playArea, levelTrackFollower);
        player.transform.parent = playArea.transform;
    }