Esempio n. 1
0
    public override void OnInspectorGUI()
    {
        SimpleHelvetica targetSH = (target as SimpleHelvetica);         // find target component

        if (!targetSH.enabled)
        {
            if (GUILayout.Button("Edit Text", GUILayout.MaxWidth(120)))
            {
                targetSH.EnableSelf();
            }
        }
        else
        {
            GUILayout.Label("Text");
            EditorGUILayout.HelpBox("- WARNING: Changing text will reset individual character transform changes\n- Multiple lines supported\n- Undo not supported for this Text area", MessageType.None);
            targetSH.Text             = EditorGUILayout.TextArea((target as SimpleHelvetica).Text);
            targetSH.CharacterSpacing = EditorGUILayout.FloatField("Character Spacing", (target as SimpleHelvetica).CharacterSpacing);
            targetSH.LineSpacing      = EditorGUILayout.FloatField("Line Spacing", (target as SimpleHelvetica).LineSpacing);
            targetSH.SpaceWidth       = EditorGUILayout.FloatField("Space Width", (target as SimpleHelvetica).SpaceWidth);

            //tell SimpleHelvetica.cs that something has changed (so it runs ManualUpdate() ) when Text | variables are modified
            if (targetSH.Text != PrevFrameText ||
                targetSH.CharacterSpacing != PrevFrameCharacterSpacing ||
                targetSH.LineSpacing != PrevFrameLineSpacing ||
                targetSH.SpaceWidth != PrevFrameSpaceWidth)
            {
                PrevFrameText             = targetSH.Text;
                PrevFrameCharacterSpacing = targetSH.CharacterSpacing;
                PrevFrameLineSpacing      = targetSH.LineSpacing;
                PrevFrameSpaceWidth       = targetSH.SpaceWidth;
                targetSH.GenerateText();
            }

            //DrawDefaultInspector();

            /*
             * if (!targetSH.UpdateInRealtime){
             * if(GUILayout.Button("Update Text", GUILayout.MaxWidth(120))) {
             *              targetSH.GenerateText();
             * }
             * }
             */


            EditorGUILayout.Space();
            if (GUILayout.Button("Apply\nMesh Renderer\nSettings", GUILayout.MaxWidth(120)))
            {
                targetSH.ApplyMeshRenderer();
            }
            EditorGUILayout.HelpBox("Cannot Undo when Applying Mesh Renderer Settings", MessageType.None);
        }
    }
Esempio n. 2
0
    public void Spawn3DText(string text, bool shouldStop, float distanceToStop)
    {
        this.shouldStop          = shouldStop;
        gameObject3DTextInstance = Instantiate(gameObjectText3D, new Vector3(0, 0, this.transform.position.z), Quaternion.identity);
        SimpleHelvetica simpleHelvetica = gameObject3DTextInstance.GetComponent <SimpleHelvetica>();

        simpleHelvetica.SetText(text);
        simpleHelvetica.Reset();
        Rigidbody rb = gameObject3DTextInstance.GetComponent <Rigidbody>();

        rb.velocity      = Vector3.back * 20;
        is3DTextSpawning = true;
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Awake()
    {
        InstanceCheck();

        pooledObjects = new List <GameObject>();
        StartPooling();

        policeStartSpeed    = PersistentSettings.policeStartSpeed;
        policeIncreaseSpeed = PersistentSettings.policeIncreaseSpeed;
        policeSpawnSeconds  = PersistentSettings.policeSpawnSeconds;

        currentTime = 0f;
        gameStarted = false;
        gameOver    = false;

        //cam
        camTarget = GameObject.Find("CamTarget");

        //initialize timer
        timerText      = gameObject.GetComponentInChildren <SimpleHelvetica>();
        timerText.Text = "0";
        timerText.GenerateText();

        restartText      = Instantiate(timerText);
        restartText.Text = " ";
        restartText.GenerateText();

        //spawn road tiles
        InvokeRepeating(nameof(SpawnRoads), 0f, tileSpawnSeconds);

        //spawn player
        var playerSpawnpos = new Vector3(0, player.transform.GetComponent <BoxCollider>().bounds.size.y, 0);

        player              = Instantiate(player, playerSpawnpos, Quaternion.identity);
        playerRb            = player.GetComponent <Rigidbody>();
        playerRb.useGravity = false;

        // rb.constraints = RigidbodyConstraints.FreezeAll; //TODO: add back in with correct rotation

        //spawn police cars
        policeCars             = new List <GameObject>();
        policeSpawnPosOffset.y = 1; //TODO: magic numbas
        policeSpawnPosOffset   = playerSpawnpos + policeSpawnPosOffset;

        InvokeRepeating(nameof(SpawnPoliceCars), 0f, policeSpawnSeconds);

        //spawn random road block items
        //TODO: fix attaching
        // InvokeRepeating(nameof(SpawnRoadBlockItems), 1f, policeSpawnSeconds*2f);
    }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        truck = gameObject;
        rb    = truck.transform.GetComponent <Rigidbody>();

        // print(poopSpawn);
        // FrontTyresRB.Add(tyres[2].GetComponent<Rigidbody>());
        // FrontTyresRB.Add(tyres[3].GetComponent<Rigidbody>());
        //

        currentCooldown = poopCooldown;
        poopTimer       = truck.GetComponentInChildren <SimpleHelvetica>();
        poopTimer.Text  = "test";
    }
Esempio n. 5
0
    // Update is called once per frame
    void Update()
    {
        currentDate = System.DateTime.Now.ToString("HH:mm\ndddd,MMMM\bdd");
        if (enabled)
        {
            currentDate = "";
        }

        // Update date text
        Transform       parent          = transform.parent;
        GameObject      blueScreen      = parent.Find("blue_screen").gameObject;
        GameObject      date            = blueScreen.transform.Find("Date").gameObject;
        SimpleHelvetica simpleHelvetica = date.GetComponent <SimpleHelvetica>();

        simpleHelvetica.Text = currentDate;
        simpleHelvetica.GenerateText();
    }
Esempio n. 6
0
 // Start is called before the first frame update
 void Start()
 {
     _scoreValueText = ScoreValue.GetComponent <SimpleHelvetica>();
     _speedValueText = SpeedValue.GetComponent <SimpleHelvetica>();
 }
Esempio n. 7
0
 // Start is called before the first frame update
 void Start()
 {
     score = GetComponent <SimpleHelvetica>();
 }
    public override void OnInspectorGUI()
    {
                #if UNITY_EDITOR
        SimpleHelvetica targetSH = (target as SimpleHelvetica);         // find target component

        if (!targetSH.enabled)
        {
            if (GUILayout.Button("Edit Text", GUILayout.MaxWidth(120)))
            {
                targetSH.EnableSelf();
            }
        }
        else
        {
            GUILayout.Label("Text");
            EditorGUILayout.HelpBox("- WARNING: Changing text will reset individual character transform changes\n- Multiple lines supported\n- Undo not supported for this Text area", MessageType.None);
            targetSH.Text             = EditorGUILayout.TextArea((target as SimpleHelvetica).Text);
            targetSH.CharacterSpacing = EditorGUILayout.FloatField("Character Spacing", (target as SimpleHelvetica).CharacterSpacing);
            targetSH.LineSpacing      = EditorGUILayout.FloatField("Line Spacing", (target as SimpleHelvetica).LineSpacing);
            targetSH.SpaceWidth       = EditorGUILayout.FloatField("Space Width", (target as SimpleHelvetica).SpaceWidth);

            //tell SimpleHelvetica.cs that something has changed (so it runs ManualUpdate() ) when Text | variables are modified
            if (targetSH.Text != PrevFrameText ||
                targetSH.CharacterSpacing != PrevFrameCharacterSpacing ||
                targetSH.LineSpacing != PrevFrameLineSpacing ||
                targetSH.SpaceWidth != PrevFrameSpaceWidth)
            {
                PrevFrameText             = targetSH.Text;
                PrevFrameCharacterSpacing = targetSH.CharacterSpacing;
                PrevFrameLineSpacing      = targetSH.LineSpacing;
                PrevFrameSpaceWidth       = targetSH.SpaceWidth;
                targetSH.GenerateText();
            }

            //DrawDefaultInspector();

            /*
             * if (!targetSH.UpdateInRealtime){
             * if(GUILayout.Button("Update Text", GUILayout.MaxWidth(120))) {
             *              targetSH.GenerateText();
             * }
             * }
             */
            EditorGUILayout.Space();

            if (!targetSH.BoxColliderAdded)
            {
                if (GUILayout.Button("+ Box Colliders", GUILayout.MaxWidth(120)))
                {
                    targetSH.AddBoxCollider();
                }
            }

            if (targetSH.BoxColliderAdded)
            {
                if (GUILayout.Button("- Box Colliders", GUILayout.MaxWidth(120)))
                {
                    targetSH.RemoveBoxCollider();
                }
                targetSH.BoxColliderIsTrigger = EditorGUILayout.Toggle("Is Trigger", (target as SimpleHelvetica).BoxColliderIsTrigger);
                //if(GUILayout.Button("Update Box Collider", GUILayout.MaxWidth(120))) {
                targetSH.SetBoxColliderVariables();
                //}
            }

            EditorGUILayout.Space();

            if (!targetSH.RigidbodyAdded)
            {
                if (GUILayout.Button("+ Rigidbody", GUILayout.MaxWidth(120)))
                {
                    targetSH.AddRigidbody();
                }
            }

            if (targetSH.RigidbodyAdded)
            {
                if (GUILayout.Button("- Rigidbody", GUILayout.MaxWidth(120)))
                {
                    targetSH.RemoveRigidbody();
                }
                EditorGUILayout.HelpBox("Press \"Update Rigidbody\" to apply changes\nPress \"Reset Rigidbody\" to revert to default values", MessageType.None);

                DrawDefaultInspector();

                if (GUILayout.Button("Update Rigidbody", GUILayout.MaxWidth(120)))
                {
                    targetSH.SetRigidbodyVariables();
                }

                if (GUILayout.Button("Reset Rigidbody", GUILayout.MaxWidth(120)))
                {
                    targetSH.ResetRigidbodyVariables();
                }
            }


            EditorGUILayout.Space();
            if (GUILayout.Button("Apply\nMesh Renderer\nSettings", GUILayout.MaxWidth(120)))
            {
                targetSH.ApplyMeshRenderer();
            }
            EditorGUILayout.HelpBox("Cannot Undo when Applying Mesh Renderer Settings", MessageType.None);
        }
                #endif
    }