コード例 #1
0
    public override void DrawnNodeProperties(GUISkin skin)
    {
        base.DrawnNodeProperties(skin);

        FieldInspectorHelper.StartSection();
        collisionMask = FieldInspectorHelper.ShowMaskField("Collide Layer", collisionMask, skin);
        FieldInspectorHelper.ShowFlexibleFloatField("Col. Time Gap", fl_collisionGap, skin);
        killOnCollision = FieldInspectorHelper.ShowBoolField("Destroy On Hit", killOnCollision, skin);
        FieldInspectorHelper.EndSection();

        FieldInspectorHelper.ShowTitle("Spawn GameObject On Collision", skin, true);
        FieldInspectorHelper.StartSection();
        int spawnGameObjectListCount = FieldInspectorHelper.ShowIntField("Spawn Count", spawnGameObjectList.Count, skin);

        if (spawnGameObjectList.Count != spawnGameObjectListCount)
        {
            spawnGameObjectList.Resize <SpawnGameObjectTrigger>(spawnGameObjectListCount);
        }
        for (int i = 0; i < spawnGameObjectList.Count; i++)
        {
            var spawnTrigger = spawnGameObjectList[i];
            if (spawnTrigger == null)
            {
                spawnTrigger           = new SpawnGameObjectTrigger();
                spawnGameObjectList[i] = spawnTrigger;
            }

            spawnTrigger.bShow = FieldInspectorHelper.ShowExpandField(string.Format("Index {0}", i + 1), spawnTrigger.bShow, skin);
            if (spawnTrigger.bShow)
            {
                FieldInspectorHelper.StartSubSection();
                spawnTrigger.template    = FieldInspectorHelper.ShowObjectField <GameObject>("Template", spawnTrigger.template, skin);
                spawnTrigger.count       = FieldInspectorHelper.ShowIntField("Quanity", spawnTrigger.count, skin);
                spawnTrigger.useLocation = FieldInspectorHelper.ShowBoolField("Copy Location", spawnTrigger.useLocation, skin);
                spawnTrigger.useRotation = FieldInspectorHelper.ShowBoolField("Copy Rotation", spawnTrigger.useRotation, skin);
                spawnTrigger.parentTo    = (ParentTo)FieldInspectorHelper.ShowEnumField("Parent To", spawnTrigger.parentTo, skin);
                FieldInspectorHelper.EndSubSection();
            }
        }
        FieldInspectorHelper.EndSection();
    }
コード例 #2
0
    public override void DrawnNodeProperties(GUISkin skin)
    {
        base.DrawnNodeProperties(skin);

        FieldInspectorHelper.StartSection();

        int spawnGameObjectListCount = FieldInspectorHelper.ShowIntField("Spawn Count", spawnGameObjectList.Count, skin);

        if (spawnGameObjectList.Count != spawnGameObjectListCount)
        {
            spawnGameObjectList.Resize <SpawnGameObjectTrigger>(spawnGameObjectListCount);
        }

        for (int i = 0; i < spawnGameObjectList.Count; i++)
        {
            var spawnTrigger = spawnGameObjectList[i];
            if (spawnTrigger == null)
            {
                spawnTrigger           = new SpawnGameObjectTrigger();
                spawnGameObjectList[i] = spawnTrigger;
            }

            spawnTrigger.bShow = FieldInspectorHelper.ShowExpandField(string.Format("Index {0}", i + 1), spawnTrigger.bShow, skin);
            if (spawnTrigger.bShow)
            {
                FieldInspectorHelper.StartSubSection();
                spawnTrigger.template    = FieldInspectorHelper.ShowObjectField <GameObject>("Template", spawnTrigger.template, skin);
                spawnTrigger.count       = FieldInspectorHelper.ShowIntField("Quanity", spawnTrigger.count, skin);
                spawnTrigger.useLocation = FieldInspectorHelper.ShowBoolField("Copy Location", spawnTrigger.useLocation, skin);
                spawnTrigger.useRotation = FieldInspectorHelper.ShowBoolField("Copy Rotation", spawnTrigger.useRotation, skin);
                spawnTrigger.parentTo    = (ParentTo)FieldInspectorHelper.ShowEnumField("Parent To", spawnTrigger.parentTo, skin);
                FieldInspectorHelper.EndSubSection();
            }
        }
        FieldInspectorHelper.EndSection();
    }
コード例 #3
0
    public static void ShowFlexibleVector3Field(string fieldName, FlexibleVector3 value, GUISkin skin, bool bRotation = false)
    {
        GUILayout.BeginHorizontal();
        switch (value.type)
        {
        case FlexibleEditType.Uniform:
            value.SetValue(ShowVector3Field(fieldName, value.uniformValue, skin, bRotation));
            break;

        case FlexibleEditType.RangeTween:
            GUILayout.BeginVertical();
            ShowLabel(fieldName, skin);
            FieldInspectorHelper.StartSubSection();
            ShowFloatRangeField(bRotation ? "Pitch(X)" : "X", value.rangeX, skin);
            ShowFloatRangeField(bRotation ? "Yaw (Y)" : "Y", value.rangeY, skin);
            ShowFloatRangeField(bRotation ? "Roll (Z)" : "Z", value.rangeZ, skin);
            FieldInspectorHelper.EndSubSection();
            GUILayout.EndVertical();
            break;

        case FlexibleEditType.RangeRandom:
            GUILayout.BeginVertical();
            ShowLabel(fieldName, skin);
            FieldInspectorHelper.StartSubSection();
            ShowFloatRangeField(bRotation ? "Pitch(X)" : "X", value.rangeX, skin, " rand ");
            ShowFloatRangeField(bRotation ? "Yaw (Y)" : "Y", value.rangeY, skin, " rand ");
            ShowFloatRangeField(bRotation ? "Roll (Z)" : "Z", value.rangeZ, skin, " rand ");
            FieldInspectorHelper.EndSubSection();
            GUILayout.EndVertical();
            break;

        case FlexibleEditType.Curve:
            GUILayout.BeginVertical();
            ShowLabel(fieldName, skin);
            FieldInspectorHelper.StartSubSection();
            value.curveX = ShowCurveField(bRotation ? "Pitch(X)" : "X", value.curveX, skin, true);
            value.curveY = ShowCurveField(bRotation ? "Yaw (Y)" : "Y", value.curveY, skin, true);
            value.curveZ = ShowCurveField(bRotation ? "Roll (Z)" : "Z", value.curveZ, skin, true);
            FieldInspectorHelper.EndSubSection();
            GUILayout.EndVertical();
            break;

        default:
            break;
        }
        if (EditorGUILayout.DropdownButton(new GUIContent(), FocusType.Passive, skin.GetStyle("minipulldown")))
        {
            GenericMenu menu = new GenericMenu();
            if (value.type != FlexibleEditType.Uniform)
            {
                menu.AddItem(new GUIContent("Vector3 Constant"), false, () => { value.type = FlexibleEditType.Uniform; });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Vector3 Constant"));
            }

            if (value.type != FlexibleEditType.RangeTween)
            {
                menu.AddItem(new GUIContent("Vector3 Linear Tween"), false, () => { value.type = FlexibleEditType.RangeTween; });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Vector3 Linear Tween"));
            }

            if (value.type != FlexibleEditType.RangeRandom)
            {
                menu.AddItem(new GUIContent("Vector3 Random"), false, () => { value.type = FlexibleEditType.RangeRandom; });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Vector3 Random"));
            }

            if (value.type != FlexibleEditType.Curve)
            {
                menu.AddItem(new GUIContent("Vector3 Curve"), false, () => { value.type = FlexibleEditType.Curve; });
            }
            else
            {
                menu.AddDisabledItem(new GUIContent("Vector3 Curve"));
            }
            menu.ShowAsContext();
        }
        GUILayout.EndHorizontal();
    }