private void Update()
    {
        if (m_players.Count > 1 && m_isPlaying)
        {
            for (int i = 0; i < m_players.Count - 1; i++)
            {
                if (m_players[i].Progress >= 1f)
                {
                    EndRace();
                }
                if (m_players[i].Progress < m_players[i + 1].Progress)
                {
                    PathNavigator temp = m_players[i];
                    m_players[i]     = m_players[i + 1];
                    m_players[i + 1] = temp;
                }
            }
        }

        //Display stuff
        for (int i = 0; i < m_positionSlots.Length; i++)
        {
            if (i == m_players.Count)
            {
                break;
            }
            m_positionSlots[i].SetRank(i);
            m_positionSlots[i].SetConfig(m_players[i]);
        }
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        body      = GetComponent <Rigidbody>();
        navigator = GetComponent <PathNavigator>();
        autopilot = GetComponent <Autopilot>();
        vehicle   = GetComponent <Vehicle>();
        workers   = new List <IWorker>();

        int[] inputShape = null;
        for (int i = 0; i < 5; i++)
        {
            var model = ModelLoader.LoadFromStreamingAssets(modelName + i + ".nn");
            workers.Add(WorkerFactory.CreateWorker(WorkerFactory.Type.CSharpBurst, model));
            inputShape = model.inputs[0].shape;
        }

        classificationWorker = WorkerFactory.CreateWorker(WorkerFactory.Type.CSharpBurst, ModelLoader.LoadFromStreamingAssets(modelName + "C" + ".nn"));

        numObservations = (inputShape.Last() - 1) / 3;
        inputs          = new Tensor(new TensorShape(inputShape));
        estimations     = new List <float>();

        curvature   = new float[numObservations];
        camber      = new float[numObservations];
        inclination = new float[numObservations];

        rearLeft  = vehicle.wheels.Where(w => w.localAttachmentPosition.z < 0).Where(w => w.localAttachmentPosition.x < 0).ToArray();
        rearRight = vehicle.wheels.Where(w => w.localAttachmentPosition.z < 0).Where(w => w.localAttachmentPosition.x > 0).ToArray();
    }
Beispiel #3
0
 private void Awake()
 {
     navigator         = GetComponent <PathNavigator>();
     body              = GetComponent <Rigidbody>();
     vehicle           = GetComponent <Vehicle>();
     trackLayerMask    = LayerMask.GetMask("Track");
     collisionOccurred = false;
 }
Beispiel #4
0
 /// <summary>
 /// Handles the current target property value changed.
 /// </summary>
 protected void HandleCurrentTargetPropertyValueChanged()
 {
     lock (PropertyMonitorLock)
     {
         var newValue = ReadCurrentPropertyValueOverride();
         NextToken = PathNavigator.TraverseNext(newValue, _remainingPath, NextMonitor_ChangeDetected);
     }
     ChangeDetected(_propertyName);
 }
Beispiel #5
0
 private void Awake()
 {
     autopilot           = GetComponent <Autopilot>();
     navigator           = GetComponent <PathNavigator>();
     pathObservations    = GetComponent <PathObservations>();
     logToConsole        = false;
     lastUndersteerError = 0f;
     navigator.Reset();
     CreateProfile();
 }
Beispiel #6
0
        public void Write(string str, string name)
        {
            PathNavigator pathNavigator = new PathNavigator();
            string        path          = pathNavigator.GetWriteResultDirectory();

            using (StreamWriter sw = new StreamWriter(path + @"\" + name, false, System.Text.Encoding.Default))
            {
                sw.WriteLine(str);
            }
        }
Beispiel #7
0
        public void Seal()
        {
            var pathNavigator = new PathNavigator(new ClrMemberTokenFactory());

            foreach (var dependencyDefinition in _dependencyDefinitions)
            {
                var dependency = dependencyDefinition.Attach(pathNavigator);
                dependency.SetReevaluateCallback(x => Model.RaisePropertyChanged(Name));
                _dependencies.Add(dependency);
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        flightComputer       = gameObject.GetComponent <FlightComputer>();
        pathNavigator        = gameObject.GetComponent <PathNavigator>();
        flightDataVisualizer = gameObject.GetComponentInChildren <FlightDataVisualizer>();

        //Check if landing pad is selected or find
        if (CurrentLandingPad == null)
        {
            SetCurrentLandingPadToClosest();
        }
    }
Beispiel #9
0
 // Start is called before the first frame update
 void Start()
 {
     plane                = transform;
     engineController     = gameObject.GetComponent <EngineController>();
     flightDataVisualizer = gameObject.GetComponentInChildren <FlightDataVisualizer>();
     controllerInputs     = GameObject.Find("VRActions").GetComponent <ControllerInputs>();
     pathNavigator        = this.GetComponent <PathNavigator>();
     navigationComputer   = this.GetComponent <NavigationComputer>();
     currentFlightData    = new FlightData(plane, engineController, pathNavigator);
     flightDataVisualizer.CurrentFlightData = currentFlightData;
     soundController = GetComponentInChildren <SoundController>();
     soundController.FlightComputerRef = this;
 }
Beispiel #10
0
    private void Awake()
    {
        navigator    = GetComponent <PathNavigator>();
        body         = GetComponent <Rigidbody>();
        observations = GetComponent <PathObservations>();

        if (!observations)
        {
            observations = gameObject.AddComponent <PathObservations>();
        }

        vehicle = GetComponent <Vehicle>();
    }
Beispiel #11
0
 /// <summary>
 /// Acquires the target.
 /// </summary>
 /// <param name="target">The target.</param>
 public void AcquireTarget(object target)
 {
     lock (PropertyMonitorLock)
     {
         if (CurrentTarget != null)
         {
             DiscardCurrentTargetOverride();
         }
         _currentTarget = target;
         if (CurrentTarget != null)
         {
             MonitorCurrentTargetOverride();
             NextToken = PathNavigator.TraverseNext(ReadCurrentPropertyValueOverride(), _remainingPath, NextMonitor_ChangeDetected);
         }
     }
 }
    void Awake()
    {
        _sprite = gameObject.GetComponentInChildren <tk2dAnimatedSprite>();

        _animations.Add(MoveDirection.DOWN, "run_down");
        _animations.Add(MoveDirection.DOWN_RIGHT, "run_down_right");
        _animations.Add(MoveDirection.RIGHT, "run_right");
        _animations.Add(MoveDirection.UP_RIGHT, "run_up_right");
        _animations.Add(MoveDirection.UP, "run_up");
        _animations.Add(MoveDirection.LEFT, "run_right");
        _animations.Add(MoveDirection.DOWN_LEFT, "run_down_right");
        _animations.Add(MoveDirection.UP_LEFT, "run_up_right");

        _navigator = gameObject.GetComponent <PathNavigator>();
        _navigator.spriteHeight = _sprite.GetBounds().size.y;
    }
Beispiel #13
0
    protected void OnDrawGizmosSelected()
    {
        if (UnityEditor.Selection.activeTransform != this.transform)
        {
            return;
        }

        if (navigator == null)
        {
            navigator = GetComponent <PathNavigator>();
        }

        if (navigator != null)
        {
            Gizmos.color = Color.yellow;
            for (int i = 0; i < profileLength; i++)
            {
                Gizmos.DrawWireSphere(navigator.waypoints.Query(navigator.StartingPosition + i * interval).Midpoint, 0.25f);
            }
        }
    }
Beispiel #14
0
    public void SetConfig(PathNavigator a_pathNav)
    {
        m_pathNav            = a_pathNav;
        m_iconDisplay.sprite = m_icons[0];
        m_nameDisplay.text   = m_pathNav.PlayerConfig.Name;
        ColorUtility.TryParseHtmlString(m_pathNav.PlayerConfig.Color, out m_configColor);
        m_nameDisplay.color        = m_configColor;
        m_rankDisplay.color        = m_configColor;
        m_progressBarDisplay.color = m_configColor;

        switch (m_pathNav.PlayerConfig.Icon)
        {
        case "http://image0.flaticon.com/icons/png/128/70/70078.png":
            m_iconDisplay.sprite = m_icons[1];
            break;

        case "http://downloadicons.net/sites/default/files/random-user-icon-15571.png":
            m_iconDisplay.sprite = m_icons[4];
            break;

        case "http://icons.iconarchive.com/icons/iconka/meow/256/cat-purr-icon.png":
            m_iconDisplay.sprite = m_icons[3];
            break;

        case "http://www.freeiconspng.com/uploads/cat-icon-9.png":
            m_iconDisplay.sprite = m_icons[2];
            break;

        case "http://www.sucaijiayuan.com/uploads/file/content/2015/03/550bc3fb48342.png":
            m_iconDisplay.sprite = m_icons[0];
            break;

        default:
            m_iconDisplay.sprite = m_icons[0];
            break;
        }
    }
Beispiel #15
0
 private void Awake()
 {
     vehicle     = GetComponent <Vehicle>();
     navigator   = GetComponent <PathNavigator>();
     speedScalar = 1f;
 }
 public void AddNewPlayer(PathNavigator a_pathNav)
 {
     m_players.Add(a_pathNav);
 }
    void Awake()
    {
        _sprite = gameObject.GetComponentInChildren<tk2dAnimatedSprite>();

        _animations.Add(MoveDirection.DOWN, "run_down");
        _animations.Add(MoveDirection.DOWN_RIGHT, "run_down_right");
        _animations.Add(MoveDirection.RIGHT, "run_right");
        _animations.Add(MoveDirection.UP_RIGHT, "run_up_right");
        _animations.Add(MoveDirection.UP, "run_up");
        _animations.Add(MoveDirection.LEFT, "run_right");
        _animations.Add(MoveDirection.DOWN_LEFT, "run_down_right");
        _animations.Add(MoveDirection.UP_LEFT, "run_up_right");

        _navigator = gameObject.GetComponent<PathNavigator>();
        _navigator.spriteHeight = _sprite.GetBounds().size.y;
    }
Beispiel #18
0
 public FlightData(Transform plane, EngineController engineController, PathNavigator pathNavigator)
 {
     this.plane            = plane;
     this.engineController = engineController;
     this.pathNavigator    = pathNavigator;
 }
Beispiel #19
0
 private void Awake()
 {
     navigator = GetComponent <PathNavigator>();
 }