/// <summary> /// LabyrinthGame consturctor /// <remarks> /// Will initiate the console renderer and all other required classes /// </remarks> /// </summary> public LabyrinthGame() { this.Renderer = new ConsoleRenderer(); this.commander = new Commander(); this.Scores = ScoreBoardCreator.CreateScoreBoard(); this.Player = PlayerCreator.CreatePlayer(); this.Maze = this.InitMaze(); }
public void PlayerCreator_IsProducedAsValidIPlayerInSmallMaze() { IMaze maze = new Maze(this._small, this._small); Assert.AreEqual(maze.Cols, this._small); Assert.AreEqual(maze.Rows, this._small); var player = PlayerCreator.CreatePlayer(); Assert.IsTrue(player is IPlayer); }
public void PlayerCreator_IsProducedInMediumMaze() { IMaze maze = new Maze(this._medium, this._medium); Assert.AreEqual(maze.Cols, this._medium); Assert.AreEqual(maze.Rows, this._medium); var player = PlayerCreator.CreatePlayer(); Assert.IsTrue(player != null); }
public void Start() { for (int i = 0; i < numberOfPlayers; i++) { PlayerCreator.CreatePlayer(); } var newGame = new StartGame(); newGame.RegisterHandler(Display.ShowPlayerMoves); for (int i = 0; i < numberOfPlayers; i++) { ThreadCreator.CreateThread(newGame).Start(PlayerCreator.Players[i]); } }
public void InitLevel() { //if (_player != null) Destroy(_player); PlayerCreator playerCreator = new PlayerCreator(_settings.PlayerConstructSettings); _player = playerCreator.CreatePlayer(); GateSpawner gateSpawner = new GateSpawner(_player.GetComponent <IRotatable>(), _settings.GateSettings); gateSpawner.CreateGatePools(); _roadSpawner = new RoadSpawner(_settings.RoadSettings); _roadSpawner.Init(gateSpawner.GatePools); _cameraSettings.Init(_player.GetComponent <ICameraControllable>()); }
//todo get start post from server public void CreatePlayerOrUpdate(PlayerInfo playerInfo) { //print("[GameField] CreatePlayer id=" + playerInfo.id); Player player; player = _players.FirstOrDefault(x => x.Id == playerInfo.id); if (player == null) { player = _playerCreator.CreatePlayer(_field, playerInfo); _players.Add(player); } else { player.SetPosition(new Vector2(playerInfo.x, playerInfo.y)); } }
public GameObject MakePlayer(Vector3 position, int playerNum) { return(playerCreator.CreatePlayer(position, settings.players[playerNum])); }
//void OnDestroy() //{ // ArcIO.Close(); //} /// <summary> /// 开始游戏 /// </summary> public void StartGame() { if (State_ != State.Idle) { return; } State_ = State.Normal; //初始化所有玩家 Transform prefabPlayerCreatorTs = Prefab_PlayerCreatorSet[(int)BSSetting.GunLayoutType_.Val].transform; GameObject playersParent = new GameObject("Players"); playersParent.transform.parent = transform; playersParent.transform.localPosition = Vector3.zero; Players = new Player[Defines.NumPlayer]; foreach (Transform t in prefabPlayerCreatorTs) { PlayerCreator pc = t.GetComponent <PlayerCreator>(); Player pNew = pc.CreatePlayer(); pNew.transform.parent = playersParent.transform; Players[pNew.Idx] = pNew; mPControllerIDToPlayerID[pNew.CtrllerIdx] = pNew.Idx; } //打开所有按键 mDisableAllPlayerKey = false; mDisableBackGroundKey = false; //延时检查 //StartCoroutine(_Coro_CheckRemainRunTime()); //StartCoroutine(_Coro_DeleteNullFishInScene()); //难度调节 if (BSSetting.Dat_RemoteDiffucltFactor.Val != 0) { GameOdds.DifficultFactor = (float)(BSSetting.Dat_RemoteDiffucltFactor.Val + 1); } GameOdds.GainRatio = GameOdds.GainRatios[(int)(BSSetting.GameDifficult_.Val)]; GameOdds.GainRatioConditFactor = GameOdds.GainRatioConditFactors[(int)(BSSetting.ArenaType_.Val)]; //ScenePrelude pl = ScenePreludeMgr.DoPrelude(); StartCoroutine("_Coro_MainProcess"); Pool_GameObj.Init(); if (BSSetting.IsNeedPrintCodeAtGameStart.Val) { EnterPrintCode(); } //SceneBGMgr.NewBG(); if (EvtMainProcess_StartGame != null) { EvtMainProcess_StartGame(); } }
void OnChatMessage(ref TwitchChatMessage msg) { //Checks to see if player is logged in and using their channel var listVal = joinedChannels.IndexOf(msg.userName.ToLower()); if (listVal == -1) { if (msg.channelName == "twitchlandrpg" && msg.chatMessagePlainText == "!play") { playerCreator.CreatePlayer(msg.userName); return; } return; } if (msg.userName.ToLower() != msg.channelName) { return; } //Gets player object data PlayerScript playerScript = playerScripts [listVal]; string channel = joinedChannels [listVal]; string commandtxt = msg.chatMessagePlainText.ToLower(); string[] command = commandtxt.Split(new string[] { " " }, System.StringSplitOptions.None); if (playerScript.tutorialProgress != 0) { commandsTutorial.Tutorial(playerScript, command, this); return; } if (command [0] == "status" && command.Length == 1) { commandsMisc.Status(playerScript, this); return; } if (command [0] == "inspect" && command.Length == 2) { commandsMisc.Inspect(playerScript, command, this); return; } if (playerScript.isTraveling == true) { Chat(channel, "You are currently traveling. You cannot take any action but \"turnback\"."); return; } if (command [0] == "travel") { commandsTravel.Travel(playerScript, command, this); return; } if (command [0] == "explore" && command.Length == 1) { Chat(channel, playerScript.locationScript.exploreDescription); return; } }