Beispiel #1
0
    public override void OnInspectorGUI()
    {
        MegaCacheOBJRef mod = (MegaCacheOBJRef)target;

        serializedObject.Update();

#if !UNITY_5 && !UNITY_2017 && !UNITY_2018
        EditorGUIUtility.LookLikeControls();
#endif

        EditorGUILayout.BeginVertical("box");
        EditorGUILayout.PropertyField(_prop_updatecollider, new GUIContent("Update Collider"));
        MegaCacheOBJ src = (MegaCacheOBJ)EditorGUILayout.ObjectField("Source", mod.source, typeof(MegaCacheOBJ), true);

        if (src != mod.source)
        {
            mod.SetSource(src);
            EditorUtility.SetDirty(target);
        }

        int fc = mod.GetFrames();

        if (fc > 0)
        {
            EditorGUILayout.IntSlider(_prop_frame, 0, fc);
        }

        EditorGUILayout.BeginVertical("box");

        mod.animate = EditorGUILayout.BeginToggleGroup("Animate", mod.animate);
        EditorGUILayout.PropertyField(_prop_time, new GUIContent("Time"));
        EditorGUILayout.PropertyField(_prop_fps, new GUIContent("Fps"));
        EditorGUILayout.PropertyField(_prop_speed, new GUIContent("Speed"));
        EditorGUILayout.PropertyField(_prop_loopmode, new GUIContent("Loop Mode"));

        EditorGUILayout.EndToggleGroup();
        EditorGUILayout.EndVertical();
        EditorGUILayout.EndVertical();

        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(target);
        }
    }
Beispiel #2
0
    public void SetClusterAnimation(Vector2 pos)
    {
        //Add array of refs and obj to public params
        int clusterIndex = GetClusterIndex(pos);
        //int clusterIndex = 2;
        GameObject   shatterAnimation = cubeManager.ShatterCacheObjs[clusterIndex];
        MegaCacheOBJ shatterMCO       = shatterAnimation.GetComponent <MegaCacheOBJ>();

        MegaCacheOBJRef frontFaceRef = shatterCacheRefs[0].GetComponent <MegaCacheOBJRef>();

        frontFaceRef.SetSource(shatterMCO);
        frontFaceRef.animate  = true;
        frontFaceRef.loopmode = MegaCacheRepeatMode.Clamp;
        frontFaceRef.fps      = 40;

        MegaCacheOBJRef backFaceRef = shatterCacheRefs[1].GetComponent <MegaCacheOBJRef>();

        backFaceRef.SetSource(shatterMCO);
        backFaceRef.animate  = true;
        backFaceRef.loopmode = MegaCacheRepeatMode.Clamp;
        backFaceRef.fps      = 40;

        StartCoroutine(Fade(30));
    }