Exemple #1
0
    private void SerializeOptions()
    {
        if (_options == null)
        {
            return;
        }

        if (_serializedOptions == null)
        {
            _serializedOptions           = new ActionDicitonary();
            _serializedGameObjectOptions = new ActionGameObjectDicitonary();
        }

        foreach (var field in _options.GetType().GetFields(BindingFlags.Instance |
                                                           BindingFlags.NonPublic |
                                                           BindingFlags.Public))
        {
            if (field.FieldType == typeof(GameObject))
            {
                _serializedGameObjectOptions[field.Name] = (GameObject)field.GetValue(_options);
            }
            else
            {
                var value = field.GetValue(_options);
                if (value != null)
                {
                    _serializedOptions[field.Name] = value.ToString();
                }
            }
        }
    }
Exemple #2
0
    public void Initialize(InteractiveObject owner)
    {
        DeserializeOptions();
        _serializedOptions.Clear();
        _serializedOptions = null;
        _serializedGameObjectOptions.Clear();
        _serializedGameObjectOptions = null;

        if (action)
        {
            action.owner = owner;
        }
    }