コード例 #1
0
ファイル: TutorialGuide.cs プロジェクト: hyzcn/cerealbar
    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!";
        }
    }
コード例 #2
0
 void Awake()
 {
     _instance   = this;
     pad         = GameObject.Find("Pad").transform;
     ball        = GameObject.Find("Ball").transform;
     Random.seed = System.DateTime.Now.Millisecond;
 }
コード例 #3
0
        public void Start()
        {
            SetGame.Introduction(PlayerA);

            LocateSubmarinesOnBoard(PlayerA);

            AttackEnemy(PlayerA);
        }
コード例 #4
0
ファイル: Startup.cs プロジェクト: hyzcn/cerealbar
 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>();
 }
コード例 #5
0
        public override void DrawCommandGUI()
        {
            serializedObject.Update();

            SetGame t = target as SetGame;

            if (GUILayout.Button("Configure"))
            {
                OdinEditorWindow.InspectObject(t);
            }
            serializedObject.ApplyModifiedProperties();
        }
コード例 #6
0
ファイル: Outline.cs プロジェクト: hyzcn/cerealbar
 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;
     }
 }
コード例 #7
0
ファイル: HubTest.cs プロジェクト: ethanharman12/SetSite
        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);
        }
コード例 #8
0
ファイル: PropPlacement.cs プロジェクト: hyzcn/cerealbar
    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]);
            }
        }
    }
コード例 #9
0
ファイル: PropPlacement.cs プロジェクト: hyzcn/cerealbar
 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");
     }
 }
コード例 #10
0
        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);
        }
コード例 #11
0
ファイル: HubTest.cs プロジェクト: ethanharman12/SetSite
        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);
        }
コード例 #12
0
 public PlayerScoresState(SetGame setGame) : base(setGame)
 {
 }
コード例 #13
0
 public WaitingForPlayerCallState(SetGame setGame) : base(setGame)
 {
 }
コード例 #14
0
 public InitializeGameState(SetGame setGame) : base(setGame)
 {
 }
コード例 #15
0
 public GameEndingState(SetGame setGame) : base(setGame)
 {
 }
コード例 #16
0
 protected State(SetGame setGame)
 {
     this.setGame = setGame;
 }
コード例 #17
0
 public NoSetsAvailableState(SetGame setGame) : base(setGame)
 {
 }