コード例 #1
0
        public static GameObject CreateUnsafe(string effectName, string instanceId = null)
        {
            string targetingSphereJson = Get(effectName)?.Effect;

            if (targetingSphereJson == null)
            {
                return(null);
            }
            Talespire.GameObjects.InvalidateFound();
            CompositeEffect compositeEffect = CompositeEffect.CreateFrom(targetingSphereJson);
            GameObject      gameObject      = compositeEffect.CreateOrFindUnsafe(instanceId);

            compositeEffect.RefreshIfNecessary(gameObject);

            if (gameObject != null)
            {
                Talespire.Log.Debug($"gameObject: {gameObject.name}");
            }
            else
            {
                Talespire.Log.Error($"CreateOrFindUnsafe returned null!");
            }

            if (gameObject != null)
            {
                gameObject.name = effectName;
            }
            return(gameObject);
        }
コード例 #2
0
        public static GameObject Create(string effectName, string instanceId = null)
        {
            Talespire.Log.Indent($"KnownEffects.Create(\"{effectName}\")");
            try
            {
                string effectJson = Get(effectName)?.Effect;
                if (effectJson == null)
                {
                    Talespire.Log.Error($"effectJson == null");
                    return(null);
                }

                Talespire.GameObjects.InvalidateFound();
                CompositeEffect compositeEffect = CompositeEffect.CreateFrom(effectJson);
                GameObject      gameObject      = compositeEffect.CreateOrFindUnsafe(instanceId);
                compositeEffect.RefreshIfNecessary(gameObject);

                if (gameObject != null)
                {
                    gameObject.name = effectName;
                }
                return(gameObject);
            }
            finally
            {
                Talespire.Log.Unindent();
            }
        }