Ejemplo n.º 1
0
    private bool CreateInstance(out GameGizmo.Instance instance, Type type)
    {
        bool flag;

        try
        {
            instance = this.ConstructInstance();
            if (!object.ReferenceEquals(instance, null))
            {
                if (this._instances == null)
                {
                    this._instances = new HashSet <GameGizmo.Instance>();
                }
                this._instances.Add(instance);
                if (!type.IsAssignableFrom(instance.GetType()))
                {
                    this.DestroyInstance(instance);
                    throw new InvalidCastException();
                }
                return(true);
            }
            else
            {
                flag = false;
            }
        }
        catch (Exception exception)
        {
            Debug.LogException(exception, this);
            instance = null;
            flag     = false;
        }
        return(flag);
    }
Ejemplo n.º 2
0
 private bool DestroyInstance(GameGizmo.Instance instance)
 {
     if (object.ReferenceEquals(instance, null) || this._instances == null || !this._instances.Remove(instance))
     {
         return(false);
     }
     try
     {
         instance.ClearResources();
         this.DeconstructInstance(instance);
     }
     catch (Exception exception)
     {
         Debug.LogException(exception, this);
     }
     return(true);
 }
Ejemplo n.º 3
0
 protected virtual void DeconstructInstance(GameGizmo.Instance instance)
 {
 }