Exemplo n.º 1
0
        internal GameObject Spawn()
        {
            SpawnController.SpawnPoints.Remove(this);

            // Update SpawnPoint in case it gets triggered again.
            HasBeenOffscreen = false;

            switch (GameObjectType) {
                case "spawn":
                    GameObject = new PlayerCharacter(SpawnController.GameScreen, this);
                    break;
                case "goblin":
                    GameObject = new Goblin(SpawnController.GameScreen, this);
                    break;
                case "light":
                    GameObject = new LightSource(SpawnController.GameScreen, this.Position);
                    break;
                default:
                    throw new InvalidOperationException("Invalid entity type.");
            }

            SpawnController.GameScreen.addObject(GameObject);

            return GameObject;
        }
Exemplo n.º 2
0
        public void Reset()
        {
            if (AllowRespawn) {
                m_currentCooldown = 0.0f;
                SpawnController.SpawnPoints.Add(this);
            }

            GameObject = null;
        }
Exemplo n.º 3
0
 public void removeObject(GameObject obj)
 {
     Game.Components.Remove(obj);
     GameObjects.Remove(obj);
 }
Exemplo n.º 4
0
 public void record(GameObject gameObject)
 {
     record(gameObject.Sprite, gameObject.Position, Color.White);
 }
Exemplo n.º 5
0
 public void addObject(GameObject obj)
 {
     Game.addComponent(obj);
     GameObjects.Add(obj);
 }