コード例 #1
0
        public DurationSquareDataChain(String loadText, Coordinate startCoordinate, Coordinate endCoordinate)
        {
            this.head = new DurationSquareData(loadText);
            this.tail = new DurationSquareData(loadText);

            this.body = new List <DurationSquareData>();
            for (int pos = (startCoordinate.Y + 1); pos < endCoordinate.Y; pos++)
            {
                body.Add(new DurationSquareData(loadText));
            }

            this.enemyType = head.enemyType;
            this.eventType = head.durationEventType;

            complete = new List <DurationSquareData>();
            complete.Add(head);
            complete.AddRange(body);
            complete.Add(tail);

            this.startCoordinate = startCoordinate;
            this.endCoordinate   = endCoordinate;

            coordinates = new List <Coordinate>();
            for (int y = startCoordinate.Y; y <= endCoordinate.Y; y++)
            {
                coordinates.Add(new Coordinate(startCoordinate.X, y));
            }
        }
コード例 #2
0
        public DurationSquareDataChain(EnemyType enemyType, DurationEventType eventType,
                                       Movement movementType, DurationSquareData head, DurationSquareData tail,
                                       List <DurationSquareData> body, Coordinate startCoordinate, Coordinate endCoordinate)
        {
            this.enemyType = enemyType;
            this.eventType = eventType;

            this.head = head;
            this.tail = tail;

            this.body = new List <DurationSquareData>();
            this.body = body;

            complete = new List <DurationSquareData>();
            complete.Add(head);
            complete.AddRange(body);
            complete.Add(tail);
            foreach (DurationSquareData data in complete)
            {
                data.enemyType         = enemyType;
                data.movement          = movementType;
                data.durationEventType = eventType;
                data.eventData         = new DurationEventData(ActiveData.durationEventState);
            }

            this.startCoordinate = startCoordinate;
            this.endCoordinate   = endCoordinate;

            coordinates = new List <Coordinate>();
            for (int y = startCoordinate.Y; y <= endCoordinate.Y; y++)
            {
                coordinates.Add(new Coordinate(startCoordinate.X, y));
            }
        }
コード例 #3
0
 private void InitializeDurationGridData()
 {
     for (int n = 0; n < durationWidth; n++)
     {
         for (int m = 0; m < height; m++)
         {
             SquareData s = new DurationSquareData();
             durationDataGrid[n, m] = s;
         }
     }
 }
コード例 #4
0
        protected void ClearDataGrid(SquareData[,] newData)
        {
            int localWidth  = newData.GetLength(0);
            int localHeight = newData.GetLength(1);

            for (int n = 0; n < localWidth; n++)
            {
                for (int m = 0; m < localHeight; m++)
                {
                    SquareData sd = new DurationSquareData();
                    sd.Initialize();
                    newData[n, m] = sd;
                }
            }
        }
コード例 #5
0
        private DurationSquareData CheckChainForPresentData(List <DurationSquareDataChain> durationData, Coordinate coordinate)
        {
            DurationSquareData data = null;

            foreach (DurationSquareDataChain chain in durationData)
            {
                data = chain.GetDataFromCoordinate(coordinate);

                if (data != null)
                {
                    break;
                }
            }

            return(data);
        }
コード例 #6
0
        private List <DurationSquareData> GetRange(Coordinate startCoordinate, Coordinate endCoordinate)
        {
            if (startCoordinate.X != endCoordinate.X)
            {
                throw new ArgumentException("Invalid coordinate range entered!");
            }

            List <DurationSquareData> bodyData = new List <DurationSquareData>();

            for (int y = startCoordinate.Y + 1; y < endCoordinate.Y; y++)
            {
                DurationSquareData target = (DurationSquareData)(grid[startCoordinate.X, y].data);
                bodyData.Add(target);
            }

            return(bodyData);
        }
コード例 #7
0
        public override void UpdateGridSize(int newWidth, int newHeight)
        {
            RemoveChainsOutside(newWidth, newHeight);

            SquareData[,] newData = new DurationSquareData[newWidth, newHeight];
            ClearDataGrid(newData);

            for (int n = 0; n < newWidth; n++)
            {
                for (int m = 0; m < newHeight; m++)
                {
                    newData[n, m] = new DurationSquareData();
                }
            }
            data   = newData;
            width  = newWidth;
            height = newHeight;

            CreateSquareGrid(data, durationDataChains);
        }
コード例 #8
0
        //Creates square grid linked to given SquareData-CHAIN
        protected void CreateSquareGrid(SquareData[,] data, List <DurationSquareDataChain> newDurationData)
        {
            int localWidth  = data.GetLength(0);
            int localHeight = data.GetLength(1);

            grid = new DurationSquare[localWidth, localHeight];

            for (int n = 0; n < localWidth; n++)
            {
                for (int m = 0; m < localHeight; m++)
                {
                    DurationSquareData existingData = CheckChainForPresentData(newDurationData, new Coordinate(n, m));
                    if (existingData != null)
                    {
                        data[n, m] = existingData;
                    }

                    Square s = new DurationSquare(data[n, m], GetSquarePos(n, m), spriteSheet, new Coordinate(n, m));
                    s.Initialize();
                    grid[n, m] = s;
                }
            }
        }