Example #1
0
        public virtual void AddObject(GameObject obj)
        {
            if (obj is MovingObject)
            {
                this.AddMovingObject(obj as MovingObject);
            }
            else
            {
                if (obj is Mario)
                {
                    AddMario(obj);

                }
                else
                {
                    this.AddStaticObject(obj);
                }
            }
        }
Example #2
0
        private void AddMario(GameObject obj)
        {
            this.playerMario = obj as Mario;

            for (int i = 0; i < this.allObjects.Count; i++)
            {
                if (this.allObjects[i] is Mario)
                {
                    this.allObjects.RemoveAt(i);
                    i--;
                }
            }

            for (int i = 0; i < this.staticObjects.Count; i++)
            {
                if (this.staticObjects[i] is Mario)
                {
                    this.staticObjects.RemoveAt(i);
                    i--;
                }
            }

            this.AddStaticObject(obj);
        }
Example #3
0
 private void AddStaticObject(GameObject obj)
 {
     this.staticObjects.Add(obj);
     this.allObjects.Add(obj);
 }
Example #4
0
        public void WriteThis(GameObject target)
        {
            string typeOfTarget = target.GetType().Name;

            string[] lines = File.ReadAllLines(typeOfTarget + ".txt");
            foreach (string line in lines)
            {
                Console.WriteLine(line);
            }
        }