Ejemplo n.º 1
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static Interfacing.EntityHandle CreateEntity(Entity ent)
    {
        string prefabPath = "Prefabs/" + ent.entityClass.ToString() + "/";

        switch (ent.entityClass)
        {
        case EntityClass.Character: prefabPath += ((CharacterType)ent.entityType).ToString(); break;

        case EntityClass.Rune: prefabPath += ((RuneType)ent.entityType).ToString(); break;

        case EntityClass.Collectible: prefabPath += ((CollectibleType)ent.entityType).ToString(); break;

        case EntityClass.SpellEffect: prefabPath += ((SpellEffectType)ent.entityType).ToString(); break;

        case EntityClass.Mech: prefabPath += ((MechType)ent.entityType).ToString(); break;
        }

        GameObject obj = Instantiate((GameObject)Resources.Load(prefabPath));

        obj.transform.SetParent(GameObject.Find("Entities").transform, false);
        obj.SetActive(false);


        var handle = new Interfacing.EntityHandle()
        {
            idx = (uint)entities.Count
        };

        var objGr = obj.GetComponent <EntityGraphics>();

        objGr.entity     = ent;
        objGr.entityType = ent.entityType;

        entities.Add(handle, obj);

        return(handle);
    }
Ejemplo n.º 2
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceUpdateRotation(Interfacing.EntityHandle objHandle, uint dir)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().UpdateInterfaceRotation(dir);
    }
Ejemplo n.º 3
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceDie(Interfacing.EntityHandle objHandle)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().Die();
    }
Ejemplo n.º 4
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceUpdateHP(Interfacing.EntityHandle objHandle, float currentHP, float maxHP)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().UpdateHP(currentHP, maxHP);
    }
Ejemplo n.º 5
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceDamage(Interfacing.EntityHandle objHandle, float dmg)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().Damage(dmg);
    }
Ejemplo n.º 6
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceStop(Interfacing.EntityHandle objHandle, HexXY pos)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().Stop(pos);
    }
Ejemplo n.º 7
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceMovePrecise(Interfacing.EntityHandle objHandle, Vector2 pos, float timeToGetThere)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().MovePrecise(pos, timeToGetThere);
    }
Ejemplo n.º 8
0
Archivo: G.cs Proyecto: Dzugaru/hexes
    static void PerformInterfaceSpawn(Interfacing.EntityHandle objHandle, HexXY pos, uint dir)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().Spawn(pos, dir);
    }
Ejemplo n.º 9
0
    void PerformInterfaceTeleport(Interfacing.EntityHandle objHandle, HexXY to)
    {
        GameObject obj = entities[objHandle];

        obj.GetComponent <EntityGraphics>().Teleport(to);
    }