Beispiel #1
0
            static GameObject GetSpell(string effectName, string spellId, float lifeTime, float enlargeTimeSeconds, float shrinkOnDeleteTime, float rotationDegrees, bool isMoveable)
            {
                GameObject spell = GetEffect(effectName, spellId, isMoveable);

                if (spell == null)
                {
                    Log.Error($"Spell effect \"{effectName}\" not found. Unable to Play the effect.");
                    return(null);
                }

                float actualRotation = rotationDegrees;

                if (actualRotation == -1)
                {
                    actualRotation = RandomRange(0, 360);
                }
                spell.transform.Rotate(Vector3.up, actualRotation);

                spell.name = GetSpellName(spellId, effectName, isMoveable);
                // TODO: Figure out how to implement Moveable spells.
                if (lifeTime > 0)
                {
                    float particleShutoffTimeSeconds = Math.Min(2, lifeTime / 5);
                    if (shrinkOnDeleteTime > particleShutoffTimeSeconds)
                    {
                        particleShutoffTimeSeconds = shrinkOnDeleteTime;
                    }
                    Instances.AddTemporal(spell, lifeTime, particleShutoffTimeSeconds, enlargeTimeSeconds, shrinkOnDeleteTime);
                }
                else
                {
                    Instances.AddSpell(spellId, spell, enlargeTimeSeconds, shrinkOnDeleteTime);
                }

                return(spell);
            }