public IEnumerator Fragments(EntityAlive ctrl, Vector3 pos)
    {
        Printer.Log(81, "MinEventActionImpactFragment", ctrl, pos, this.item);
        string item = this.item;

        if (item.StartsWith("$"))
        {
            item = StringMap.Get(ctrl, item);
        }
        if (item == "")
        {
            yield break;
        }
        Printer.Log(30, "MinEventActionImpactFragment", ctrl, pos, ctrl.GetPosition());
        YieldInstruction dt = new WaitForSeconds((float)this.dt / 1000f);

        for (int replicate = 0; replicate < rep; replicate++)
        {
            yield return(dt);

            Vector3 offset = Vectors.Float.Randomize(random, 0.5f, Vectors.Float.UnitY);
            // Vector3 motion = Vectors.Float.Randomize(random, 1f, Vectors.Float.UnitY);
            Vector3 motion = offset.normalized * (1f + 5 * random.RandomFloat);
            motion = motion.normalized * 3;
            yield return(SdtdUtils.EffectsItem.spawnItemGhost(ctrl, item, pos + offset + Vectors.Float.UnitY, motion));
        }
    }
    private static IEnumerator _Trigger(EntityAlive entity)
    {
        if (entity == null)
        {
            yield break;
        }
        Vector3 pos  = entity.GetPosition();
        string  item = StringMap.Get(entity, cvarKey);

        // Printer.Print("MinEventActionExplodeEntity", entity, pos, item);
        if (item == "")
        {
            Printer.Print("StringMap no cvar");
        }
        else
        {
            Vector3 offset = 0.3f * Vectors.Float.UnitY;
            Vector3 motion = -Vectors.Float.UnitY;
            motion = motion.normalized * 3;
            yield return(SdtdUtils.EffectsItem.spawnItemGhost(item, pos + offset + Vectors.Float.UnitY, motion));

            yield return(dt);
        }
        if (entity == null)
        {
            yield break;
        }
        entity.SetDead();
    }
        public object Get(string name, System.Type type)
        {
            object obj = null;

            if (type == typeof(UnityEngine.Object) || type.IsSubclassOf(typeof(UnityEngine.Object)))
            {
                obj = objects.Get(name);
            }
            else if (type == typeof(float))
            {
                obj = floats.Get(name);
            }
            else if (type == typeof(int))
            {
                obj = ints.Get(name);
            }
            else if (type == typeof(string))
            {
                obj = strings.Get(name) ?? string.Empty;
            }
            else if (type == typeof(bool))
            {
                obj = bools.Get(name);
            }
            else if (type.IsSubclassOf(typeof(System.Enum)))
            {
                obj = enums.Get(name);
            }
            else if (type == typeof(Vector3))
            {
                obj = vector3s.Get(name);
            }
            else if (type == typeof(Vector2))
            {
                obj = vector2s.Get(name);
            }
            else if (type == typeof(Vector4))
            {
                obj = vector4s.Get(name);
            }
            else if (type == typeof(Color))
            {
                obj = colors.Get(name);
            }
            else if (type == typeof(LayerMaskMap))
            {
                obj = layerMasks.Get(name);
            }
            else
            {
                throw new NotSupportedException($"Type {type.AssemblyQualifiedName} is not supported. ({name})");
            }
            if (obj == null && type.IsValueType)
            {
                return(Activator.CreateInstance(type));
            }
            return(obj);
        }
 public GameObject GetTarget(StringMap actorMap)
 {
     if (actorMap != null) {
         if (actorMap.ContainsKey(Name)) {
             return GameObject.Find(actorMap.Get(Name).Value);
         }
     }
     return GameObject.Find(Name);
 }