コード例 #1
0
        public static void Add(Interface.Struct.GameObject obj)
        {
            GameObject nobj = new GameObject(obj);

            Out.Log(Significance.Low, "Added game object " + nobj);
            AllGameObjects.Add(nobj);
        }
コード例 #2
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;
                    }
                }
            }
        }
コード例 #3
0
        protected override void AddObject(CGameObject o)
        {
            AllGameObjects.Add(o);

            //if (o is IProcessable) ProcessableObjects.Add((IProcessable)o);
        }