示例#1
0
    public TileObject CreateTOAtPos <T>(T tileObject, TileObjectDefintion toDef) where T : TileObject
    {
        //Log("CreateTileObjectAtPos: " + to + ", " + pos + ", typeof(T): " + typeof(T) + ", totype: "+ to.GetType());
        TileObject toInst = PrefabLibrary.I.GetTileObject(tileObject);

        InitTO(toInst, toDef);
        return(toInst);
    }
示例#2
0
 public override void Set(TileObjectDefintion def)
 {
     base.Set(def);
     if (def.GetType() == typeof(ExitDefinition))
     {
         ExitDefinition newDef = (ExitDefinition)def;
         _exitDef.color = newDef.color;
     }
     Refresh();
 }
示例#3
0
 public override void Set(TileObjectDefintion def)
 {
     base.Set(def);
     if (def.GetType() == typeof(TeleportDefinition))
     {
         TeleportDefinition newDef = (TeleportDefinition)def;
         _def.teleportCycleIdx = newDef.teleportCycleIdx;
     }
     Refresh();
 }
示例#4
0
 public override void Set(TileObjectDefintion def)
 {
     base.Set(def);
     if (def.GetType() == typeof(SpikesDefintion))
     {
         SpikesDefintion newSpikesDef = (SpikesDefintion)def;
         spikesDef.isRaised = newSpikesDef.isRaised;
     }
     Refresh();
 }
示例#5
0
    private void InitTO(TileObject toInst, TileObjectDefintion toDef)
    {
        toInst.Set(toDef);

        toInst.gameObject.name    = "TO:" + toInst.GetType() + ", " + toDef.pos;
        toInst.transform.position = GameHelper.TileToWorldPos(toDef.pos) + (Vector2)transform.position;
        toInst.transform.SetParent(TOCont.transform);
        toInst.transform.localScale = Vector3.one;

        tileMap.AddTileObject(toInst);
    }
示例#6
0
    public void CreateTOAtPos(System.Type typ, TileObjectDefintion toDef)
    {
        TileObject toInst = PrefabLibrary.I.GetTileObject(typ);

        InitTO(toInst, toDef);
    }
示例#7
0
 public virtual void Set(TileObjectDefintion def)
 {
     ToDef.pos       = def.pos;
     ToDef.className = def.className;
 }