public void Start()
    {
        _hoverMotor = GetComponent <HoverMotor>();

        _networkInterface = GetComponent <HoverCarNetworkInterface>();

        _controller = (ViewController)GameObject.Find("Login").GetComponent <Login>().Controller;
    }
    public override void OnInspectorGUI()
    {
        GUIStyle boldFoldout = new GUIStyle(EditorStyles.foldout);

        boldFoldout.fontStyle = FontStyle.Bold;
        HoverMotor targetScript = (HoverMotor)target;

        HoverMotor[] allTargets = new HoverMotor[targets.Length];
        isPrefab = PrefabUtility.GetPrefabType(targetScript) == PrefabType.Prefab;

        for (int i = 0; i < targets.Length; i++)
        {
            Undo.RecordObject(targets[i], "Hover Motor Change");
            allTargets[i] = targets[i] as HoverMotor;
        }

        topSpeed = targetScript.forceCurve.keys[targetScript.forceCurve.keys.Length - 1].time;

        if (targetScript.wheels != null)
        {
            if (targetScript.wheels.Length == 0)
            {
                EditorGUILayout.HelpBox("No wheels are assigned.", MessageType.Warning);
            }
            else if (targets.Length == 1)
            {
                EditorGUILayout.LabelField("Top Speed (Estimate): " + (topSpeed * 2.23694f).ToString("0.00") + " mph || " + (topSpeed * 3.6f).ToString("0.00") + " km/h", EditorStyles.boldLabel);
            }
        }
        else
        {
            EditorGUILayout.HelpBox("No wheels are assigned.", MessageType.Warning);
        }

        DrawDefaultInspector();

        if (!isPrefab && targetScript.gameObject.activeInHierarchy)
        {
            showButtons = EditorGUILayout.Foldout(showButtons, "Quick Actions", boldFoldout);
            EditorGUI.indentLevel++;
            if (showButtons)
            {
                if (GUILayout.Button("Get Wheels"))
                {
                    foreach (HoverMotor curTarget in allTargets)
                    {
                        curTarget.wheels = (HoverWheel[])((Transform)F.GetTopmostParentComponent <VehicleParent>(curTarget.transform).transform).GetComponentsInChildren <HoverWheel>();
                    }
                }
            }
            EditorGUI.indentLevel--;
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(targetScript);
        }
    }
Example #3
0
    public override void OnInspectorGUI()
    {
        GUIStyle boldFoldout = new GUIStyle(EditorStyles.foldout);
        boldFoldout.fontStyle = FontStyle.Bold;
        HoverMotor targetScript = (HoverMotor)target;
        HoverMotor[] allTargets = new HoverMotor[targets.Length];
        isPrefab = PrefabUtility.GetPrefabType(targetScript) == PrefabType.Prefab;

        for (int i = 0; i < targets.Length; i++)
        {
            Undo.RecordObject(targets[i], "Hover Motor Change");
            allTargets[i] = targets[i] as HoverMotor;
        }

        topSpeed = targetScript.forceCurve.keys[targetScript.forceCurve.keys.Length - 1].time;

        if (targetScript.wheels != null)
        {
            if (targetScript.wheels.Length == 0)
            {
                EditorGUILayout.HelpBox("No wheels are assigned.", MessageType.Warning);
            }
            else if (targets.Length == 1)
            {
                EditorGUILayout.LabelField("Top Speed (Estimate): " + (topSpeed * 2.23694f).ToString("0.00") + " mph || " + (topSpeed * 3.6f).ToString("0.00") + " km/h", EditorStyles.boldLabel);
            }
        }
        else
        {
            EditorGUILayout.HelpBox("No wheels are assigned.", MessageType.Warning);
        }

        DrawDefaultInspector();

        if (!isPrefab && targetScript.gameObject.activeInHierarchy)
        {
            showButtons = EditorGUILayout.Foldout(showButtons, "Quick Actions", boldFoldout);
            EditorGUI.indentLevel ++;
            if (showButtons)
            {
                if (GUILayout.Button("Get Wheels"))
                {
                    foreach (HoverMotor curTarget in allTargets)
                    {
                        curTarget.wheels = (HoverWheel[])((Transform)F.GetTopmostParentComponent<VehicleParent>(curTarget.transform).transform).GetComponentsInChildren<HoverWheel>();
                    }
                }
            }
            EditorGUI.indentLevel --;
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(targetScript);
        }
    }
Example #4
0
// Use this for initialization
    void Start()
    {
        MEC              = MRacer.GetComponent <EnergyController>();
        MHM              = MRacer.GetComponent <HoverMotor>();
        shildLevelMax    = 600;
        shildLevel       = shildLevelMax;
        timeBoosterValue = Time.deltaTime;
        impact           = false;
        shildsDown       = false;
    }
 // Use this for initialization
 void Start()
 {
     MEC = MRacer.GetComponent <EnergyController>();
     MSC = MRacer.GetComponent <ShildController>();
     MHM = MRacer.GetComponent <HoverMotor>();
     boost.Pause();
     boostPlayed    = false;
     accPlayed      = false;
     airbreakPlayed = false;
     shildPlayed    = false;
 }
Example #6
0
    // Use this for initialization

    void Start()
    {
        // get the car controller reference

        _hoverMotor = GetComponent <HoverMotor>();

        // give the random perlin a random value

        _m_RandomPerlin = Random.value * 100;

        _m_Rigidbody = GetComponent <Rigidbody>();
    }
    // Use this for initialization
    void Start()
    {
        MHM = MRacer.GetComponent <HoverMotor>();
        MSC = MRacer.GetComponent <ShildController>();


        tBSpeedB = 10;
        tBLifeB  = 0.4f;
        tBSpeed  = 0;
        tBLife   = 0;
        tBAcc    = 0.5f;
        tBLA     = 0.02f;
        tBSlow   = 0.0125f;
        tBLS     = 0.005f;

        shieldsDownCounter = 0.3f;
        explosion.Stop();
    }
Example #8
0
    void OnSceneGUI()
    {
        HoverMotor motor  = target as HoverMotor;
        Vector3    origin = motor.transform.position + (Vector3.up * motor.rayCastHeightModifier);

        Handles.color = Color.red;
        //float size = motor.sphereCastRadius * 2f;

        //Handles.SphereHandleCap(0, origin + (Vector3.up * motor.sphereCastRadius), Quaternion.identity, size, EventType.Repaint);
        //Handles.SphereHandleCap(0, origin + (Vector3.up * motor.sphereCastRadius) + (Vector3.down * hoverHeight), Quaternion.identity, size, EventType.Repaint);

        List <Vector3> directions = motor.raycastDirections;

        for (int i = 0; i < directions.Count; i++)
        {
            float rayLength = motor.CalculateHoverRayLengthFromIndex(i);
            Handles.DrawLine(origin, origin + (directions[i].normalized * rayLength));
        }
    }
Example #9
0
    private HoverMotor HoverCar; // the car controller we want to use

    private void Awake()
    {
        HoverCar = GetComponent <HoverMotor>();
    }
 private void Start()
 {
     hm = GetComponent <HoverMotor>();
 }
Example #11
0
 // Use this for initialization
 void Start()
 {
     MHM   = MRacer.GetComponent <HoverMotor>();
     SCtrl = MRacer.GetComponent <ShildController>();
     BCtrl = MRacer.GetComponent <BoostController>();
 }
    public void Start()
    {
        _hoverMotor = GetComponent <HoverMotor>();

        _networkInterface = GetComponent <HoverCarNetworkInterface>();
    }
Example #13
0
 void Start()
 {
     hoverMotor = GetComponent <HoverMotor>();
     rb         = GetComponent <Rigidbody>();
 }
Example #14
0
    //public RectTransform eHub;

    // Use this for initialization
    void Start()
    {
        hEnergy = true;
        MHM     = MRacer.GetComponent <HoverMotor>();
        MEC     = MRacer.GetComponent <EnergyController>();
    }
Example #15
0
 private void Awake()
 {
     Vehicle = GetComponent <HoverMotor>();
 }