1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using UnityEngine;
- using System.Collections;
- public class UIRaceEnd : MonoBehaviour
- {
- [SerializeField]
- private UIButton [] Ok;
- [SerializeField]
- private UIButton Cancel;
- public UILabel Distance;
- public UILabel Packet;
- public UILabel Score;
- private PlayerSidesColliderScriptCS hPlayerSidesColliderScriptCS;
- private PlayerFrontColliderScriptCS hPlayerFrontColliderScriptCS;
- public ControllerScriptCS hControllerScriptCS;
- public PowerupsMainControllerCS hPowerupsMainControllerCS;
- // Use this for initialization
- void Start ()
- {
- hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
- hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));
- for (int i = 0; i < Ok.Length; i++)
- {
- Ok[i].onClick.Add(new EventDelegate(OnOk));
- }
- //Cancel.onClick.Add(new EventDelegate(OnCancel));
- hPlayerSidesColliderScriptCS = (PlayerSidesColliderScriptCS)GameObject.Find("PlayerSidesCollider").GetComponent(typeof(PlayerSidesColliderScriptCS));
- hPlayerFrontColliderScriptCS = (PlayerFrontColliderScriptCS)GameObject.Find("PlayerFrontCollider").GetComponent(typeof(PlayerFrontColliderScriptCS));
- }
- private void OnEnable()
- {
- hControllerScriptCS = (ControllerScriptCS)GameObject.Find("Player").GetComponent(typeof(ControllerScriptCS));
- hPowerupsMainControllerCS = (PowerupsMainControllerCS)GameObject.Find("Player").GetComponent(typeof(PowerupsMainControllerCS));
- var dist = PlayerControllerLevels.Instance.AllDistance + (int) hControllerScriptCS.getCurrentMileage();
- var gifts = PlayerControllerLevels.Instance.AllGifts + (int)hPowerupsMainControllerCS.getCurrencyUnits();
- Distance.text = dist + "m";
- Packet.text = gifts.ToString();
- Score.text = ((int)(dist + (gifts * 3)+TooltipLastterController.Instance.PontWords)).ToString();
- }
- private void OnOk()
- {
- UIEnergy.Instance.Restore();
- NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.RaceEnd);
- PlayerController.Instance.Alive();
- InGameScriptCS.Instance.InvokeResurrection();
- hPlayerSidesColliderScriptCS.InvokeResurrection();
- hPlayerFrontColliderScriptCS.InvokeResurrection();
- InGameScriptCS.Instance.EnergyAdd(100);
- NGUIMenuScript.Instance.startResumeGameCounter(true);
- InGameScriptCS.Instance.Resurected = false;
- Text_PauseCounter.Show();
- //Analitics.BrandIap();
- }
- private void OnCancel()
- {
- NGUIMenuScript.Instance.CloseMenu(NGUIMenuScript.NGUIMenus.RaceEnd);
- InGameScriptCS.Instance.setupDeathMenu();
- hPlayerSidesColliderScriptCS.deactivateCollider(); //dont detect stumbles on death
- hPlayerFrontColliderScriptCS.deactivateCollider(); //dont detect stumbles on death
- InGameScriptCS.Instance.collidedWithObstacle(); //play the death scene
- }
- // Update is called once per frame
- void Update () {
-
- }
- }
|