Example #1
0
        /// <inheritdoc />
        protected override void PlaceEffect(MobileEntity source, Point2D location)
        {
            var spell = new LightSpell()
            {
                Item = this,

                Intensity  = 2,
                SkillLevel = 12,

                Cost = 0,
            };

            spell.Warm(source);
            spell.CastAt(location);
        }
    private void OnTriggerEnter(Collider other)
    {
        LightSpell lightSpell = other.GetComponentInParent <LightSpell>();

        if (lightSpell != null)
        {
            if (isSource)
            {
                // If this is an area that spawns light bugs, then start spawning them at the light spell
                // ie: start playing the particle system
                lightSpell.StartLightBugs();
            }
            else
            {
                // If this is a place where we can drop off lightbugs, then do so here
                if (lightSpell.isSelected && lightSpell.hasLightBugs && lightBugs.isStopped)
                {
                    isLightLit = true;

                    // Transfer the light bugs to the target
                    lightBugs.Play();
                    if (becomeLightSourceOnLit)
                    {
                        isSource = true;
                    }
                    else
                    {
                        lightSpell.StopLightBugs();
                    }

                    if (lightSource != null)
                    {
                        lightSource.enabled = true;
                    }
                    if (volumetricLight != null)
                    {
                        volumetricLight.SetActive(true);
                    }

                    onLit.Invoke();
                }
            }
        }
    }