コード例 #1
0
ファイル: TraitCollection.cs プロジェクト: xJayLee/RPGCore
        public StateInstance this[StateIdentifier identifier]
        {
            get
            {
                if (Stats == null)
                {
                    return(null);
                }

                return(States[identifier]);
            }
        }
コード例 #2
0
        public StateTemplate this[StateIdentifier identifier]
        {
            get
            {
                if (States == null)
                {
                    return(null);
                }

                return(States[identifier]);
            }
        }
コード例 #3
0
ファイル: TraitCollection.cs プロジェクト: shoshiiran/RPGCore
        public StateInstance this[StateIdentifier identifier]
        {
            get
            {
                if (Stats == null)
                {
                    return(null);
                }

                if (!States.TryGetValue(identifier, out var instance))
                {
                    var template = traitContext.States[identifier];
                    instance = template.CreateInstance(identifier);
                    States.Add(identifier, instance);
                }
                return(instance);
            }
        }