summaryrefslogtreecommitdiff
path: root/VRCSDK3Avatars/Assets/_PoiyomiShaders/Scripts/ModularShaderSystem/Scriptables/EnableProperty.cs
blob: d1b532a38c489f70276cbcf059dd96216a1770ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
using System;
using System.Collections.Generic;

namespace Poiyomi.ModularShaderSystem
{
    [Serializable]
    public class EnableProperty : Property, IEquatable<EnableProperty>
    {
        public int EnableValue;

        public EnableProperty(string name, string displayName, int enableValue)
        {
            Name = name;
            DisplayName = displayName;
            Type = "Float";
            DefaultValue = "0.1";
            Attributes = new List<string>();

            EnableValue = enableValue;
        }
        
        public override Variable ToVariable()
        {
            Variable variable = new Variable();
            variable.Name = Name;
            variable.Type = VariableType.Float;
            return variable;
        }

        public EnableProperty(string name, int enableValue) : this(name, name, enableValue){}

        bool IEquatable<EnableProperty>.Equals(EnableProperty other)
        {
            return Equals(other);
        }
        
        public override bool Equals(object obj)
        {
            if (obj is Property other)
                return Name == other.Name;

            return false;
        }

        public static bool operator == (EnableProperty left, EnableProperty right)
        {
            return left?.Equals(right) ?? right is null;
        }

        public static bool operator !=(EnableProperty left, EnableProperty right)
        {
            return !(left == right);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}