Пример #1
0
 private void UseSonar()
 {
     if (Input.GetButtonDown("Fire1") && sonarTimer.IsReachedTime())
     {
         sonarTimer.Start(sonarCooldown);
         sonar.StartSonar();
     }
 }
Пример #2
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(propMode);
        EditorGUILayout.PropertyField(propDuration);

        EditorGUI.indentLevel++;

        if (propMode.hasMultipleDifferentValues ||
            propMode.enumValueIndex == (int)SonarFx.SonarMode.Directional)
        {
            EditorGUILayout.PropertyField(propDirection);
        }

        if (propMode.hasMultipleDifferentValues ||
            propMode.enumValueIndex == (int)SonarFx.SonarMode.Spherical)
        {
            EditorGUILayout.PropertyField(propOrigin);
        }

        EditorGUI.indentLevel--;

        EditorGUILayout.LabelField("Base Color");
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(propBaseColor, new GUIContent("Albedo"));
        EditorGUILayout.PropertyField(propAddColor, new GUIContent("Emission"));
        EditorGUI.indentLevel--;

        EditorGUILayout.LabelField("Wave Parameters");
        EditorGUI.indentLevel++;
        EditorGUILayout.PropertyField(propWaveColor, new GUIContent("Color"));
        EditorGUILayout.PropertyField(propWaveAmplitude, new GUIContent("Amplitude"));
        EditorGUILayout.PropertyField(propWaveExponent, new GUIContent("Exponent"));
        EditorGUILayout.PropertyField(propWaveInterval, new GUIContent("Interval"));
        EditorGUILayout.PropertyField(propWaveSpeed, new GUIContent("Speed"));
        EditorGUI.indentLevel--;
        if (GUILayout.Button("Start Sonar"))
        {
            targetObject.StartSonar();
        }

        serializedObject.ApplyModifiedProperties();
    }