Example #1
0
    public static IEnumerator Create(GhostData data, Emplacement place, string entityCls)
    {
        /** Create a Ghost with buffs, death-fragment (string cvar) and slowfall */
        // all ghost are lost at +100 and 3s
        if (data.drop > 0)
        {
            place.position.y = place.position.y + 40;
        }
        Entity[] Tracker   = new Entity[] { null };
        Entity   Requested = EntityCreation.Spawn(place.position, entityCls);

        yield return(EntityCreation.WaitEntity(Requested, 1.5f, Tracker));

        EntityAlive created = Tracker[0] as EntityAlive;

        if (created == null)
        {
            // Printer.Print("EntityGhost. Null:", Tracker[0]);
            yield break;
        }
        // Printer.Print("EntityGhost.Create:", created);
        if (data.deadFragment != "")
        {
            // created.SetCVar("ZBvalue_buffZBexplosif", StringMap.Encode(data.deadFragment));
            created.SetCVar(MinEventActionExplodeEntity.cvarKey, StringMap.Encode(data.deadFragment));
            //Printer.Print("EntityGhost.Create:", "ZBvalue_buffZBexplosif", StringMap.Encode(data.deadFragment));
        }
        foreach (string buff in data.buffs)
        {
            created.Buffs.AddBuff(buff);
            //Printer.Print("EntityGhost.Create:", buff, created);
        }
        if (data.drop > 0)
        {
            //Printer.Print("EntityGhost.SlowFall:", data.drop, created);
            EntityMover.SlowFall.Start(Tracker[0], data.drop, 0);
        }
    }