Example #1
0
        public virtual void Init()
        {
            if (_Instance != null)
            {
                return;
            }

            _Instance = this;

            OnExitingPlayMode_Event = new FOnExitingPlayMode();

            ObjectMap = new Dictionary <ulong, ICgObject>();

            MCgDataMapping.Init();
            FCgManager_Prefab.Get().Init();

#if UNITY_EDITOR
            FCgPlayInEditor.Get();
#endif // #if UNITY_EDITOR

            // Set Editor Callbacks
#if UNITY_EDITOR
            EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
#endif // #if UNITY_EDITOR
        }
Example #2
0
        public virtual ObjectType ConstructObject_Internal(EnumType e)
        {
            Type       type = typeof(ObjectType);
            GameObject go   = MonoBehaviour.Instantiate(FCgManager_Prefab.Get().EmptyGameObject);

            go.name = type.ToString();
            return((ObjectType)(object)go.AddComponent(type));
        }
Example #3
0
        public virtual MCgProjectile ConstructObject(FECgProjectileType type)
        {
            GameObject go = MonoBehaviour.Instantiate(FCgManager_Prefab.Get().EmptyGameObject);

            go.name = type.Name;
            MCgProjectile o = (MCgProjectile)go.AddComponent(TypeMap[type]);

            return(o);
        }
Example #4
0
        public static void Init(Type type)
        {
            if (_Instance != null)
            {
                return;
            }

            if (!type.IsSubclassOf(typeof(TCgManager_PooledMonoObjects_Map <FECgProjectileType, MCgProjectile, FCgProjectilePayload, FCgProjectileCache>)))
            {
                FCgDebug.Log("ICgManager_Projectile.Init: Passed in Type of " + type.GetType().Name + " is NOT a SubclassOf TCgManager_PooledMonoObjects_Map<FECgProjectileType, MCgProjectile, FCgProjectilePayload, FCgProjectileCache>");
                return;
            }

            GameObject go = MonoBehaviour.Instantiate(FCgManager_Prefab.Get().EmptyGameObject);

            _Instance = go.AddComponent <ICgManager_Projectile>();
            go.name   = "ICgManager_Projectile";

            _Instance.Internal = (FCgManager_Projectile)type.GetConstructor(Type.EmptyTypes).Invoke(Type.EmptyTypes);
            _Instance.Internal.OnAddToPool_Event.Add(_Instance.OnAddToPool);
            _Instance.Internal.ConstructObject.Unbind();
            _Instance.Internal.ConstructObject.Bind(_Instance.ConstructObject);
        }