void OnEnable() { tutorialMode = true; msgBanner = GameObject.Find("MsgBanner"); msg = msgBanner.transform.Find("Msg").gameObject.GetComponent <Text>(); note = msgBanner.transform.Find("Note").gameObject; panel = msgBanner.transform.Find("Panel").gameObject; GameObject gameManager = GameObject.Find("GameManager"); setGame = gameManager.GetComponent <SetGame>(); scoreKeeper = gameManager.GetComponent <ScoreKeeper>(); GameObject instructions = GameObject.Find("Instructions"); instrucCtrl = instructions.GetComponent <InstructionControl>(); GameObject human = GameObject.FindGameObjectWithTag("Human"); leaderHexCtrl = human.GetComponent <HexToHexControl>(); if (role == "Human") { msg.text = "Welcome to the <b>Leader Tutorial</b>! Complete all steps to get started playing the game!"; } else if (role == "Agent") { msg.text = "Welcome to the <b>Follower Tutorial</b>! Complete all steps to get started playing the game!"; } }
void Awake() { _instance = this; pad = GameObject.Find("Pad").transform; ball = GameObject.Find("Ball").transform; Random.seed = System.DateTime.Now.Millisecond; }
public void Start() { SetGame.Introduction(PlayerA); LocateSubmarinesOnBoard(PlayerA); AttackEnemy(PlayerA); }
void OnEnable() { hexGrid = FindObjectOfType <HexGrid>(); propPlacement = FindObjectOfType <PropPlacement>(); startUIControl = FindObjectOfType <StartUIControl>(); setUpUIControl = FindObjectOfType <SetUpUIControl>(); turnController = FindObjectOfType <TurnController>(); cardGenerator = FindObjectOfType <CardGenerator>(); webSocketManager = FindObjectOfType <WebSocketManager>(); setGame = FindObjectOfType <SetGame>(); }
public override void DrawCommandGUI() { serializedObject.Update(); SetGame t = target as SetGame; if (GUILayout.Button("Configure")) { OdinEditorWindow.InspectObject(t); } serializedObject.ApplyModifiedProperties(); }
void OnTriggerEnter(Collider other) { if (eraseRenderer == true && other.name != "SCOPE") { SetGame.InvokeCardActivation(gameObject); eraseRenderer = false; } else if (eraseRenderer == false && other.name != "SCOPE") { SetGame.InvokeCardDeactivation(gameObject); eraseRenderer = true; } }
public void JoinGame_New() { bool playerJoined = false; double timeSet = -1; // Arrange var mockRepo = new MockSetRepository(); mockRepo.Users.Add(new ApplicationUser() { Id = 2, DisplayName = "TestPlayer" }); MultiplayerGameHub hub = new MultiplayerGameHub(mockRepo); var setGame = new SetGame(); MultiplayerGameHub.games.Add("Game6", setGame); var mockGroupManager = new Mock<IGroupManager>(); hub.Groups = mockGroupManager.Object; var claim = new Claim("test", "2"); var mockIdentity = Mock.Of<ClaimsIdentity>(ci => ci.FindFirst(It.IsAny<string>()) == claim); var mockContext = Mock.Of<HubCallerContext>(cc => cc.User.Identity == mockIdentity && cc.ConnectionId == "1"); hub.Context = mockContext; var mockClients = new Mock<IHubCallerConnectionContext<dynamic>>(); hub.Clients = mockClients.Object; dynamic all = new ExpandoObject(); all.playerJoin = new Action<PlayerViewModel>((pvm) => { playerJoined = true; }); all.setTime = new Action<double>((sec) => { timeSet = sec; }); mockClients.Setup(m => m.All).Returns((ExpandoObject)all); mockClients.Setup(m => m.Caller).Returns((ExpandoObject)all); mockClients.Setup(m => m.Others).Returns((ExpandoObject)all); mockClients.Setup(m => m.OthersInGroup(It.IsAny<string>())).Returns((ExpandoObject)all); // Act hub.JoinGame(6).Wait(); // Assert Assert.IsTrue(playerJoined); Assert.IsTrue(setGame.Players.Count == 1); Assert.AreEqual(0, timeSet); }
public void PlaceCardsWithState(StateDelta.CardInfo[] newCards, StateDelta.AgentInfo lead, StateDelta.AgentInfo follow) { // Clear all cards setGame = FindObjectOfType <SetGame>(); setGame.activeCards.Clear(); ClearCards(); for (int i = 0; i < cards.Length; i++) { string cardColor = newCards[i].color; string cardShape = newCards[i].shape; int cardCount = newCards[i].count; int[] cardPosition = newCards[i].pos; bool cardSelection = newCards[i].sel; bool agentOnTop = false; // Reverse the card selection if the agent is on top, because the agent // will later collide with the object. if (newCards[i].pos[0] == lead.pos[0] && newCards[i].pos[1] == lead.pos[1]) { agentOnTop = true; } else if (newCards[i].pos[0] == follow.pos[0] && newCards[i].pos[1] == follow.pos[1]) { agentOnTop = true; } if (agentOnTop) { cardSelection = !cardSelection; } cards[i] = cardGenerator.GenCardWithProperties(cardColor, cardShape, cardCount, cardPosition[0], cardPosition[1], cardSelection); // If the card was not unselected, then add it to the set of selected cards if (cardSelection) { setGame.ForceCardActivation(cards[i]); } else { setGame.ForceCardDeactivation(cards[i]); } } }
void Awake() { pG = new GameObject("Props"); hexgrid = GetComponent <HexGrid>(); cardGenerator = GetComponent <CardGenerator>(); setGame = FindObjectOfType <SetGame>(); if (StructuresDB == null) { Debug.LogErrorFormat("Missing LargeStructures ObjectDB ScriptableObject"); } if (TreesDB == null) { Debug.LogErrorFormat("Missing trees objectDB scriptableobject"); } if (PathObjectsDB == null) { Debug.LogErrorFormat("Missing trees pathobjectsdb scriptableobject"); } }
public void LocateSubmarinesOnBoard(Player player) { bool IsSuccess = true; string message = null; SetGame.SetUp(); for (int i = 0; i < player.Submarines.Length; i++) { do { if (!IsSuccess) { message = "Error Placing the submarine, try another points"; } Point[] points = SetGame.GetSubmarineEdgePoints(player.Submarines[i], player.MyBoard.Matrix, message); PlaceSubmarine placeTool = new PlaceSubmarine(ref player.Submarines[i], points[0], points[1], PlayerA.MyBoard); IsSuccess = placeTool.IsPlaced(); } while (!IsSuccess); } PrintObject.Board(PlayerA.MyBoard.Matrix); }
public void JoinGame_SpectateGame() { GameState currentState = new GameState(); bool isPaused = false; bool playerJoined = false; bool playerRejoined = false; double timeSet = -1; List<List<Card>> playerSets = null; // Arrange var mockRepo = new MockSetRepository(); mockRepo.Users.Add(new ApplicationUser() { Id = 2, DisplayName = "TestPlayer" }); MultiplayerGameHub hub = new MultiplayerGameHub(mockRepo); var setGame = new SetGame(); setGame.Players.Add(new PlayerViewModel() { Id = 3, Name = "TestPlayer2", Sets = new List<List<Card>>() }); setGame.IsPaused = true; setGame.StateId = 1; MultiplayerGameHub.games.Add("Game6", setGame); var mockGroupManager = new Mock<IGroupManager>(); hub.Groups = mockGroupManager.Object; var claim = new Claim("test", "2"); var mockIdentity = Mock.Of<ClaimsIdentity>(ci => ci.FindFirst(It.IsAny<string>()) == claim); var mockContext = Mock.Of<HubCallerContext>(cc => cc.User.Identity == mockIdentity && cc.ConnectionId == "1"); hub.Context = mockContext; var mockClients = new Mock<IHubCallerConnectionContext<dynamic>>(); hub.Clients = mockClients.Object; dynamic all = new ExpandoObject(); all.playerJoin = new Action<PlayerViewModel>((pvm) => { playerJoined = true; }); all.playerReconnected = new Action<int>((id) => { playerRejoined = true; }); all.setTime = new Action<double>((sec) => { timeSet = sec; }); all.sendSets = new Action<List<List<Card>>>((sets) => { playerSets = sets; }); all.startNextState = new Action<GameState>((state) => { currentState = state; }); all.spectate = new Action<GameState>((state) => { currentState = state; }); all.pauseGame = new Action(() => { isPaused = true; }); mockClients.Setup(m => m.All).Returns((ExpandoObject)all); mockClients.Setup(m => m.Caller).Returns((ExpandoObject)all); mockClients.Setup(m => m.Others).Returns((ExpandoObject)all); mockClients.Setup(m => m.OthersInGroup(It.IsAny<string>())).Returns((ExpandoObject)all); // Act hub.JoinGame(6).Wait(); // Assert Assert.IsTrue(playerJoined); Assert.IsFalse(playerRejoined); Assert.IsTrue(isPaused); Assert.AreEqual(1, currentState.id); Assert.IsNull(playerSets); Assert.IsTrue(setGame.Players.Count == 1); Assert.AreEqual(0, timeSet); }
public PlayerScoresState(SetGame setGame) : base(setGame) { }
public WaitingForPlayerCallState(SetGame setGame) : base(setGame) { }
public InitializeGameState(SetGame setGame) : base(setGame) { }
public GameEndingState(SetGame setGame) : base(setGame) { }
protected State(SetGame setGame) { this.setGame = setGame; }
public NoSetsAvailableState(SetGame setGame) : base(setGame) { }