예제 #1
0
    private void DrawDirectionnalArrow()
    {
        GUILayoutOption[] optionsButtonArrowUpDown = new GUILayoutOption[2] {
            GUILayout.Height(50), GUILayout.Width(20)
        };
        GUILayoutOption[] optionsButtonArrowRightLeft = new GUILayoutOption[2] {
            GUILayout.Height(20), GUILayout.Width(50)
        };

        GUILayout.Label("Direction du tire");

        GUILayout.Space(10);

        Vector3 direction = new Vector3();
        ScriptableTourelleAuto scriptTourelle = (ScriptableTourelleAuto)tourelle.scriptObstacle;

        if (GUILayout.Button("^\n||", optionsButtonArrowUpDown))
        {
            direction = Vector3.back;
            scriptTourelle.directionTourelle = direction;
            SaveScriptTourelle(scriptTourelle);
        }

        GUILayout.BeginHorizontal();

        if (GUILayout.Button("<==", optionsButtonArrowRightLeft))
        {
            direction = Vector3.right;
            tourelle.RotateHead(direction);
            scriptTourelle.directionTourelle = direction;
            SaveScriptTourelle(scriptTourelle);
        }
        if (GUILayout.Button("==>", optionsButtonArrowRightLeft))
        {
            direction = Vector3.left;
            tourelle.RotateHead(direction);
            scriptTourelle.directionTourelle = direction;
            SaveScriptTourelle(scriptTourelle);
        }

        GUILayout.EndHorizontal();

        if (GUILayout.Button("||\nˇ", optionsButtonArrowUpDown))
        {
            direction = Vector3.forward;
            tourelle.RotateHead(direction);
            scriptTourelle.directionTourelle = direction;
            SaveScriptTourelle(scriptTourelle);
        }
    }
예제 #2
0
 private void SaveScriptTourelle(ScriptableTourelleAuto scriptTourelle)
 {
     AssetDatabase.Refresh();
     EditorUtility.SetDirty(scriptTourelle);
     AssetDatabase.SaveAssets();
 }