// Implement planets as buttons? public override void Render(SpriteBatch spriteBatch, ViewController view) { World.System system = ChapterMaster.Sector.Systems[systemId]; ((SystemScreenAlign)align).pinned = notInWorld; Rect = align.GetRect(view); exitButton.position = MathUtil.Add(Rect.Location, new Vector2(247, 261)); //pinButton.position = new Vector2(247, 20); // TODO: replace with align spriteBatch.Draw(Assets.UITextures[backgroundTexture + system.Planets.Count], Rect, Color.White); // TODO: This will go awry if a system has 5 planets. Add a new System Screen. Most likely. Crashes when you have 0 planets. Need to implement minimum. Vector2 stringSize = Assets.CaslonAntiqueBold.MeasureString(system.name + " System"); //Debug.WriteLine(stringSize.X); spriteBatch.DrawString(Assets.CaslonAntiqueBold, system.name + " System", MathUtil.Add(Rect.Location, new Vector2(80, 12)), Color.Gray); // TODO: replace with align component Point position = Rect.Location + new Point(50 - Constants.SystemSize / 2, 120 - Constants.SystemSize / 2); Vector2 pos = new Vector2(position.X, position.Y); // TODO: better way to pass the system's color RenderHelper.DrawStar(spriteBatch, pos, ChapterMaster.Sector.Systems[systemId].color); planetAligns.Clear(); for (int noPlanet = 0; noPlanet < system.Planets.Count; noPlanet++) { // calculate orbit arc //float r = 40; // TODO: Implement. //float x = (float) Math.Sqrt(Math.Pow((double) r, 2) - Math.Pow((double) 20, 2)); //float startAngle = (float) Math.Acos(x / r); //float endAngle = 2 * startAngle; PlanetAlign planetAlign = new PlanetAlign(noPlanet, pos, 80, 42, 120 - Constants.SystemSize); RenderHelper.DrawPlanet(spriteBatch, new Vector2(), Planet.TypeToTexture(system.Planets[noPlanet].Type), planetAlign, view); spriteBatch.DrawString(Assets.CaslonAntiqueBold, Constants.PlanetNames[system.Planets[noPlanet].planetId], planetAlign.planetPos + new Vector2(16, 32), Color.Gray); planetAligns.Add(planetAlign); } foreach (Button button in Buttons) { button.Render(spriteBatch, view); } foreach (Screen screen in Screens) { screen.Render(spriteBatch, view); } }
void Awake() { // get references myGameObject = gameObject; myTransform = transform; myGravity = GetComponent<PlanetAlign>(); myNavAgent = GetComponent<NavAgent>(); myRenderer = GetComponentInChildren<Renderer>(); myRenderer.enabled = false; myAnimation = animation; myAlign = GetComponent<PlanetAlign>(); if (CoreStash == null) { CoreStash = new Object_Recycler(RobotCore_Prefab); } // set events Level_Manager.main.GameOverEvent += GameOver; PlayerTransform = GameObject.Find("Gemini").transform; myAnimation["Punch"].normalizedSpeed = 1.5f; }
void Awake() { // get references main = this; myTransform = transform; myAnimator = GetComponent<Animator>(); myCamera = GameObject.Find("Gemini Camera").transform.Find("Camera").camera; myCameraTransform = GameObject.Find("Gemini Camera").transform; ScoreManager = GetComponent<Score_Manager>(); myHUD = myCameraTransform.GetComponent<HUD_Manager>(); myAlign = GetComponent<PlanetAlign>(); // settings joystickBitMask = 1<<LayerMask.NameToLayer("Joystick"); joystickCenter = myCamera.WorldToScreenPoint(GameObject.Find("Joystick").transform.position); // set up CreateCombos(); Texture[][] cosmicTextures = new Texture[3][]; cosmicTextures[0] = cosmicPower1; cosmicTextures[1] = cosmicPower2; cosmicTextures[2] = cosmicPower3; AttackMeter = new AttackMeter_Manager(this, cosmicButton, cosmicTextures, new int[] {50, 100, 150}, new string[] {"SpeedBoost", "KillAll", "HealthBoost"}); }