Exemplo n.º 1
0
    /// <summary>
    /// When the screen starts
    /// </summary>
    void Start()
    {
        Cursor.visible = false;

        if (!debugGame)
        {
            bikeManager = BikeManager.instance;

            SetupCanvas();

            UpdateProfile(ProfileManager.instance.GetCurrentProfile());
        }

        Setup();

        if (!debugGame)
        {
            ChangeScreen(GameScreen.Explain);
        }
        else
        {
            bikeSpeed  = BikeSpeed.GOOD;
            gameScreen = GameScreen.Game;
            OnPlay();
        }
    }
Exemplo n.º 2
0
    public void Awake()
    {
        if (Time.time > 1)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;
        DontDestroyOnLoad(this);

        profileManager = GetComponent <ProfileManager>();
    }
Exemplo n.º 3
0
 public BikeService(
     ICallContext callContext,
     IAuthProvider authProvider,
     AppConfig appConfig,
     ITelemetryLogger logger,
     ITransactionManager transactionManager,
     BikeManager bikeManager,
     ContentManager contentManager
     )
     : base(callContext, authProvider, appConfig, logger, transactionManager)
 {
     this.BikeManager    = bikeManager;
     this.ContentManager = contentManager;
 }
Exemplo n.º 4
0
        /// <summary>
        ///     creata a new client with the specfied unique ID
        /// </summary>
        /// <param name="id"></param>
        public static void createClient(string username = null, string password = null, TcpClient tcpclient = null,
                                        bool signed     = false)
        {
            if (tcpclient == null)
            {
                tcpclient = connectSavely();
            }

            if (tcpclient == null)
            {
                return;
            }


            var vr = connectSavely("145.48.6.10", 6666);

            if (vr == null)
            {
                return;
            }
            var connector = new VRConnector(vr);

            var bikem = new BikeManager(false, true, false);

            new Thread(bikem.construct).Start();
            while (bikem.bike == null)
            {
            }


            var client = new PatientClient(tcpclient, bikem.bike, connector);

            new Thread(client.checkForResponse).Start();

            if (signed || ((username != null) && (password != null)) || login(client))
            {
                if ((username != null) && (password != null))
                {
                    client.sendData(new Authentication(username, password, Authentication.Rights.PATIENT));
                }
                var GUI = new Patient_GUI(client);
                Application.Run(GUI);
            }
        }
	void Awake()
	{
		instance = this;
		data = GameData.Get ();
		//TODO: remove this string if need to have different default bike on game start
		//data.currentBike = 0;

		if(data.currentLvl % 2 == 0)
			bikePositions = positionsWrapers[0];
		else
			bikePositions = positionsWrapers[1];

		cam.distance = cameraDistance;
		cam.haight = cameraHeight;
		cam.Angle = cameraAngle;

		bikesContols = new List<BikeControl> ();
		if(GameObject.Find("Motorbike Extra") != null)
		{
			extrabike = GameObject.Find("Motorbike Extra").GetComponent<BikeControl>();
			BikeGUI bikeGui= extrabike.gameObject.GetComponent<BikeGUI>();
			bikeGui.arrowUI = arrowUI;
			bikeGui.speedUI = speedUI;
			bikeGui.gearstUI = gearstUI;
			bikeGui.nitroUI = nitroUI;

			Transform pos = bikePositions.FindChild("Position Extra").transform; 
			extrabike.rigidbody.velocity = Vector3.zero;
			extrabike.transform.position = pos.position ;
			extrabike.transform.rotation = pos.rotation;

			extrabike.currentGear = 1;
			extrabike.curTorque = 0f;
			extrabike.shiftDelay = 0f;
			extrabike.gameObject.SetActive(false);
		}
		for(int i = 0; i < bikePositions.childCount; i++)
		{
			if(GameObject.Find("Motorbike "+(i+1).ToString()) == null) continue;

			GameObject b = GameObject.Find("Motorbike "+(i+1).ToString());
			BikeControl bikeControl = b.GetComponent<BikeControl>();
			bikesContols.Add(bikeControl);
			BikeGUI bikeGui= b.GetComponent<BikeGUI>();
			bikeGui.arrowUI = arrowUI;
			bikeGui.speedUI = speedUI;
			bikeGui.gearstUI = gearstUI;
			bikeGui.nitroUI = nitroUI;
			Transform pos = bikePositions.FindChild("Position "+(i+1).ToString()).transform; 
			b.rigidbody.velocity = Vector3.zero;
			b.transform.position = pos.position ;
			b.transform.rotation = pos.rotation;
			bikeControl.currentGear = 1;
			bikeControl.curTorque = 0f;
			bikeControl.shiftDelay = 0f;
			b.SetActive(false);
		}
		if(data.extraBike)
		{
			bikesContols.Add(extrabike);
		}
		setBikeProperties ();
	}
    void Awake()
    {
        instance = this;
        data     = GameData.Get();
        //TODO: remove this string if need to have different default bike on game start
        //data.currentBike = 0;

        if (data.currentLvl % 2 == 0)
        {
            bikePositions = positionsWrapers[0];
        }
        else
        {
            bikePositions = positionsWrapers[1];
        }

        cam.distance = cameraDistance;
        cam.haight   = cameraHeight;
        cam.Angle    = cameraAngle;

        bikesContols = new List <BikeControl> ();
        if (GameObject.Find("Motorbike Extra") != null)
        {
            extrabike = GameObject.Find("Motorbike Extra").GetComponent <BikeControl>();
            BikeGUI bikeGui = extrabike.gameObject.GetComponent <BikeGUI>();
            bikeGui.arrowUI  = arrowUI;
            bikeGui.speedUI  = speedUI;
            bikeGui.gearstUI = gearstUI;
            bikeGui.nitroUI  = nitroUI;

            Transform pos = bikePositions.FindChild("Position Extra").transform;
            extrabike.rigidbody.velocity = Vector3.zero;
            extrabike.transform.position = pos.position;
            extrabike.transform.rotation = pos.rotation;

            extrabike.currentGear = 1;
            extrabike.curTorque   = 0f;
            extrabike.shiftDelay  = 0f;
            extrabike.gameObject.SetActive(false);
        }
        for (int i = 0; i < 6 /*bikePositions.childCount*/; i++)
        {
            if (GameObject.Find("Motorbike " + (i + 1).ToString()) == null)
            {
                continue;
            }

            GameObject  b           = GameObject.Find("Motorbike " + (i + 1).ToString());
            BikeControl bikeControl = b.GetComponent <BikeControl>();
            bikesContols.Add(bikeControl);
            BikeGUI bikeGui = b.GetComponent <BikeGUI>();
            bikeGui.arrowUI  = arrowUI;
            bikeGui.speedUI  = speedUI;
            bikeGui.gearstUI = gearstUI;
            bikeGui.nitroUI  = nitroUI;
            int idPos = Random.Range(1, bikePositions.childCount + 1);
            idPos = 4;
            Transform pos = bikePositions.FindChild("Position " + (idPos).ToString()).transform;
            //Transform pos = bikePositions.FindChild("Position "+(i+1).ToString()).transform;
            b.rigidbody.velocity    = Vector3.zero;
            b.transform.position    = pos.position;
            b.transform.rotation    = pos.rotation;
            bikeControl.currentGear = 1;
            bikeControl.curTorque   = 0f;
            bikeControl.shiftDelay  = 0f;
            b.SetActive(false);
        }
        if (data.extraBike)
        {
            bikesContols.Add(extrabike);
        }
        setBikeProperties();
        OnArrowPress(false);
    }