public void ShowOutsideScreenUnit() { GameUISettings settings = game.settings.UI.GameUI; Unit south = game.southTeam.Player.Controlled; ShowUnit(south, settings.j1.gameObject); Unit north = game.northTeam.Player.Controlled; ShowUnit(north, settings.j2.gameObject); }
public void DrawUI(float blueProgress, float redProgress) { GameUISettings settings = game.settings.UI.GameUI; settings.blueSuper.percent = blueProgress; settings.redSuper.percent = redProgress; settings.blueScore.number = game.southTeam.nbPoints; settings.redScore.number = game.northTeam.nbPoints; int reverseTime = (int)(game.settings.Global.Game.period_time - game.Referee.IngameTime); settings.timeNumber.number = reverseTime; ShowOutsideScreenUnit(); }
public void ShowUnit(Unit u, GameObject indic) { GameUISettings settings = game.settings.UI.GameUI; if (u == null) { return; } Camera orthoCam = GameObject.FindGameObjectWithTag("UICamera").camera; indic.SetActive(true); Vector3 pos = WorldToNormalizedViewportPoint( Camera.main, u.transform.position ); pos.x = Mathf.Clamp01(pos.x); pos.y = Mathf.Clamp01(pos.y); float rot = 0; // Bas if (pos.y == 0) { rot = 0; if (pos.x < settings.OffsetSideIndicator) { pos.x = settings.OffsetSideIndicator; } else if (pos.x > 1 - settings.OffsetSideIndicator) { pos.x = 1 - settings.OffsetSideIndicator; } } // Haut else if (pos.y == 1) { rot = 180; if (pos.x < settings.OffsetSideIndicator) { pos.x = settings.OffsetSideIndicator; } else if (pos.x > 1 - settings.OffsetSideIndicator) { pos.x = 1 - settings.OffsetSideIndicator; } } // Gauche else if (pos.x == 0) { rot = 270; } // Droite else if (pos.x == 1) { rot = 90; } // Inside else { indic.SetActive(false); return; } indic.transform.localRotation = Quaternion.EulerAngles(0, 0, rot * Mathf.Deg2Rad); indic.transform.position = NormalizedViewportToWorldPoint( orthoCam, pos ); }