public override void OnSelect() { if (ControllerManager.Get().AvailabeJoystickCount >= 1) { GamestateManager.Get().ChangeState(GamestateType.TrainingSettings); } }
// Start is called before the first frame update void Start() { PV = GetComponent <PhotonView>(); if (PhotonNetwork.NickName.Equals("1")) { playerNumber = 1; } else if (PhotonNetwork.NickName.Equals("2")) { playerNumber = 2; } if (PV.IsMine) { myBoard = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "MultiplayerBoard"), GameSetup.GS.spawnPoints[playerNumber - 1].position, GameSetup.GS.spawnPoints[playerNumber - 1].rotation, 0); MultiplayerViewboard = myBoard.GetComponent <MultiplayerViewboard>(); myBoard.GetComponent <PhotonView>().RPC("Initialize", RpcTarget.All, (PhotonNetwork.CurrentRoom.GetHashCode())); Mascot.SetSprite(Mascots.Normal); Manager = FindObjectOfType <GamestateManager>(); Manager.GetComponent <PhotonView>().RPC("Register", RpcTarget.All); } //MultiplayerViewboard = GameObject.Instantiate(MultiplayerViewboard, this.transform.position, this.transform.rotation); }
/// <summary> /// Called if both players ended the level. /// </summary> static void LevelEnded() { Debug.Log("Level ended by both players!"); Unload(); GamestateManager.Get().ChangeState(GamestateType.MainMenu); }
protected override void Initialize() { base.Initialize(); Data = Gamedata.Load(); Batch = new SpriteBatch(Graphics.GraphicsDevice); AudioManager = new SoundManager(this); GameManager = new GamestateManager(this); GameManager.Add(new HowToPlayState()); }
public TerrainManager(GamestateManager mgr) { _loadedChunks = new List<TerrainChunk>(); _manager = mgr; _generator = new TerrainGen(); var chunk = _generator.GenerateChunk(new XZPair(0, 0)); chunk.SetBufferData(); _loadedChunks.Add(chunk); _renderTarget = new RenderTarget(0.0f); }
public override void OnSelect() { SettingsManager.LevelSettings levelSettings = SettingsManager.Get().CurrentLevelSetings; levelSettings.PreferedLayer [0] = LevelLayer; levelSettings.PreferedLayer [1] = LevelLayer; SettingsManager.Get().ApplyLevelSettings(levelSettings); GamestateManager.Get().ChangeState(GamestateType.Training); }
// Start is called before the first frame update public void Start() { int boardStyle = new System.Random().Next(Backgrounds.Count); this.gameObject.GetComponent <SpriteRenderer>().sprite = Backgrounds[boardStyle]; Frame = GameObject.Instantiate(Frame, new Vector3(this.transform.position.x, this.transform.position.y, -4), this.transform.rotation); Frame.SetSprite(Frames[boardStyle]); if (PV.IsMine) { Manager = FindObjectOfType <GamestateManager>(); } }
public Game1() { graphics = new GraphicsDeviceManager(this); gsm = new GamestateManager(); //graphics.IsFullScreen = true; graphics.PreferredBackBufferHeight = 500; graphics.PreferredBackBufferWidth = 900; Content.RootDirectory = "Content"; r = new Random(); p = new Player(Content); hud = new HUD(); numOfAsteroids = 10; currentGameState = 3; }
public override void OnSelect() { if (ControllerManager.Get().AvailabeJoystickCount >= 2) { SettingsManager.LevelSettings levelSettings = SettingsManager.Get().CurrentLevelSetings; // use random chars in mp levelSettings.PreferedLayer [0] = -1; levelSettings.PreferedLayer [1] = -1; SettingsManager.Get().ApplyLevelSettings(levelSettings); GamestateManager.Get().ChangeState(GamestateType.Multiplayer); } }
private void Awake() { // Case: Static instance not set; make this the persistent object if (gamestate == null) { DontDestroyOnLoad(gameObject); gamestate = this; } // Case: Static instance already exists, destroy this duplicate else if (gamestate != this) { Destroy(gameObject); } }
private void Start() { _cam = GameObject.Find("Main Camera").GetComponent <CamSheik>(); if (_playerNumber == 1) { _otherPlayer = GameObject.Find("Player 2"); } else { _otherPlayer = GameObject.Find("Player 1"); } _Speaker = GetComponent <AudioSource>(); _gsm = GameObject.Find("Managers").GetComponent <GamestateManager>(); }
private void Awake() { if (_instance == null) { _instance = this; DontDestroyOnLoad(gameObject); } else if (_instance != this) { Debug.LogWarning("More than one Gamestate Manager!"); Destroy(gameObject); } m_camera.SetActive(false); m_score_ui.SetActive(false); m_controller.SetActive(false); m_ball.SetActive(false); m_cage.SetActive(false); GameEvent <GameStateChangedEvent> .Register(on_game_state_change); }
public PlayerState(GamestateManager mgr, Point viewportSize) { _renderTarget = new RenderTarget(0f); _manager = mgr; _viewportSize = viewportSize; _playerPosition = new Vector3(348, 1705, -192); _playerLookDir = new Angle3(-1.2f, 0, -10.004f);//xxxxx this value gets ~2 added to it somehow _manager.AddSharedData(SharedStateData.PlayerPosition, _playerPosition); _manager.AddSharedData(SharedStateData.PlayerLook, _playerLookDir); _skipNextMouseUpdate = false; _x = new Text2D(_renderTarget, 0, 0, "hi"); _y = new Text2D(_renderTarget, 0, 10, "hi"); _z = new Text2D(_renderTarget, 0, 20, "hi"); _pitch = new Text2D(_renderTarget, 0, 30, "hi"); _yaw = new Text2D(_renderTarget, 0, 40, "hi"); _x.Color = Color.Wheat; _y.Color = Color.Wheat; _z.Color = Color.Wheat; _pitch.Color = Color.Wheat; _yaw.Color = Color.Wheat; }
private void Awake() { instance = this; }
public override void OnSelect() { GamestateManager.Get().ChangeState(GamestateType.Exit); Application.Quit(); }
public override void OnSelect() { GamestateManager.Get().ChangeState(GamestateType.MainMenu); }