Inheritance: MonoBehaviour
	void Start () {
        fRWheel = transform.FindChild("FR_Phys_Wheel").GetComponent<WheelController>();
        fLWheel = transform.FindChild("FL_Phys_Wheel").GetComponent<WheelController>();
        bRWheel = transform.FindChild("RR_Phys_Wheel").GetComponent<WheelController>();
        bLWheel = transform.FindChild("RL_Phys_Wheel").GetComponent<WheelController>();
        massCenterPosition = transform.FindChild("Mass_Center").localPosition;

        rb = GetComponent<Rigidbody>();

        currentGear = 0;
        gearRatio = gearRatios[currentGear];
        engineRpm = minRpm;

        centerToFrontWheels = GameObject.Find("F_Axel").GetComponent<Transform>().localPosition.z - massCenterPosition.z;
        centerToBackWheels = massCenterPosition.z - GameObject.Find("R_Axel").GetComponent<Transform>().localPosition.z;
        frontToBackWheels = centerToBackWheels + centerToFrontWheels;

        centerToLeftWheels = massCenterPosition.x - GameObject.Find("FL_Wheel").GetComponent<Transform>().localPosition.x;
        centerToRightWheels = GameObject.Find("FR_Wheel").GetComponent<Transform>().localPosition.x - massCenterPosition.x;
        leftToRightWheels = centerToRightWheels + centerToLeftWheels;

        velocity = new Vector3();
        prevVelocity = velocity;

		aiController = GetComponent<AIInputController> ();
	}
Beispiel #2
0
    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.CompareTag("Wheel"))
        {
            if (m_CurrentWheelController != null)
            {
                if (m_CurrentWheelController.currentPlayer == this)
                {
                    m_CurrentWheelController.repairInProgress = false;
                    m_CurrentWheelController.currentPlayer    = null;
                    m_CurrentWheelController = null;
                }
            }
        }

        if (other.CompareTag("Lever"))
        {
            if (m_LeverInUse)
            {
                if (m_CurrentLeverSpeed <= 1.2f)
                {
                    m_CurrentLeverController.leverSpeed -= m_CurrentLeverSpeed;
                    m_CurrentLeverSpeed = 0;
                }
                m_LeverInUse = false;
            }
            m_CurrentLeverController = null;
        }
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     originalPosition = transform.position;
     originalRotation = transform.rotation;
     _rigidbody       = GetComponent <Rigidbody> ();
     _wheelController = GetComponent <WheelController> ();
 }
Beispiel #4
0
    void GetWheels()
    {
        SortedList <float, WheelController> wheelsInOrder = new SortedList <float, WheelController>();

        for (int i = 0; i < this.transform.childCount; i++)
        {
            WheelController wheel = this.transform.GetChild(i).GetComponent <WheelController>();
            if (wheel == null)
            {
                continue;
            }
            Vector3 wheelLocalPos = wheel.transform.position - this.transform.position;
            float   angle         = Vector3.SignedAngle(this.transform.forward, wheelLocalPos, this.transform.up);
            if (angle < 0)
            {
                angle += 360;
            }
            wheelsInOrder.Add(angle, wheel);
        }


        ICollection <float> angles = wheelsInOrder.Keys;

        foreach (float angle in angles)
        {
            wheels.Add(wheelsInOrder[angle]);
        }
    }
 void Awake()
 {
     wheels          = transform.GetChild(1).gameObject;
     wheelController = wheels.GetComponent <WheelController>();
     rigidbody       = GetComponent <Rigidbody>();
     collider        = GetComponentInChildren <Collider>();
 }
Beispiel #6
0
 // Use this for initialization
 void Start()
 {
     originalPosition = transform.position;
     originalRotation = transform.rotation;
     _rigidbody = GetComponent<Rigidbody> ();
     _wheelController = GetComponent<WheelController> ();
 }
Beispiel #7
0
    public float stuckThreshlod = 10 * 1000 / 3600;//(10 km/h)

    // Use this for initialization
    void Start()
    {
        if (speedText != null)
        {
            speedText.text = "AISpeed: 0 km/h";
        }


        rb = GetComponent <Rigidbody>();
        rb.centerOfMass = com;
        if (path != null)
        {
            pathPoints = path.GetComponentsInChildren <Transform>();
        }

        flController = frontLeft.GetComponent <WheelController>();
        frController = frontRight.GetComponent <WheelController>();
        rlController = rearLeft.GetComponent <WheelController>();
        rrController = rearRight.GetComponent <WheelController>();

        flController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        flController.ConfigureFriction(forwardStiffness, sidewayStiffness);
        frController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        frController.ConfigureFriction(forwardStiffness, sidewayStiffness);
        rlController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        rlController.ConfigureFriction(forwardStiffness, sidewayStiffness);
        rrController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        rrController.ConfigureFriction(forwardStiffness, sidewayStiffness);
    }
Beispiel #8
0
    public void Init()
    {
        goCar        = this.transform.Find("car").gameObject;
        Gps          = new GPS(this.gameObject);
        InputManager = new ReplayerInput();

        WCFL = transform.Find("WheelColliders/WCFL").GetComponent <WheelController>();
        WCFR = transform.Find("WheelColliders/WCFR").GetComponent <WheelController>();
        WCRL = transform.Find("WheelColliders/WCRL").GetComponent <WheelController>();
        WCRR = transform.Find("WheelColliders/WCRR").GetComponent <WheelController>();

        peSprayFL = transform.Find("WheelColliders/WCRL/SprayFL").GetComponent <ParticleSystem>();
        peSprayFR = transform.Find("WheelColliders/WCRR/SprayFR").GetComponent <ParticleSystem>();
        ParticleSystem.EmissionModule emSprayRL = peSprayFL.emission;
        emSprayRL.rate = 160f;
        ParticleSystem.EmissionModule emSprayRR = peSprayFR.emission;
        emSprayRL.rate = 160f;
        peDustRL       = transform.Find("WheelColliders/WCRL/DustFL").GetComponent <ParticleSystem>();
        peDustRR       = transform.Find("WheelColliders/WCRR/DustFR").GetComponent <ParticleSystem>();
        ParticleSystem.EmissionModule emRL = peDustRL.emission;
        emRL.rate = 160f;
        ParticleSystem.EmissionModule emRR = peDustRR.emission;
        emRR.rate = 160f;

        WCFL.Replayer = true;
        WCFR.Replayer = true;
        WCRL.Replayer = true;
        WCRR.Replayer = true;

        //Destroy all colliders
        foreach (Collider c in GetComponentsInChildren <Collider>())
        {
            Destroy(c);
        }
    }
Beispiel #9
0
    private void Awake()
    {
        status = GetComponent <CarStatus>();

        rb = GetComponent <Rigidbody>();
        rb.centerOfMass = com;
        flController    = frontLeft.GetComponent <WheelController>();
        frController    = frontRight.GetComponent <WheelController>();
        rlController    = rearLeft.GetComponent <WheelController>();
        rrController    = rearRight.GetComponent <WheelController>();
    }
Beispiel #10
0
 private void Awake()
 {
     FugoAdManager.instance.ShowBanner();
     hintTimer       = -5f;
     instance        = this;
     lineContainer   = base.transform.Find("LineContainer").transform;
     wordBG          = wordContiner.transform.Find("WordBG").GetComponent <RectTransform>();
     wordList        = wordContiner.transform.Find("Word");
     listRect        = wordContiner.transform.Find("Word").GetComponent <RectTransform>();
     letterContainer = base.transform.Find("LetterContainer");
 }
Beispiel #11
0
	/*******************************/

	void Start ()
	{
		belt = transform.FindChild ("Belt").GetComponent<BeltController> ();
		leftwheel = transform.FindChild ("left_wheel").GetComponent<WheelController> ();
		rightwheel = transform.FindChild ("right_wheel").GetComponent<WheelController> ();
		belt.speed = currspeed;
		belt.friction = friction;
		leftwheel.speed = currspeed;
		leftwheel.friction = friction;
		rightwheel.speed = currspeed;
		rightwheel.friction = friction;
	}
 void Start()
 {
     WheelScriptToAccess    = WheelObject.GetComponent <WheelController>();
     FloatScriptrotSpeed    = WheelScriptToAccess.rotSpeed;
     spinning               = false;
     Wheel_win_loose_Music  = GetComponent <AudioSource>();
     WheelMusic             = GetComponent <AudioSource>();
     WheelMusic.clip        = Wheel_tick_music;
     Arrow_Collider         = GetComponent <Collider2D>();
     Arrow_Collider.enabled = false;
     playTime               = 0;
 }
Beispiel #13
0
    // Use this for initialization
    void Start()
    {
        inputController = this.GetComponent <InputController>();

        initialRotation = steeringWheel.transform.localRotation;
        lastPosLeft     = lastPosRight = Vector3.zero;

        wheels = this.GetComponent <WheelController>();


        lastRot = initialRotation;
    }
Beispiel #14
0
    /*******************************/

    void Start()
    {
        belt                = transform.FindChild("Belt").GetComponent <BeltController> ();
        leftwheel           = transform.FindChild("left_wheel").GetComponent <WheelController> ();
        rightwheel          = transform.FindChild("right_wheel").GetComponent <WheelController> ();
        belt.speed          = currspeed;
        belt.friction       = friction;
        leftwheel.speed     = currspeed;
        leftwheel.friction  = friction;
        rightwheel.speed    = currspeed;
        rightwheel.friction = friction;
    }
Beispiel #15
0
        /// <summary>
        /// Gets index of current ground entity in ground entities list.
        /// </summary>
        public int GetCurrentGroundEntityIndex(WheelController wheelController)
        {
            GroundEntity groundEntity = GetCurrentGroundEntity(wheelController);

            if (groundEntity != null)
            {
                return(groundEntities.IndexOf(groundEntity));
            }
            else
            {
                return(-1);
            }
        }
Beispiel #16
0
    public override void initialize()
    {
        //Debug.Log ("WheelNode.initialize()");
        base.initialize();
        if (transform.position.z < 0)
        {
            clockWise = false;
        }
        //Debug.Log ("here");
        WheelController controller = GetComponent <WheelController> ();

        controller.rotationDirection = clockWise ? RotationDirection.clockwise : RotationDirection.anti_clockwise;
    }
Beispiel #17
0
        /// <summary>
        /// Returns skidmark material for the current texture.
        /// </summary>
        public Material GetCurrentSkidmarkTexture(WheelController wheelController)
        {
            GroundEntity groundEntity = GetCurrentGroundEntity(wheelController);

            if (groundEntity != null)
            {
                return(GetCurrentGroundEntity(wheelController).skidmarkMaterial);
            }
            else
            {
                return(null);
            }
        }
Beispiel #18
0
        public AppWindow(IFilesParser fpForLearnCsv, IFilesParser fpForAnomalyCsv)
        {
            InitializeComponent();
            XMLPath = fpForLearnCsv.XMLpath;
            TimeConroller.setTimeControllerValues(fpForAnomalyCsv.getCSV());
            DllAlgorithmHandler.setValues(fpForAnomalyCsv.getXML_CSVMap(), fpForAnomalyCsv.XMLlist);
            DllAlgorithmHandler.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                TimeConroller.setTime(Int32.Parse(e.PropertyName));
            };
            TimeConroller.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                string   property       = e.PropertyName;
                string[] propertyValues = new string[2];
                propertyValues = property.Split('-');
                if (propertyValues[0] == "Time")
                {
                    FlightInfo.setTime(Int32.Parse(propertyValues[1]));
                    WheelController.setTime(Int32.Parse(propertyValues[1]));
                    GraphController.setTime(Int32.Parse(propertyValues[1]));
                }
                else if (propertyValues[0] == "ShouldStop")
                {
                    if (propertyValues[1] == "true")
                    {
                        FlightInfo.setShouldStop(true);
                        WheelController.setShouldStop(true);
                        GraphController.setShouldStop(true);
                    }
                    else
                    {
                        FlightInfo.setShouldStop(false);
                        WheelController.setShouldStop(false);
                        GraphController.setShouldStop(false);
                    }
                }
                else if (propertyValues[0] == "Pace")
                {
                    FlightInfo.setPace(Int32.Parse(propertyValues[1]));
                    WheelController.setPace(Int32.Parse(propertyValues[1]));
                    WheelController.setPace(Int32.Parse(propertyValues[1]));
                }
            };

            FlightInfo.setFlightValues(fpForAnomalyCsv.getXML_CSVMap());
            FlightInfo.run();
            WheelController.setMapValues(fpForAnomalyCsv.getXML_CSVMap());
            WheelController.run();
            GraphController.setMaps(fpForLearnCsv.getXML_CSVMap(), fpForLearnCsv.XMLlist, fpForAnomalyCsv.getXML_CSVMap());
            GraphController.run();
        }
Beispiel #19
0
    // Use this for initialization
    void Start()
    {
        leftHandState  = new HandState(HandState.HandID.left);
        rightHandState = new HandState(HandState.HandID.right);

        wheelController = this.GetComponent <WheelController>();

        bothHands = this;

        accelerationLock = false;

        A_buttonToggle = false;
        A_buttonLocked = false;
    }
Beispiel #20
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Wheel"))
        {
            m_CurrentWheelController = other.GetComponent <WheelController>();
            if (m_CurrentWheelController.currentPlayer == null)
            {
                m_CurrentWheelController.currentPlayer = this;
            }
        }

        if (other.CompareTag("Lever"))
        {
            m_CurrentLeverController = other.GetComponent <LeverController>();
        }
    }
Beispiel #21
0
    // Use this for initialization
    void Start()
    {
        wheel = GetComponent <WheelController>();

        skidAudio = (AudioSource)GetComponent(typeof(AudioSource));
        if (skidAudio == null)
        {
            Debug.LogError("No audio source, please add one skid audio to the tyres");
            enabled = false;
        }
        if (skidmarkPrefab == null)
        {
            Debug.LogError("No skidmark prefab, please attach it");
            enabled = false;
        }
        skidmarkPrefab.SetActive(false);
    }
Beispiel #22
0
        private void InitComponenets()
        {
            // initiate cycle
            if (cycle == null)
            {
                cycle = GameObject.FindWithTag(Tags.CYCLE);
            }

            // get cycle pipe
            pipe = cycle.transform.Find(GameCenter.PIPE);

            // get rigidbody from cycle
            rb = cycle.GetComponent <Rigidbody2D> ();

            // get wheel controller script from cycle
            wheelController = cycle.GetComponent <WheelController> ();

            // set cycle initial position x,y,z
            //cycle.transform.position = new Vector3 (0f, 0.89f, 0f);

            // get camera controller script from cycle
            if (cameraScript == null)
            {
                cameraScript = manager.mainCamera.GetComponent <SmoothCamera2D> ();
            }

            // set damp time to 0
            //cameraScript.dampTime = 0f;

            // set camera target to cycle
            cameraScript.target = cycle.gameObject.transform;

            // get left control button
            leftControl = GameObject.Find(GameCenter.LEFT_CONTROL);

            // get right control button
            rightControl = GameObject.Find(GameCenter.RIGHT_CONTROL);

            //Physics2D.IgnoreCollision (leftControl.GetComponent<CircleCollider2D> (), cycle.GetComponent<CircleCollider2D> ());
            //Physics2D.IgnoreCollision (rightControl.GetComponent<CircleCollider2D> (), cycle.GetComponent<CircleCollider2D> ());
            //Physics2D.IgnoreCollision (leftControl.GetComponent<CircleCollider2D> (), pipe.GetComponent<CircleCollider2D> ());
            //Physics2D.IgnoreCollision (rightControl.GetComponent<CircleCollider2D> (), pipe.GetComponent<CircleCollider2D> ());
        }
Beispiel #23
0
    // Use this for initialization
    void Start()
    {
        rb = GetComponent <Rigidbody>();
        rb.centerOfMass = com;
        speedText.text  = "0 km/h";

        flController = frontLeft.GetComponent <WheelController>();
        frController = frontRight.GetComponent <WheelController>();
        rlController = rearLeft.GetComponent <WheelController>();
        rrController = rearRight.GetComponent <WheelController>();

        flController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        flController.ConfigureFriction(forwardStiffness, sidewayStiffness);
        frController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        frController.ConfigureFriction(forwardStiffness, sidewayStiffness);
        rlController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        rlController.ConfigureFriction(forwardStiffness, sidewayStiffness);
        rrController.ConfigureWheelSubsteps(speedThreshold, stepsBelowThreshold, stepsAboveThreshold);
        rrController.ConfigureFriction(forwardStiffness, sidewayStiffness);
    }
Beispiel #24
0
            // Constructor
            public AutoPilotManager(IMyGridTerminalSystem myGridTerminalSystem, UIManager uIManager, float powerFactor, int precisionFactor, int scanDistance)
            {
                List <IMyRemoteControl> controllers = new List <IMyRemoteControl>();

                myGridTerminalSystem.GetBlocksOfType(controllers);

                foreach (IMyRemoteControl c in controllers)
                {
                    remotePilot      = c;
                    controlReference = remotePilot;
                }
                wheelController      = new WheelController(myGridTerminalSystem, controlReference);
                this.powerFactor     = powerFactor;
                this.precisionFactor = precisionFactor;
                maxScanDistance      = scanDistance;
                state               = PilotState.DRIVING;
                this.uIManager      = uIManager;
                collisionController = new CollisionController(myGridTerminalSystem, remotePilot.GetValueBool("CollisionAvoidance"));
                uIManager.printOnScreens("service", $"Found {collisionController.cameras.Count} cameras for collision detection.");
            }
Beispiel #25
0
        public override void Update()
        {
            if (!Active)
            {
                return;
            }

            if (Clip != null && Sources != null && Sources.Count == vc.Wheels.Count)
            {
                int wheelCount = vc.Wheels.Count;
                for (int i = 0; i < wheelCount; i++)
                {
                    WheelController wc = vc.Wheels[i].wheelController;
                    if (!Sources[i].isPlaying)
                    {
                        float forwardAngle = wc.wheelHit.angleForward;
                        if (wc.isGrounded && prevHasHits[i] == false || wc.forwardFriction.speed > 0.8f &&
                            (forwardAngle > 15f || forwardAngle < -15f))
                        {
                            float newPitch       = Random.Range(0.8f, 1.2f) * basePitch;
                            float absDamperForce = wc.damperForce < 0 ? -wc.damperForce : wc.damperForce;
                            float newVolume      = baseVolume *
                                                   Mathf.Clamp01(absDamperForce / Mathf.Max(wc.damper.bumpForce,
                                                                                            wc.damper.reboundForce));

                            SetVolume(newVolume, i);
                            SetPitch(newPitch, i);

                            if (!Sources[i].isPlaying)
                            {
                                Sources[i].clip = RandomClip;
                                Sources[i].Play();
                            }
                        }
                    }

                    prevHasHits[i] = wc.isGrounded;
                }
            }
        }
        /// <summary>
        /// Calculation of static parameters and creation of rim collider.
        /// </summary>
        public void Init(WheelController wc)
        {
            // Precalculate wheel variables
            inertia = 0.5f * mass * (tireRadius * tireRadius + tireRadius * tireRadius);

            // Calculate maximum deflection tire is allowed to have
            //var sagitta = tireRadius - rimRadius;
            //tireArcLength = Mathf.Sqrt(2 * tireRadius * sagitta - sagitta * sagitta);

            // Calculate tire area of a tire at maximum deflection
            //bottomOutTireArea = width * tireArcLength;

            // Dimensions (for area calculation) of a single scan hit
            //hitWidth = wc.sideResolution < 1 ? width : width / wc.sideResolution;
            //hitHeight = wc.initialScanResolution < 1 ? tireRadius * 2.0f : (tireRadius * 2.0f) / wc.initialScanResolution;

            if (wc.useRimCollider)
            {
                // Instantiate rim (prevent ground passing through the side of the wheel)
                rim      = new GameObject();
                rim.name = "RimCollider";
                rim.transform.position = worldPosition;
                rim.transform.rotation = worldRotation;
                rim.transform.parent   = wc.transform;
                rim.layer = 2;

                if (rim.AddComponent <CapsuleCollider>())
                {
                    rimCollider           = rim.GetComponent <CapsuleCollider>();
                    rimCollider.direction = 0;
                    rimCollider.radius    = rimRadius;
                    rimCollider.height    = width;
                    PhysicMaterial material = new PhysicMaterial();
                    material.dynamicFriction = 0.2f;
                    material.staticFriction  = 0.2f;
                    material.bounciness      = 0f;
                    rimCollider.material     = material;
                }
            }
        }
        public override void Update()
        {
            if (Clip != null && Sources != null && Sources.Count == vc.Wheels.Count)
            {
                for (int i = 0; i < vc.Wheels.Count; i++)
                {
                    WheelController wc = vc.Wheels[i].WheelController;
                    if (!Sources[i].isPlaying)
                    {
                        if ((wc.isGrounded && prevHasHits[i] == false) || (wc.forwardFriction.speed > 0.8f && Mathf.Abs(wc.wheelHit.angleForward * Mathf.Rad2Deg) > 20f))
                        {
                            Sources[i].pitch = Random.Range(pitch - 0.15f, pitch + 0.15f);
                            Sources[i].clip  = RandomClip;
                            SetVolume(volume * Mathf.Clamp01(wc.pointVelocity.magnitude / 5f), i);
                            Sources[i].Play();
                        }
                    }

                    prevHasHits[i] = wc.isGrounded;
                }
            }
        }
Beispiel #28
0
    void Start()
    {
        bedroomEventPanel.SetActive(false);
        wheelResultPanel.SetActive(false);
        wheelPanel.SetActive(false);


        guiBedroomGameObject = GameObject.Find("GUIController");
        guiBedroom           = guiBedroomGameObject.GetComponent <GUIBedroom> ();

        guiMallGameObject = GameObject.Find("GUIController");
        guiMallScript     = guiMallGameObject.GetComponent <GUIMall> ();


        trig = wheelPanel.GetComponentInChildren <Trigger>();
        trig.OnWheelStopped += Trig_OnWheelStopped;

        bedroomQuests = new List <Quest> (Resources.LoadAll <Quest>("BedroomQuests"));

        WheelScriptToAccess = WheelObject.GetComponent <WheelController>();
        // WheelScriptToAccess.InitWheelColor = 9;
    }
Beispiel #29
0
        /// <summary>
        /// Gets the ground entity the wheel is currently on.
        /// </summary>
        public GroundEntity GetCurrentGroundEntity(WheelController wheelController)
        {
            if (wheelController.isGrounded && wheelController.wheelHit != null && wheelController.wheelHit.raycastHit.transform != null)
            {
                WheelController.WheelHit hit = null;
                wheelController.GetGroundHit(out hit);

                // Check for tags
                foreach (GroundEntity groundEntity in groundEntities)
                {
                    if (groundEntity.tags.Count > 0 &&
                        groundEntity.tags.Contains(wheelController.wheelHit.raycastHit.transform.tag))
                    {
                        return(groundEntity);
                    }
                }

                // Find active terrain
                activeTerrain = hit.raycastHit.transform?.GetComponent <Terrain>();

                if (activeTerrain)
                {
                    // Check for terrain textures
                    int dominantTerrainIndex = GetDominantTerrainTexture(hit.point, activeTerrain);
                    if (dominantTerrainIndex != -1)
                    {
                        foreach (GroundEntity groundEntity in groundEntities)
                        {
                            if (groundEntity.terrainTextureIndices.Count > 0 && groundEntity.terrainTextureIndices.Contains(dominantTerrainIndex))
                            {
                                return(groundEntity);
                            }
                        }
                    }
                }
            }

            return(null);
        }
Beispiel #30
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            String         newCSVPath = "";
            OpenFileDialog fd         = new OpenFileDialog();

            fd.Filter = "CSV files(*.csv)| *.csv";
            if (fd.ShowDialog() == true)
            {
                newCSVPath = fd.FileName;
                FilesParser newAnomaly = new FilesParser(newCSVPath, XMLPath);
                newAnomaly.parseXML();
                newAnomaly.matchXMLToCSV();
                newAnomaly.parseCSV();
                newAnomaly.CreateAnomalyCsv();

                TimeConroller.setTimeControllerValues(newAnomaly.getCSV());
                FlightInfo.setFlightValues(newAnomaly.getXML_CSVMap());
                WheelController.setMapValues(newAnomaly.getXML_CSVMap());
                GraphController.updateAnomalyMap(newAnomaly.XMLlist, newAnomaly.getXML_CSVMap());
                DllAlgorithmHandler.setValues(newAnomaly.getXML_CSVMap(), newAnomaly.XMLlist);
            }
        }
Beispiel #31
0
 // Update is called once per frame
 void Update()
 {
     AIInfos.text = "";
     if (vehicles.Count > 0)
     {
         foreach (Vehicle aiVehicle in vehicles)
         {
             if (aiVehicle.type != Vehicle.vehicleType.Base && aiVehicle.debug)
             {
                 GameObject ai           = aiVehicle.vehicleObject;
                 AIMovement aim          = ai.GetComponent <AIMovement>();
                 string     aiTargetName = aim.target == null ? "no target" : aim.target.name;
                 AIInfos.text += ai.name + ":\n";
                 AIInfos.text += "has target: " + aiTargetName + ", ";
                 AIInfos.text += "target point: " + aim.targetPoint + ", ";
                 AIInfos.text += "facing node: " + aim.facingNextNode + "\n";
                 AIInfos.text += aim.distanceInfo + "\n";
                 AIInfos.text += aim.moreInfo + "\n";
                 AIInfos.text += "z-speed: " + ai.GetComponent <VehicleController>().localVel.z + ", ";
                 AIInfos.text += "horizontal: " + ai.GetComponent <VehicleController>().horizontal + ", ";
                 AIInfos.text += "vertical: " + ai.GetComponent <VehicleController>().vertical + "\n";
                 AIInfos.text += "angleDiffToTarget: " + aim.rotationDiffY + "\n";
                 WheelController wc = ai.GetComponentInChildren <WheelController>();
                 AIInfos.text += "acc: " + wc.accelerateTorque + " left: " + wc.leftBias + " right: " + wc.rightBias +
                                 "\nturning: " + wc.turning + " accelerating: " + wc.accelerating + " braking: " + wc.braking +
                                 "\nleftBrake: " + wc.leftBrake + " rightBrake " + wc.rightBrake +
                                 "\ny-rotationspeed: " + ai.GetComponent <Rigidbody>().angularVelocity.y;
                 string currentCommandText = aim.currentCommand == null ? "no command" : aim.currentCommand.ToString();
                 AIInfos.text += "\nCurrent Command: " + currentCommandText + ", command stack:";
                 foreach (Command c in aim.commandQueue)
                 {
                     AIInfos.text += "\n" + c.ToString();
                 }
                 AIInfos.text += "\n\n";
             }
         }
     }
 }
Beispiel #32
0
    void Start()
    {
        mallEventPanel.SetActive(false);
        wheelResultPanel.SetActive(false);
        wheelPanel.SetActive(false);
        searchNetPanel.SetActive(false);

        questText_eventPanel.text = " ";
        leftButtonText.text       = " ";
        rightButtonText.text      = " ";
        wheelResultInfo.text      = " ";

        guiMallGameObject = GameObject.Find("GUIController");
        guiMall           = guiMallGameObject.GetComponent <GUIMall> ();


        trig = wheelPanel.GetComponentInChildren <Trigger>();
        trig.OnWheelStopped += Trig_OnWheelStopped;

        mallQuests = new List <Quest> (Resources.LoadAll <Quest>("MallQuests"));

        WheelScriptToAccess = WheelObject.GetComponent <WheelController> ();
        //WheelScriptToAccess.InitWheelColor = 4;
    }
Beispiel #33
0
    // Use this for initialization
    void Start()
    {
        wheel = wheel == null ? GetComponent<WheelController>() : wheel;
        particles.playOnAwake = false;
        particles.enableEmission = false;

        skidmarkPool = GetComponent<ObjectPool>();
        if (skidmarkPool == null)
            skidmarkPool = gameObject.AddComponent<ObjectPool>();

        skidAudio = GetComponent<AudioSource>();
        if (skidAudio == null)
        {
            Debug.LogError("No audio source, please add one skid audio to the tyres");
        }

        InitializePrefab();
    }
Beispiel #34
0
        public override void LoadContent()
        {
            base.LoadContent();

            World.Gravity = Vector2.Zero;
            wheel = new Wheel(ScreenManager, this, World, 150, new Vector2(), entries, new Sprite(ScreenManager.Content.Load<Texture2D>("wheelBackgroundMain")));

            cursorSprite = new Sprite(ScreenManager.Content.Load<Texture2D>("Common/cursor"));
            if (wheelController != null)
            {
                return;
            }
            if (KinectSensor.KinectSensors.Count > 0)
            {
               wheelController = new KinectGrabWheelController(wheel, ScreenManager, KinectSensor.KinectSensors[0]);
            }
            else
            {
                wheelController = new MouseWheelController(wheel, ScreenManager.GraphicsDevice);
            }
            submenus = new Dictionary<int, SubMenu>();

            Dictionary<String, AbstractHoverButton.ButtonClickedHandler> singlePlayerItems = new Dictionary<string,AbstractHoverButton.ButtonClickedHandler>();
            singlePlayerItems.Add("New Game", new AbstractHoverButton.ButtonClickedHandler(onSinglePlayerNewGameClicked));
            submenus.Add(0, new SubMenu(singlePlayerItems, ScreenManager, entries[0]));

            Dictionary<String, AbstractHoverButton.ButtonClickedHandler> highscoreItems = new Dictionary<string,AbstractHoverButton.ButtonClickedHandler>();
            highscoreItems.Add("Top 10", new AbstractHoverButton.ButtonClickedHandler(onViewHighScoresClicked));
            submenus.Add(1, new SubMenu(highscoreItems, ScreenManager, entries[1]));

            Dictionary<String, AbstractHoverButton.ButtonClickedHandler> aboutItems = new Dictionary<string,AbstractHoverButton.ButtonClickedHandler>();
            aboutItems.Add("About Us", new AbstractHoverButton.ButtonClickedHandler(onAboutUsClicked));
            submenus.Add(2, new SubMenu(aboutItems, ScreenManager, entries[2]));

            Dictionary<String, AbstractHoverButton.ButtonClickedHandler> settingsItems = new Dictionary<string,AbstractHoverButton.ButtonClickedHandler>();
            settingsItems.Add("Settings", new AbstractHoverButton.ButtonClickedHandler(onSettingsClicked));
            submenus.Add(3, new SubMenu(settingsItems, ScreenManager, entries[3]));

            Dictionary<String, AbstractHoverButton.ButtonClickedHandler> multiPlayerItems = new Dictionary<string, AbstractHoverButton.ButtonClickedHandler>();
            multiPlayerItems.Add("New Game", new AbstractHoverButton.ButtonClickedHandler(onMultiPlayerNewGameClicked));
            submenus.Add(4, new SubMenu(multiPlayerItems, ScreenManager, entries[4]));
        }
    // Use this for initialization
    void Start()
    {
        myAI        = GetComponent <AIController>();
        bDestroyer  = UnityEngine.Camera.main.GetComponentInChildren <BoundaryDestroyer>();
        carUniqueID = carCounter++;

        currentGear = 0;
        rb          = GetComponent <Rigidbody>();

        exhausts = GetComponentsInChildren <ParticleSystem>();

        if (rearLeftWheel == null)
        {
            rearLeftWheel = transform.GetChild(0).Find("Wheel").transform.Find("LeftRear").GetComponent <WheelController>();
        }
        if (rearRightWheel == null)
        {
            rearRightWheel = transform.GetChild(0).Find("Wheel").transform.Find("RightRear").GetComponent <WheelController>();
        }
        if (frontLeftWheel == null)
        {
            frontLeftWheel = transform.GetChild(0).Find("Wheel").transform.Find("LeftFront").GetComponent <WheelController>();
        }
        if (frontRightWheel == null)
        {
            frontRightWheel = transform.GetChild(0).Find("Wheel").transform.Find("RightFront").GetComponent <WheelController>();
        }

        // We set the boolean variables of the wheels
        rearLeftWheel.isRearWheel   = true;
        rearRightWheel.isRearWheel  = true;
        frontLeftWheel.isRearWheel  = false;
        frontRightWheel.isRearWheel = false;

        // We obtain the position of the wheels to calculate the different weights
        frontRightPosition = frontRightWheel.transform.localPosition.z;
        rearRightPosition  = rearRightWheel.transform.localPosition.z;

        // Text over the car with the player it is - now handled by sliders
        var txtMsh = transform.Find("Text").GetComponent <TextMesh>();

        txtMsh.text = "";

        switch (myPlayerData.getID())
        {
        case 1: txtMsh.color = Color.blue; break;

        case 2: txtMsh.color = Color.red; break;

        case 3: txtMsh.color = Color.green; break;

        case 4: txtMsh.color = Color.yellow; break;
        }

        // We set the health slider to each player
        healthSlider  = GameObject.Find("HealthSliderP" + (myPlayerData.getID()).ToString()).GetComponentInChildren <Slider>();
        healthSlider2 = GameObject.Find("HealthSliderP" + (myPlayerData.getID()).ToString() + "2").GetComponentInChildren <Slider>();
        // We try to set the background colour as well the same as appear in top of the car
        healthSlider.transform.GetChild(1).GetChild(0).GetComponent <Image>().color  = txtMsh.color;
        healthSlider2.transform.GetChild(1).GetChild(0).GetComponent <Image>().color = txtMsh.color;

        sounds = GetComponents <AudioSource>();
        noise1 = sounds[0];
        noise2 = sounds[1];

        // We set the initial health of the car+
        currentHealth = startingHealth;
        if (myAI == null)
        {
            noise1.pitch = (rpm / 10000) + 0.7f; // formula to reach ideal pitch from rpm
        }
        else
        {
            noise1.mute = true;
        }

        // If this is a respawn, the set a different layer to prevent collision with other cars
        if (transform.position.z > 3.0f)
        {
            respawnInvTime = 3.0f;
            var col = transform.Find("Colliders");
            col.gameObject.layer = LayerMask.NameToLayer("CarRespawningHitbox");
            for (int i = 0; i < col.transform.childCount; i++)
            {
                col.GetChild(i).gameObject.layer = LayerMask.NameToLayer("CarRespawningHitbox");
            }
        }
    }
    // Use this for initialization
    void Start()
    {
        myAI = GetComponent<AIController>();
        bDestroyer = UnityEngine.Camera.main.GetComponentInChildren<BoundaryDestroyer>();
        carUniqueID = carCounter++;

        currentGear = 0;
        rb = GetComponent<Rigidbody>();

        exhausts = GetComponentsInChildren<ParticleSystem>();

        if (rearLeftWheel == null)
            rearLeftWheel = transform.GetChild(0).Find("Wheel").transform.Find("LeftRear").GetComponent<WheelController>();
        if (rearRightWheel == null)
            rearRightWheel = transform.GetChild(0).Find("Wheel").transform.Find("RightRear").GetComponent<WheelController>();
        if (frontLeftWheel == null)
            frontLeftWheel = transform.GetChild(0).Find("Wheel").transform.Find("LeftFront").GetComponent<WheelController>();
        if (frontRightWheel == null)
            frontRightWheel = transform.GetChild(0).Find("Wheel").transform.Find("RightFront").GetComponent<WheelController>();

        // We set the boolean variables of the wheels
        rearLeftWheel.isRearWheel = true;
        rearRightWheel.isRearWheel = true;
        frontLeftWheel.isRearWheel = false;
        frontRightWheel.isRearWheel = false;

        // We obtain the position of the wheels to calculate the different weights
        frontRightPosition = frontRightWheel.transform.localPosition.z;
        rearRightPosition = rearRightWheel.transform.localPosition.z;

        // Text over the car with the player it is - now handled by sliders
        var txtMsh = transform.Find("Text").GetComponent<TextMesh>();
        txtMsh.text = "";

        switch (myPlayerData.getID())
        {
            case 1: txtMsh.color = Color.blue; break;
            case 2: txtMsh.color = Color.red; break;
            case 3: txtMsh.color = Color.green; break;
            case 4: txtMsh.color = Color.yellow; break;
        }

        // We set the health slider to each player
        healthSlider = GameObject.Find("HealthSliderP" + (myPlayerData.getID()).ToString()).GetComponentInChildren<Slider>();
        healthSlider2 = GameObject.Find("HealthSliderP" + (myPlayerData.getID()).ToString() + "2").GetComponentInChildren<Slider>();
        // We try to set the background colour as well the same as appear in top of the car
        healthSlider.transform.GetChild(1).GetChild(0).GetComponent<Image>().color = txtMsh.color;
        healthSlider2.transform.GetChild(1).GetChild(0).GetComponent<Image>().color = txtMsh.color;

        sounds = GetComponents<AudioSource>();
        noise1 = sounds[0];
        noise2 = sounds[1];

        // We set the initial health of the car+
        currentHealth = startingHealth;
        if (myAI == null)
        {
            noise1.pitch = (rpm / 10000) + 0.7f; // formula to reach ideal pitch from rpm

        }
        else
        {
            noise1.mute = true;
        }

        // If this is a respawn, the set a different layer to prevent collision with other cars
        if (transform.position.z > 3.0f)
        {
            respawnInvTime = 3.0f;
            var col = transform.Find("Colliders");
            col.gameObject.layer = LayerMask.NameToLayer("CarRespawningHitbox");
            for (int i = 0; i < col.transform.childCount; i++)
            {
                col.GetChild(i).gameObject.layer = LayerMask.NameToLayer("CarRespawningHitbox");
            }
        }
    }