// Start is called before the first frame update
 void Start()
 {
     scriptStart = DateTime.Now;
     UpdateTracker.SubscribeNotifyEvent(UpdateTracker.UpdateEventType.AllFixedUpdateSet, NotifyAllFixedUpdateSet);
     externalCommunication = ExternalCommunication.GetSingleton();
     waterDrops            = GameObject.FindGameObjectsWithTag("WaterDrop").ToList();
     planes = GameObject.FindGameObjectsWithTag("Plane").ToList();
 }
Example #2
0
 private void Start()
 {
     bufferedVelocityPredictions = new Queue <Vector3>();
     externalCommunication       = ExternalCommunication.GetSingleton();
     waterDrops = GameObject.FindGameObjectsWithTag("WaterDrop").ToList();
     planes     = GameObject.FindGameObjectsWithTag("Plane").ToList();
     CreatePredictRequest();
 }
    public static ExternalCommunication GetSingleton()
    {
        if (singleton == null)
        {
            singleton = new ExternalCommunication();
        }

        return(singleton);
    }
Example #4
0
    private void Start()
    {
        loading        = false;
        console        = "";
        functionToCall = "";
        parameters     = "";
        flashId        = "flash_content";

        ExternalCommunication.add(EventListener);
    }
Example #5
0
    private IEnumerator SimulateLoading(string flash_id)
    {
        if (!loading)
        {
            loading = true;

            float loadProgress = 0;

            while (loadProgress + Time.deltaTime * 0.3f < 1f)
            {
                loadProgress += Time.deltaTime * 0.3f;

                ExternalCommunication.loadProgress(flash_id, loadProgress);

                yield return(0);
            }

            ExternalCommunication.callCompletedLoading(flash_id);

            loading = false;
        }
    }
Example #6
0
    private void OnGUI()
    {
        GUI.Label(new Rect(5, 5, 100, 25), "Flash Id:");
        flashId = GUI.TextField(new Rect(110, 5, 300, 25), flashId);

        GUI.Label(new Rect(5, 30, 100, 25), "Function to Call:");
        functionToCall = GUI.TextField(new Rect(110, 30, 300, 25), functionToCall);

        GUI.Label(new Rect(5, 55, 100, 25), "Parameters:");
        parameters = GUI.TextField(new Rect(110, 55, 300, 25), parameters);

        if (GUI.Button(new Rect(370, 80, 40, 25), "Send"))
        {
            ExternalCommunication.callFlashFunction(functionToCall, flashId, (object[])parameters.Split(','));
        }

        if (GUI.Button(new Rect(240, 80, 120, 25), "Simulate Loading"))
        {
            StartCoroutine(SimulateLoading(flashId));
        }

        GUI.TextArea(new Rect(5, 110, 400, 150), console);
    }
Example #7
0
 public ForgotPasswordService()
 {
     _forgotPasswordRepository = new ForgotPasswordRepository();
     _userServices             = new UserService();
     _externalCommunication    = new ExternalCommunication();
 }
Example #8
0
    void Start()
    {
        externalCommunication = ExternalCommunication.GetSingleton();
        trainGameObjects      = new List <GameObject>();
        predictGameObjects    = new List <GameObject>();
        if (Train)
        {
            System.Type mType = System.Type.GetType(TrainScriptName);
            gameObject.AddComponent(mType);

            for (int i = 0; i < TrainAmount; i++)
            {
                transform.position = transform.position + new Vector3(
                    Random.Range(-MaxStartDiff, MaxStartDiff),
                    Random.Range(-MaxStartDiff, MaxStartDiff),
                    Random.Range(-MaxStartDiff, MaxStartDiff));

                var newVelocity = new Vector3(
                    Random.Range(-MaxStartVelocity, MaxStartVelocity),
                    Random.Range(-MaxStartVelocity, MaxStartVelocity),
                    Random.Range(-MaxStartVelocity, MaxStartVelocity));

                var trainObject = (Instantiate(TrainPrefab, transform.position, Quaternion.identity));
                trainObject.GetComponent <WaterDropReset>().MaxStartDiff     = MaxStartDiff;
                trainObject.GetComponent <WaterDropReset>().MaxStartVelocity = MaxStartVelocity;
                var stateHistory = trainObject.GetComponent <StateHistory>();
                stateHistory.HistoryParameterTypes.Add(StateHistory.HistoryParameterType.Position);
                stateHistory.HistoryParameterTypes.Add(StateHistory.HistoryParameterType.Velocity);
                stateHistory.StepsToRemember = StepsToRemember;
                trainGameObjects.Add(trainObject);
            }

            new Thread(new ThreadStart(() =>
            {
                Thread.Sleep(CollectTraindataTime * 1000);
                UnityMainThreadDispatcher.Instance().Enqueue(() =>
                {
                    foreach (var trainGameObject in trainGameObjects)
                    {
                        Destroy(trainGameObject);
                    }
                    if (BeginLearningAfterDataGeneration)
                    {
                        var beginTrainingRequest = TelegramFactory.CreateBeginTrainingRequest();
                        externalCommunication.SendAsynch(beginTrainingRequest, TrainEpoch);
                    }
                });
            })).Start();
        }

        if (Predict)
        {
            System.Type mType = System.Type.GetType(PredictScriptName);
            gameObject.AddComponent(mType);

            for (int i = 0; i < PredictAmount; i++)
            {
                var predictObject = (Instantiate(PredictPrefab, transform.position, Quaternion.identity));
                predictGameObjects.Add(predictObject);
            }
        }
    }