Ejemplo n.º 1
0
    /// <summary>
    /// Handles the errors start.
    /// </summary>
    void HandleErrorsStart()
    {
        _ai  = GetComponent <RobotAI>();
        _rcd = GetComponent <RobotCountToDeath>();

        if (_rcd == null)
        {
            Debug.LogError("ERROR! Set the RobotCountToDeath Script in the prefab.");
        }
        if (_ai == null)
        {
            Debug.LogError("ERROR! Set the RobotAI Script in the prefab.");
        }
        _rm = GetComponent <RobotMovement>();
        if (_rm == null)
        {
            Debug.LogError("ERROR! Set the RobotMovement Script in the prefab.");
        }
        _op = GetComponent <ObjectPicking>();
        if (_op == null)
        {
            Debug.LogError("ERROR! Set the ObjectPicking Script in the prefab.");
        }
        if (gameManager == null)
        {
            Debug.LogError("ERROR! Set the GameManager object when spawning.");
        }

        _gm           = gameManager.GetComponent <GameManager>();
        _colorOfRobot = robotColor;
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the engine. Should be called in <c>Game.LoadContent()</c>.
        /// </summary>
        public void Initialize()
        {
            if (!this.EngineInitialized)
            {
                this.Cameras = new Collection<Camera>();
                this.ClearColor = Color.SkyBlue;
                this.Effects = new Collection<Effect>();
                this.Fonts = new Collection<SpriteFont>();
                this.Players = new PlayerCollection();
                this.CurrentCamera = new ChaseCamera(null);
                this.Terrain = new TerrainManager();

                if (this.GraphicsDevice != null)
                {
                    this.SpriteBatch = new SpriteBatch(this.GraphicsDevice);
                }

                this.PickedObjects = new ReadOnlyCollection<GameObjectBase>(new Collection<GameObjectBase>());
                this.objectPicking = new ObjectPicking();
                this.frameCounter = new FrameCounter();
                this.Compass = new Compass();

                this.EngineInitialized = true;
            }
        }