/// <summary> /// Loads the content. /// </summary> protected override void LoadContent() { // Instantiate a SpriteBatch spriteBatch = ToDisposeContent(new SpriteBatch(GraphicsDevice)); arial16Font = Content.Load<SpriteFont>("Fonts/Arial16"); camera = new Camera(this.GraphicsDevice, this.graphicsDeviceManager.PreferredBackBufferWidth, this.graphicsDeviceManager.PreferredBackBufferHeight, keyboard, mouse); shadowCamera = new ShadowCamera(this.graphicsDeviceManager.PreferredBackBufferWidth, this.graphicsDeviceManager.PreferredBackBufferHeight); gameCore = new GameCore(this.GraphicsDevice, this.Content, this.camera, this.shadowCamera, this.keyboard, this.mouse); terrain = new Terrain(this.gameCore); grass = new GrassController(this.gameCore); skyBox = new SkyBox(this.gameCore); base.LoadContent(); }
private void OnTriggerEnter2D(Collider2D collision) { ObstacleController obstacle = collision.gameObject.GetComponent <ObstacleController>(); CointController coint = collision.gameObject.GetComponent <CointController>(); GrassController grass = collision.gameObject.GetComponent <GrassController>(); if (obstacle != null) { angle = -60; gameControllerScript.End(); } else if (coint != null) { gameControllerScript.AddCoins(coint.value); coint.desroyCoint(); CoinMusic.Play(); } else if (grass != null) { angle = -60; gameControllerScript.End(); } }