コード例 #1
0
    void Awake()
    {
        int OilTrue      = Random.Range(0, 3);
        int ArtifactTrue = Random.Range(0, 3);

        AnimalA = Random.Range(0, 750);
        AnimalF = Random.Range(0, 750);
        Stone   = Random.Range(2000, 15000);
        if (OilTrue < 2)
        {
            Oil = Random.Range(400, 4000);
        }
        Okron  = Random.Range(0, 3500);
        Gelop  = Random.Range(0, 2400);
        Zenida = Random.Range(0, 2000);
        Ekivis = Random.Range(0, 1800);
        Furan  = Random.Range(0, 1400);
        Armen  = Random.Range(0, 1000);
        Ulux   = Random.Range(0, 600);
        Rokat  = Random.Range(0, 200);
        if (ArtifactTrue < 1)
        {
            Artifact = Random.Range(10, 200);
        }

        Spriter = GetComponent <SpriteRenderer>();
        ID      = GetComponent <CellID>();
        CheckStage();
        SendResourses();
    }
コード例 #2
0
 public CellStatusChangedEventArgs(CellID identifier, EConnectFourCellContent newContent,
                                   EConnectFourCellContent oldContent)
 {
     Identifier = identifier;
     NewContent = newContent;
     OldContent = oldContent;
 }
コード例 #3
0
ファイル: Forest.cs プロジェクト: MaxKillMax/World-Simulator
    void Awake()
    {
        int OilTrue      = Random.Range(0, 3);
        int ArtifactTrue = Random.Range(0, 5);

        Wood     = Random.Range(5000, 25000);
        AnimalA  = Random.Range(0, 2000);
        AnimalF  = Random.Range(0, 2000);
        Berry    = Random.Range(0, 4000);
        Mushroom = Random.Range(0, 5000);
        Stone    = Random.Range(500, 3000);
        if (OilTrue < 1)
        {
            Oil = Random.Range(400, 1000);
        }
        if (ArtifactTrue < 1)
        {
            Artifact = Random.Range(10, 200);
        }

        Spriter = GetComponent <SpriteRenderer>();
        ID      = GetComponent <CellID>();
        CheckStage();
        SendResourses();
    }
コード例 #4
0
ファイル: Chestnut.cs プロジェクト: InarBelkin/Island_Forest
        public override bool GetCanPlace(CellID IDPlace, Actor Act)
        {
            switch (IDPlace)
            {
            case CellID.Stone:
            case CellID.StoneSand:
            case CellID.Zero:
                return(false);
            }
            if (Act == null)
            {
                return(true);
            }
            else
            {
                switch (Act.ID)
                {
                case ActorID.Rabbit:
                case ActorID.Wolf:
                    return(false);
                }
            }

            return(true);
        }
コード例 #5
0
        public void GenerateFirstId()
        {
            const string ExpectedID   = "A1";
            var          actualCellId = CellID.CreateFirstCell();

            Assert.That(actualCellId.Id, Is.EqualTo(ExpectedID));
        }
コード例 #6
0
        public void CreateId_validInputLowerCase_ReturnCellID()
        {
            string id           = "a2";
            var    actualCellId = new CellID(id);

            Assert.That(actualCellId.Id, Is.EqualTo("A2"));
        }
コード例 #7
0
    void StartGame()
    {
        List <CellID> activePlayers = new List <CellID>();

        foreach (int i in _server.clientList)
        {
            if (Players.ContainsKey(i))
            {
                Debug.Log("Player " + i + " already exists.");
                return;
            }
            else
            {
                activePlayers.Add(CreatePlayer(i));
            }
        }

        foreach (var kvp in Players)
        {
            int    index = activePlayers.IndexOf(kvp.Value.playerNum);
            CellID tmp   = activePlayers[0];
            activePlayers[0]     = kvp.Value.playerNum;
            activePlayers[index] = tmp;
            _server.Send(kvp.Key, MessageType.SetUp, new SetUpMessage(activePlayers));
        }
    }
コード例 #8
0
        public void GenereteNextID_retruns_ValidOutput(string strattingID, string expectedResults)
        {
            var expectedResultsList = expectedResults.Split(',').ToList();

            var actualResult = new CellID(strattingID).GetNeighbourIDs();

            Assert.That(actualResult, Is.EqualTo(expectedResultsList));
        }
コード例 #9
0
        //sets the cell to a match if match is there
        public void UpdateCalendar()
        {
            List <Match>  matches = new List <Match>();
            List <Player> players = new List <Player>();
            List <Coach>  coaches = new List <Coach>();


            using (var db = new DatabaseContext())
            {
                matches = db.Matches.ToList();
                players = db.Players.ToList();
                coaches = db.Coach.ToList();

                foreach (var court in db.Courts)
                {
                    if (court.Matches != null)
                    {
                        if (court.Matches.Count != 0)
                        {
                            matches.AddRange(court.Matches);
                        }
                    }
                }
            }
            foreach (var ma in matches)
            {
                CellID c = GetCellByMatch(ma);
                if (ma.CoachInMatch != null)
                {
                    if (ma.CoachInMatch.player != null)
                    {
                        dataGridView1.Rows[c.Row].Cells[c.Column].Style.ForeColor = Color.White;
                        dataGridView1.Rows[c.Row].Cells[c.Column].DataGridView.DefaultCellStyle.WrapMode  = DataGridViewTriState.True;
                        dataGridView1.Rows[c.Row].Cells[c.Column].DataGridView.DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopCenter;
                        dataGridView1.Rows[c.Row].Cells[c.Column].DataGridView.DefaultCellStyle.Font      = new System.Drawing.Font("Calibri", 9.25F, System.Drawing.FontStyle.Bold);
                        dataGridView1.Rows[c.Row].Cells[c.Column].Value = ma.CoachInMatch.player.Firstname + Environment.NewLine + ma.AdditionalInformation;
                        this.dataGridView1.Rows[c.Row].Cells[c.Column].Style.BackColor = Color.FromArgb(ma.CoachInMatch.CoachRed, ma.CoachInMatch.CoachGreen, ma.CoachInMatch.CoachBlue);
                    }
                }
                else if (ma.PlayerList != null)
                {
                    if (ma.PlayerList.Count == 2)
                    {
                        dataGridView1.Rows[c.Row].Cells[c.Column].Value = ma.PlayerList[0].Firstname + " " + ma.PlayerList[0].Lastname + Environment.NewLine + ma.PlayerList[1].Firstname + " " + ma.PlayerList[1].Lastname + Environment.NewLine + ma.AdditionalInformation;;
                    }
                    if (ma.PlayerList.Count == 3)
                    {
                        dataGridView1.Rows[c.Row].Cells[c.Column].Value = ma.PlayerList[0].Firstname + " " + ma.PlayerList[0].Lastname + Environment.NewLine + ma.PlayerList[1].Firstname + " " + ma.PlayerList[1].Lastname + Environment.NewLine + ma.PlayerList[2].Firstname + ma.PlayerList[2].Lastname + Environment.NewLine + ma.AdditionalInformation;;
                    }
                    if (ma.PlayerList.Count == 4)
                    {
                        dataGridView1.Rows[c.Row].Cells[c.Column].Value = ma.PlayerList[0].Firstname + " " + ma.PlayerList[0].Lastname + Environment.NewLine + ma.PlayerList[1].Firstname + " " + ma.PlayerList[1].Lastname + Environment.NewLine + ma.PlayerList[2].Firstname + " " + ma.PlayerList[2].Lastname + Environment.NewLine + ma.PlayerList[3].Firstname + " " + ma.PlayerList[3].Lastname + Environment.NewLine + ma.AdditionalInformation;
                    }
                    this.dataGridView1.Rows[c.Row].Cells[c.Column].Style.ForeColor = Color.Black;
                    this.dataGridView1.Rows[c.Row].Cells[c.Column].Style.BackColor = Color.Black;
                }
            }
        }
コード例 #10
0
ファイル: Carrot.cs プロジェクト: InarBelkin/Island_Forest
 public override bool GetCanPlace(CellID IDPlace, Actor Act)
 {
     switch (IDPlace)
     {
     case CellID.Stone:
     case CellID.StoneSand:
     case CellID.Zero:
         return(false);
     }
     return(true);
 }
コード例 #11
0
ファイル: Grid.cs プロジェクト: MatthiasLenz/TechniteLogic
 /// <summary>
 /// Retrieves the cell associated with the specified cell id.
 /// The stack id of the specified cell must be valid, its layer may fall outside the valid range, resulting in CellStack.FloorCell or CellStack.CeilingCell to be returned instead.
 /// </summary>
 /// <param name="cell"></param>
 /// <returns></returns>
 public static CellStack.Cell GetCell(CellID cell)
 {
     if (cell.Layer < 0)
     {
         return(FloorCell);
     }
     if (cell.Layer >= CellStack.LayersPerStack)
     {
         return(CeilingCell);
     }
     return(CellStacks[cell.StackID].volumeCell[cell.Layer]);
 }
コード例 #12
0
    public void SetCell(Vector2 location, CellID cell)
    {
        int x = (int)location.x, y = (int)location.y;

        if (!isValidCell(x, y))
        {
            return;
        }

        if (_grid[x][y] == CellID.None)
        {
            _grid[x][y] = cell;
        }
    }
コード例 #13
0
ファイル: Chestnut.cs プロジェクト: InarBelkin/Island_Forest
        static public bool canCreate(CellID ID)
        {
            switch (ID)
            {
            case CellID.Grass:

            case CellID.GrassStone:

            case CellID.GrassSand:
                return(true);

            default:
                return(false);
            }
        }
コード例 #14
0
ファイル: ClientManager.cs プロジェクト: eaho1/Radiant-Racers
    void Update()
    {
        if (_isGameStarted)
        {
            PollMovement();
            ManageHud();
        }

        ReceiveEvent recEvent = base.Receive();

        if (recEvent.type == NetworkEventType.DataEvent)
        {
            Message message = recEvent.message;
            if (message.type == MessageType.SetUp)
            {
                SetUpMessage setupMessage = (SetUpMessage)message.GetData();
                StartGame(setupMessage.activePlayers);
            }
            else if (message.type == MessageType.StateUpdate)
            {
                ChangeLog changes = (ChangeLog)message.GetData();
                foreach (var kvp in _players)
                {
                    if (!changes.PlayerLocations.ContainsKey(kvp.Key))
                    {
                        kvp.Value.isDeadImage.SetActive(true);
                    }
                }

                foreach (var playerTransform in changes.PlayerLocations)
                {
                    CellID  playerNum = playerTransform.Key;
                    Vector2 position  = (Vector2)playerTransform.Value;
                    float   rotation  = playerTransform.Value.z;
                    _players[playerNum].playerObject.transform.position = position;
                    _players[playerNum].playerObject.transform.rotation = Quaternion.Euler(new Vector3(0, 0, rotation));
                    if (playerTransform.Key == _myPlayer)
                    {
                        Camera.main.transform.position = new Vector3(position.x, position.y, -10);
                    }
                }
                foreach (var kvp in changes.ChangedCells)
                {
                    Instantiate(_players[kvp.Value].playerTrail, new Vector2(kvp.Key.x, -kvp.Key.y), Quaternion.identity);
                }
            }
        }
    }
コード例 #15
0
        private void Cell_CellSelected(object sender, CellID selectedCellId)
        {
            if (_isGameFinished)
            {
                return;
            }

            var cell = fetchCell(selectedCellId);

            if (_gameLogic.IsValidMove(selectedCellId))
            {
                _gameLogic.SetPiece(selectedCellId);
                ActivePlayer          = _gameLogic.ActivePlayer;
                ActivePlayerCellColor = playerToColorConverter(_gameLogic.ActivePlayer);
            }
        }
コード例 #16
0
        public static Vector2 GetCellPosition(CellID cellID)
        {
            float x = cellID.x * m_unitX;
            float y = 0;

            if (cellID.x % 2 == 0)
            {
                y = m_unitY * cellID.y;
            }
            else
            {
                y = m_unitY * (cellID.y - 0.5f);
            }

            return(new Vector2(x, -y));
        }
コード例 #17
0
        /// <summary>
        /// A method used to create a QueryChanges CellSubRequest object and initialize it.
        /// </summary>
        /// <param name="subRequestId">A parameter represents subRequest id.</param>
        /// <param name="reserved">A parameter that must be set to zero.</param>
        /// <param name="isAllowFragments">A parameter represents that if to allow fragments.</param>
        /// <param name="isExcludeObjectData">A parameter represents if to exclude object data.</param>
        /// <param name="isIncludeFilteredOutDataElementsInKnowledge">A parameter represents if to include the serial numbers of filtered out data elements in the response knowledge.</param>
        /// <param name="reserved1">A parameter represents a 4-bit reserved field that must be set to zero.</param>
        /// <param name="isStorageManifestIncluded">A parameter represents if to include the storage manifest.</param>
        /// <param name="isCellChangesIncluded">A parameter represents if to include the cell changes.</param>
        /// <param name="reserved2">A parameter represents a 6-bit reserved field that must be set to zero.</param>
        /// <param name="cellId">A parameter represents if the Query Changes are scoped to a specific cell. If the Cell ID is 0x0000, no scoping restriction is specified.</param>
        /// <param name="maxDataElements">A parameter represents the maximum data elements to return.</param>
        /// <param name="queryChangesFilterList">A parameter represents how the results of the query will be filtered before it is returned to the client.</param>
        /// <param name="knowledge">A parameter represents what the client knows about a state of a file.</param>
        /// <returns>A return value represents QueryChanges CellSubRequest object.</returns>
        private QueryChangesCellSubRequest BuildFsshttpbQueryChangesSubRequest(
            ulong subRequestId,
            int reserved             = 0,
            bool isAllowFragments    = false,
            bool isExcludeObjectData = false,
            bool isIncludeFilteredOutDataElementsInKnowledge = true,
            int reserved1 = 0,
            bool isStorageManifestIncluded = true,
            bool isCellChangesIncluded     = true,
            int reserved2         = 0,
            CellID cellId         = null,
            ulong?maxDataElements = null,
            List <Filter> queryChangesFilterList = null,
            Knowledge knowledge = null)
        {
            QueryChangesCellSubRequest queryChange = new QueryChangesCellSubRequest(subRequestId);

            queryChange.Reserved          = reserved;
            queryChange.AllowFragments    = Convert.ToInt32(isAllowFragments);
            queryChange.ExcludeObjectData = Convert.ToInt32(isExcludeObjectData);
            queryChange.IncludeFilteredOutDataElementsInKnowledge = Convert.ToInt32(isIncludeFilteredOutDataElementsInKnowledge);
            queryChange.Reserved1 = reserved1;

            queryChange.IncludeStorageManifest = Convert.ToInt32(isStorageManifestIncluded);
            queryChange.IncludeCellChanges     = Convert.ToInt32(isCellChangesIncluded);
            queryChange.Reserved2 = reserved2;

            if (cellId == null)
            {
                cellId = new CellID(new ExGuid(0, Guid.Empty), new ExGuid(0, Guid.Empty));
            }

            queryChange.CellId = cellId;

            if (maxDataElements != null)
            {
                queryChange.MaxDataElements = new Compact64bitInt(maxDataElements.Value);
            }

            queryChange.QueryChangeFilters = queryChangesFilterList;
            queryChange.Knowledge          = knowledge;

            return(queryChange);
        }
コード例 #18
0
ファイル: Sea.cs プロジェクト: MaxKillMax/World-Simulator
    void Awake()
    {
        int OilTrue      = Random.Range(0, 3);
        int ArtifactTrue = Random.Range(0, 3);

        Fish  = Random.Range(300, 5000);
        Water = Random.Range(50000, 100000);
        if (OilTrue < 2)
        {
            Oil = Random.Range(400, 4000);
        }
        Clay = Random.Range(500, 5000);
        if (ArtifactTrue < 1)
        {
            Artifact = Random.Range(10, 200);
        }

        ID    = GetComponent <CellID>();
        timer = Random.Range(1f, 1.5f);
        SendResourses();
    }
コード例 #19
0
 public override bool GetCanPlace(CellID IDPlace, Actor Act)
 {
     switch (IDPlace)
     {
     case CellID.Stone:
     case CellID.StoneSand:
     case CellID.Zero:
         return(false);
     }
     if (Act == null)
     {
         return(true);
     }
     else
     {
         switch (Act.ID)//не нужно проверять животных, на них и так проверят
         {
         case ActorID.Chestnut:
             return(false);
         }
     }
     return(true);
 }
コード例 #20
0
ファイル: Grid.cs プロジェクト: MatthiasLenz/TechniteLogic
 /// <summary>
 /// Location-based version of <see cref="IsSolid(Content content, bool includeTechnites)"/>
 /// </summary>
 /// <param name="location">Location to check the content of</param>
 /// <param name="includeTechnites">Set true to also consider technites as solid</param>
 /// <returns>True, if the determined content type is solid enough to support a technite, false otherwise</returns>
 public static bool IsSolid(CellID location, bool includeTechnites = false)
 {
     return(IsSolid(World.GetCell(location).content, includeTechnites));
 }
コード例 #21
0
ファイル: Grid.cs プロジェクト: MatthiasLenz/TechniteLogic
			public static Vec3 GetLocation(CellID loc)
			{
				return Nodes[loc.StackID].GetLocation(loc.Layer);
			}
コード例 #22
0
ファイル: Grid.cs プロジェクト: MatthiasLenz/TechniteLogic
			/// <summary>
			/// Retrieves the cell associated with the specified cell id.
			/// The stack id of the specified cell must be valid, its layer may fall outside the valid range, resulting in CellStack.FloorCell or CellStack.CeilingCell to be returned instead.
			/// </summary>
			/// <param name="cell"></param>
			/// <returns></returns>
			public static CellStack.Cell GetCell(CellID cell)
			{
				if (cell.Layer < 0)
					return FloorCell;
				if (cell.Layer >= CellStack.LayersPerStack)
					return CeilingCell;
				return CellStacks[cell.StackID].volumeCell[cell.Layer];
			}
コード例 #23
0
ファイル: Grid.cs プロジェクト: MatthiasLenz/TechniteLogic
		/// <summary>
		/// Location-based version of <see cref="IsSolid(Content content, bool includeTechnites)"/>
		/// </summary>
		/// <param name="location">Location to check the content of</param>
		/// <param name="includeTechnites">Set true to also consider technites as solid</param>
		/// <returns>True, if the determined content type is solid enough to support a technite, false otherwise</returns>
		public static bool IsSolid(CellID location, bool includeTechnites=false)
		{
			return IsSolid(World.GetCell(location).content,includeTechnites);
		}
コード例 #24
0
ファイル: Grid.cs プロジェクト: SystemSoftware/TechniteLogic
 /// <summary>
 /// Visually marks a world cell.
 /// The markings are bulk-transferred to the server at the end of the next Logic.ProcessTechnites() invokation.
 /// Older markings are preserved at reduced opacity.
 /// Visualization occurs in the form of a vertical bar atop the marked cell.
 /// The marking may be invisible, if the chosen layer is submerged too deeply.
 /// </summary>
 /// <param name="cell">Cell to visually mark.</param>
 /// <param name="c">Color to use. The rendering uses additive blending equations. Dark colors will be less visible, black will be invisible.</param>
 public static void Mark(CellID cell, Technite.Color c)
 {
     Interface.MarkCell(new Technite.CompressedLocation(cell).Data, new Interface.Struct.RGB8(c));
 }
コード例 #25
0
        public bool GetMouseCellPos(RenderWindow win, float CamPosX, float CamPosY, ref Pos Msel, ref CellID LandID, ref bool canEnv, ref bool canAnim, ref byte Shadmult)
        {
            Vector2f coord;
            Vector2f coordMouse;

            coordMouse = (Vector2f)SFML.Window.Mouse.GetPosition(win);


            bool b;


            int   mi, mj, StX, StY;
            int   X, Y; //Pos
            float DrowX, DrowY;
            bool  bc = false;

            mj  = 0;
            b   = true;
            StX = MapX - 1; StY = 0;

            //Кошмарный алгоритм для отрисовки в нужном порядке

            for (mi = MapX * 2 - 1; mi > 0; mi--)
            {
                if (b == true)
                {
                    mj++;
                }
                else
                {
                    mj--;
                }

                if (mj == MapX)
                {
                    b = false;
                }

                X = StX; Y = StY;
                for (int tj = mj; tj > 0; tj--)
                {
                    DrowX = CamPosX + X * 32 + Y * 32;
                    DrowY = CamPosY - X * 18f + Y * 18f;

                    if (!(DrowX < -32 || DrowX > Additional.Configuration.VideoWith + 32 || DrowY < -18f || DrowY > Additional.Configuration.VideoHigh + MCell[X, Y].highdr + 37))
                    {
                        coord = new Vector2f(DrowX, DrowY - MCell[X, Y].high);

                        if ((coordMouse.Y - coord.Y) < 0.5773502692 * (coordMouse.X - coord.X) && (coordMouse.Y - coord.Y + 35) > 0.5773502692 * (coordMouse.X - coord.X) && (coordMouse.Y - coord.Y) < -0.5773502692 * (coordMouse.X - coord.X) && (coordMouse.Y - coord.Y + 35) > -0.5773502692 * (coordMouse.X - coord.X))
                        {
                            Msel.X = X;
                            Msel.Y = Y;
                            bc     = true;
                        }
                    }
                    X++; Y++;
                }
                if (StX == 0)
                {
                    StY++;
                }
                if (StX > 0)
                {
                    StX--;
                }
            }

            if (bc)
            {
                LandID = MCell[Msel.X, Msel.Y].ID;
                if (MCell[Msel.X, Msel.Y].LEnvir == null)
                {
                    canEnv = true;
                }
                else
                {
                    canEnv = false;
                }
                if (MCell[Msel.X, Msel.Y].LAnimal == null)
                {
                    canAnim = true;
                }
                else
                {
                    canAnim = false;
                }
                Shadmult = MCell[Msel.X, Msel.Y].ShadMult;
            }
            return(bc);
        }
コード例 #26
0
ファイル: Grid.cs プロジェクト: MatthiasLenz/TechniteLogic
 public static Vec3 GetLocation(CellID loc)
 {
     return(Nodes[loc.StackID].GetLocation(loc.Layer));
 }
コード例 #27
0
        private CellID GetCellByMatch(Match m)
        {
            CellID cell = new CellID();



            switch (m.dayOfWeek)
            {
            case "Monday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 1;
                    break;
                }

                case 2:
                {
                    cell.Column = 2;
                    break;
                }

                case 3:
                {
                    cell.Column = 3;
                    break;
                }

                case 4:
                {
                    cell.Column = 4;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }

            case "Tuesday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 6;
                    break;
                }

                case 2:
                {
                    cell.Column = 7;
                    break;
                }

                case 3:
                {
                    cell.Column = 8;
                    break;
                }

                case 4:
                {
                    cell.Column = 9;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }

            case "Wednesday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 11;
                    break;
                }

                case 2:
                {
                    cell.Column = 12;
                    break;
                }

                case 3:
                {
                    cell.Column = 13;
                    break;
                }

                case 4:
                {
                    cell.Column = 14;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }

            case "Thursday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 16;
                    break;
                }

                case 2:
                {
                    cell.Column = 17;
                    break;
                }

                case 3:
                {
                    cell.Column = 18;
                    break;
                }

                case 4:
                {
                    cell.Column = 19;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }

            case "Friday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 21;
                    break;
                }

                case 2:
                {
                    cell.Column = 22;
                    break;
                }

                case 3:
                {
                    cell.Column = 23;
                    break;
                }

                case 4:
                {
                    cell.Column = 24;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }

            case "Saturday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 26;
                    break;
                }

                case 2:
                {
                    cell.Column = 27;
                    break;
                }

                case 3:
                {
                    cell.Column = 28;
                    break;
                }

                case 4:
                {
                    cell.Column = 29;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }

            case "Sunday":
            {
                switch (m.Court.CourtNumber)
                {
                case 1:
                {
                    cell.Column = 31;
                    break;
                }

                case 2:
                {
                    cell.Column = 32;
                    break;
                }

                case 3:
                {
                    cell.Column = 33;
                    break;
                }

                case 4:
                {
                    cell.Column = 34;
                    break;
                }
                }
                switch (m.TimeOfDay)
                {
                case 9:
                {
                    cell.Row = 0;
                    break;
                }

                case 10:
                {
                    cell.Row = 1;
                    break;
                }

                case 11:
                {
                    cell.Row = 2;
                    break;
                }

                case 12:
                {
                    cell.Row = 3;
                    break;
                }

                case 13:
                {
                    cell.Row = 4;
                    break;
                }

                case 14:
                {
                    cell.Row = 5;
                    break;
                }

                case 15:
                {
                    cell.Row = 6;
                    break;
                }

                case 16:
                {
                    cell.Row = 7;
                    break;
                }

                case 17:
                {
                    cell.Row = 8;
                    break;
                }

                case 18:
                {
                    cell.Row = 9;
                    break;
                }

                case 19:
                {
                    cell.Row = 10;
                    break;
                }

                case 20:
                {
                    cell.Row = 11;
                    break;
                }

                case 21:
                {
                    cell.Row = 12;
                    break;
                }
                }
                break;
            }
            }
            return(cell);
        }
コード例 #28
0
        public static CellID GetCellID(Vector2 position)
        {
            Vector2[] points = new Vector2[3];
            CellID[]  ids    = new CellID[3];

            float dist;
            float minDist = float.MaxValue;

            float fcx = position.x / m_unitX;
            float fcy = position.y / m_unitY;
            int   cx  = Mathf.FloorToInt(position.x / m_unitX);
            int   cy  = Mathf.FloorToInt(position.y / m_unitY);

            points[0].y = m_unitY * cy;
            points[1].y = m_unitY * (cy + 0.5f);
            points[2].y = m_unitY * (cy + 1.0f);

            if (cx % 2 == 0)
            {
                //   |\
                //   | \
                //   | /
                //   |/
                points[0].x = points[2].x = m_unitX * cx;
                points[1].x = m_unitX * (cx + 1);

                ids[0].x = cx;
                ids[1].x = cx + 1;
                ids[2].x = cx;

                ids[0].y = cy;
                ids[1].y = cy + 1;
                ids[2].y = cy + 1;
            }
            else
            {
                //   /|
                //  / |
                //  \ |
                //   \|
                points[0].x = points[2].x = m_unitX * (cx + 1);
                points[1].x = m_unitX * cx;

                ids[0].x = cx + 1;
                ids[1].x = cx;
                ids[2].x = cx + 1;

                ids[0].y = cy;
                ids[1].y = cy + 1;
                ids[2].y = cy + 1;
            }

            int index = 0;

            for (int i = 0; i < 3; ++i)
            {
                dist = (position - points[i]).sqrMagnitude;
                if (dist < m_minSquareDistance)
                {
                    index = i;
                    break;
                }

                if (dist < minDist)
                {
                    minDist = dist;
                    index   = i;
                }
            }

            return(ids[index]);
        }
コード例 #29
0
        public void GenereteNextID_edge_returnsNull(string edgeID)
        {
            var actualResult = new CellID(edgeID).GetNeighbourIDs();

            Assert.That(actualResult.Count, Is.EqualTo(0));
        }
コード例 #30
0
 public virtual bool GetCanPlace(CellID IDPlace, Actor Act)
 {
     return(false);
 }
コード例 #31
0
ファイル: ClientManager.cs プロジェクト: eaho1/Radiant-Racers
    void StartGame(List <CellID> activePlayers)
    {
        ///Find UI Objects
        _hud      = GameObject.Find("HUD");
        _hudArrow = _hud.transform.FindChild("Arrow").GetComponent <RectTransform>();

        ///Grab all PlayerData that is an active player
        foreach (CellID playerNum in CellID.GetValues(typeof(CellID)))
        {
            if (playerNum != CellID.None && playerNum != CellID.Wall)
            {
                PlayerData playerData = new PlayerData(
                    GameObject.Find(playerNum.ToString()),
                    Resources.Load("Prefabs/" + playerNum.ToString() + "Trail") as GameObject,
                    GameObject.Find(playerNum.ToString() + "Image"));
                if (activePlayers.Contains(playerNum))
                {
                    playerData.isDeadImage.SetActive(false);
                    _players.Add(playerNum, playerData);
                }
                else
                {
                    playerData.playerObject.SetActive(false);
                    playerData.playerImage.SetActive(false);
                }
            }
        }

        ///Set myPlayer
        _myPlayer = activePlayers[0];
        Debug.Log(_myPlayer);
        //_playerTrails[CellID.Player1] = Resources.Load("Prefabs/OrangeTrail") as GameObject;
        //_playerTrails[CellID.Player2] = Resources.Load("Prefabs/GreenTrail") as GameObject;
        //_playerTrails[CellID.Player3] = Resources.Load("Prefabs/BlueTrail") as GameObject;
        //_playerTrails[CellID.Player4] = Resources.Load("Prefabs/YellowTrail") as GameObject;
        //_playerTrails[CellID.Player5] = Resources.Load("Prefabs/PurpleTrail") as GameObject;
        //_playerTrails[CellID.Player6] = Resources.Load("Prefabs/RedTrail") as GameObject;
        //_playerTrails[CellID.Player7] = Resources.Load("Prefabs/PinkTrail") as GameObject;
        //_playerTrails[CellID.Player8] = Resources.Load("Prefabs/BrownTrail") as GameObject;

        //_players[CellID.Player1] = GameObject.Find("Player1");
        //_players[CellID.Player2] = GameObject.Find("Player2");
        //_players[CellID.Player3] = GameObject.Find("Player3");
        //_players[CellID.Player4] = GameObject.Find("Player4");
        //_players[CellID.Player5] = GameObject.Find("Player5");
        //_players[CellID.Player6] = GameObject.Find("Player6");
        //_players[CellID.Player7] = GameObject.Find("Player7");
        //_players[CellID.Player8] = GameObject.Find("Player8");



        //_players[CellID.Player1] = new PlayerData(GameObject.Find("Player1"), Resources.Load("Prefabs/OrangeTrail") as GameObject, GameObject.Find("Player1Image"));
        //_players[CellID.Player2] = new PlayerData(GameObject.Find("Player2"), Resources.Load("Prefabs/GreenTrail") as GameObject, GameObject.Find("Player2Image"));
        //_players[CellID.Player3] = new PlayerData(GameObject.Find("Player3"), Resources.Load("Prefabs/BlueTrail") as GameObject, GameObject.Find("Player3Image"));
        //_players[CellID.Player4] = new PlayerData(GameObject.Find("Player4"), Resources.Load("Prefabs/YellowTrail") as GameObject, GameObject.Find("Player4Image"));
        //_players[CellID.Player5] = new PlayerData(GameObject.Find("Player5"), Resources.Load("Prefabs/PurpleTrail") as GameObject, GameObject.Find("Player5Image"));
        //_players[CellID.Player6] = new PlayerData(GameObject.Find("Player6"), Resources.Load("Prefabs/RedTrail") as GameObject, GameObject.Find("Player6Image"));
        //_players[CellID.Player7] = new PlayerData(GameObject.Find("Player7"), Resources.Load("Prefabs/PinkTrail") as GameObject, GameObject.Find("Player7Image"));
        //_players[CellID.Player8] = new PlayerData(GameObject.Find("Player8"), Resources.Load("Prefabs/BrownTrail") as GameObject, GameObject.Find("Player8Image"));

        _isGameStarted = true;
    }
コード例 #32
0
        public void CreateId_validInput_ReturnCellID(string expectedID)
        {
            var actualCellId = new CellID(expectedID);

            Assert.That(actualCellId.Id, Is.EqualTo(expectedID));
        }
コード例 #33
0
 private CellStatusViewModel fetchCell(CellID identifier)
 {
     return(Cells[identifier.Col][identifier.Row]);
 }