Ejemplo n.º 1
0
        private void InitializeLevel()
        {
            AddObject(new CGameObject(Properties.Resources.background, 0, 0, 494, 452)
            {
                Transparent = true
            });

            cursor = new CConstructionCursor(16, 16, this.minimumXY, this.maximumXY);

            AddObject(cursor);

            ProcessableObjects.Add(cursor);
        }
Ejemplo n.º 2
0
        void CreateLevelCurtain()
        {
            // Creating curtain:
            levelCurtain = new CLevelCurtain(this.LevelNumber);

            // Settting event handlers:
            levelCurtain.OnHalfCompleted += LoadMap;

            levelCurtain.OnCompleted += this.InitializeLevel;

            levelCurtain.OnCompleted += this.OnComplete_LevelCurtain;

            // Adding to processable objects:
            ProcessableObjects.Add(levelCurtain);

            // Adding to key receivers:
            KeyEventReceivers.Add(levelCurtain);
        }
Ejemplo n.º 3
0
        // *********************************
        // Methods:
        // *********************************
        // - - - - - - - - - -
        // Managing objects :
        // - - - - - - - - - -

        // This method sets object on a map:
        protected override void AddObject(CGameObject o)
        {
            // Adding to all objects:
            AllGameObjects.Add(o);

            // if it is processable then add it to corresponding list:
            if (o is IProcessable)
            {
                ProcessableObjects.Add((IProcessable)o);
            }

            if ((o is CIconEnemy) || (o is ClevelFlag) || (o is CPlayerIcon))
            {
                StatisticObjects.Add(o);
            }

            // Set event handlers:
            SetEventHandlers(o);

            //Add to map:
            CGameObject[,] map;

            // Choosing the right map:
            map = (o is CProjectile) ? mapProjectiles : mapMain;

            // check if transparent:
            if (!o.Transparent)
            {
                int x, y, width, height;

                GetDimensionsOnMap(o, out x, out y, out width, out height);

                // Put on the map:
                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        map[x + j, y + i] = o;
                    }
                }
            }
        }