Example #1
0
        public void RepopulateGrid()
        {
            GameObject pSwarmGrid = GameObjectManager.Find(GameObject.Name.AlienGrid);

            // Set the initial speed
            float speed = 0.8f - 0.06f * Level.GetCurrentLevel();

            ((AlienGrid)pSwarmGrid).movementTimeInterval = speed;

            GameObject pCol0  = this.Create(GameObject.Name.Column_0, AlienCategory.Type.Column);
            GameObject pCol1  = this.Create(GameObject.Name.Column_1, AlienCategory.Type.Column);
            GameObject pCol2  = this.Create(GameObject.Name.Column_2, AlienCategory.Type.Column);
            GameObject pCol3  = this.Create(GameObject.Name.Column_3, AlienCategory.Type.Column);
            GameObject pCol4  = this.Create(GameObject.Name.Column_4, AlienCategory.Type.Column);
            GameObject pCol5  = this.Create(GameObject.Name.Column_5, AlienCategory.Type.Column);
            GameObject pCol6  = this.Create(GameObject.Name.Column_6, AlienCategory.Type.Column);
            GameObject pCol7  = this.Create(GameObject.Name.Column_7, AlienCategory.Type.Column);
            GameObject pCol8  = this.Create(GameObject.Name.Column_8, AlienCategory.Type.Column);
            GameObject pCol9  = this.Create(GameObject.Name.Column_9, AlienCategory.Type.Column);
            GameObject pCol10 = this.Create(GameObject.Name.Column_10, AlienCategory.Type.Column);

            float ititHeight = 800.0f;
            float start_x    = 100.0f;
            float w          = 70.0f;

            FillSwarmColumn(pCol0, start_x, ititHeight);
            FillSwarmColumn(pCol1, start_x + 1.0f * w, ititHeight);
            FillSwarmColumn(pCol2, start_x + 2.0f * w, ititHeight);
            FillSwarmColumn(pCol3, start_x + 3.0f * w, ititHeight);
            FillSwarmColumn(pCol4, start_x + 4.0f * w, ititHeight);
            FillSwarmColumn(pCol5, start_x + 5.0f * w, ititHeight);
            FillSwarmColumn(pCol6, start_x + 6.0f * w, ititHeight);
            FillSwarmColumn(pCol7, start_x + 7.0f * w, ititHeight);
            FillSwarmColumn(pCol8, start_x + 8.0f * w, ititHeight);
            FillSwarmColumn(pCol9, start_x + 9.0f * w, ititHeight);
            FillSwarmColumn(pCol10, start_x + 10.0f * w, ititHeight);

            pSwarmGrid.Add(pCol0);
            pSwarmGrid.Add(pCol1);
            pSwarmGrid.Add(pCol2);
            pSwarmGrid.Add(pCol3);
            pSwarmGrid.Add(pCol4);
            pSwarmGrid.Add(pCol5);
            pSwarmGrid.Add(pCol6);
            pSwarmGrid.Add(pCol7);
            pSwarmGrid.Add(pCol8);
            pSwarmGrid.Add(pCol9);
            pSwarmGrid.Add(pCol10);
        }