Exemplo n.º 1
0
        private GameObject GetEffect(BattleAnimationEffect animation, IVariableStore variables)
        {
            GameObject effect = null;

            switch (animation.EffectSource)
            {
            case BattleAnimationSource.Display: Effects.TryGetValue(animation.Effect, out effect); break;

            case BattleAnimationSource.Variables: variables.GetVariable(animation.Effect).TryGetObject(out effect); break;
            }

            return(effect);
        }
Exemplo n.º 2
0
        private AudioClip GetSound(BattleAnimationSound animation, IVariableStore variables)
        {
            AudioClip sound = null;

            switch (animation.SoundSource)
            {
            case BattleAnimationSource.Display: Sounds.TryGetValue(animation.Sound, out sound); break;

            case BattleAnimationSource.Variables: variables.GetVariable(animation.Sound).TryGetObject(out sound); break;
            }

            return(sound);
        }
Exemplo n.º 3
0
        private AnimationClip GetAnimation(BattleAnimationClip animation, IVariableStore variables)
        {
            AnimationClip clip = null;

            switch (animation.AnimationSource)
            {
            case BattleAnimationSource.Display: Animations.TryGetValue(animation.Animation, out clip); break;

            case BattleAnimationSource.Variables: variables.GetVariable(animation.Animation).TryGetObject(out clip); break;
            }

            return(clip);
        }
Exemplo n.º 4
0
        public static IVariableStore DrawTable(IVariableStore store, bool allowAddRemove)
        {
            var            names         = store.GetVariableNames();
            IVariableStore selectedStore = null;

            foreach (var name in names)
            {
                var value = store.GetVariable(name);

                using (var changes = new EditorGUI.ChangeCheckScope())
                {
                    switch (value.Type)
                    {
                    case VariableType.Empty: DrawEmpty(name, ref value); break;

                    case VariableType.Boolean: DrawBoolean(name, ref value); break;

                    case VariableType.Integer: DrawInteger(name, ref value); break;

                    case VariableType.Number: DrawNumber(name, ref value); break;

                    case VariableType.String: DrawString(name, ref value); break;

                    case VariableType.Null: DrawNull(name, ref value); break;

                    default:
                    {
                        if (DrawLink(name, value.RawObject))                                 // TODO: show object picker
                        {
                            selectedStore = value.Store;
                        }

                        break;
                    }
                    }

                    if (changes.changed)
                    {
                        store.SetVariable(name, value);
                    }
                }
            }

            return(selectedStore);
        }
Exemplo n.º 5
0
        private VariableValue GetValue(IVariableStore variables, int index)
        {
            var variable = _variable[index];
            var lookup   = _lookups[index];

            var value = variables.GetVariable(variable);

            if (!string.IsNullOrEmpty(lookup) && value.Type == VariableType.Object)
            {
                if (lookup == _gameObjectName)
                {
                    var obj = ComponentHelper.GetAsGameObject(value.Object);
                    value = obj != null?VariableValue.Create(obj) : VariableValue.Empty;
                }
                else
                {
                    var component = ComponentHelper.GetAsComponent(value.Object, lookup);
                    value = component != null?VariableValue.Create(component) : VariableValue.Empty;
                }
            }

            return(value);
        }
Exemplo n.º 6
0
 public virtual VariableValue GetVariable(string name) => name == ValueName ? Value : _parent.GetVariable(name);