public void FillFields(BasicDrone c) { laser_color.SetOptions(); laser_color.SetValue(basicDrone.laser_color); nameCreator.SetValue(c.name); basicDrone.state = GetComponentInParent <DroneUI>().state; }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent(ContentManager content) { this.spriteBatch = ScreenManager.SpriteBatch; this.background = content.Load <Texture2D>(Path.Combine(MainGame.CONTENT_SUBFOLDER, "Field")); Texture2D playerTexture = content.Load <Texture2D>(Path.Combine(MainGame.CONTENT_SUBFOLDER, "smiley_sprite")); Texture2D bulletTexture = content.Load <Texture2D>(Path.Combine(MainGame.CONTENT_SUBFOLDER, "mvBCX1")); this.gameObjects.Add(new Smily(playerTexture, new Point(900, 500), new Gun(bulletTexture), PlayerIndex.One)); Texture2D towerTexture = content.Load <Texture2D>(Path.Combine(MainGame.CONTENT_SUBFOLDER, "cube")); this.gameObjects.Add(new Home(towerTexture, new Point(550, 450))); BasicDrone.LoadTexture(content.Load <Texture2D>(Path.Combine(MainGame.CONTENT_SUBFOLDER, "Data-Matrix-Code"))); if (camera == null) { camera = new Camera(2.0f, ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height, 4, 5); } camera.mapWidthInpx = ScreenManager.GraphicsDevice.Viewport.Width; camera.mapHeightInpx = ScreenManager.GraphicsDevice.Viewport.Height; // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }
private void Start() { uiElements = transform.parent.GetComponent <DroneUI>().uiElements; transform.localScale = new Vector3(1, 1, 1); basicDrone = FromComponent(transform.parent.GetComponent <DroneUI>().realDrone); laser_color.uiElements = uiElements; laser_color.saveCurrentValue = (c => basicDrone.laser_color = c); nameCreator.saveCurrentValue = (c => basicDrone.name = c); FillFields(basicDrone); }