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); }
public override void Set(TileObjectDefintion def) { base.Set(def); if (def.GetType() == typeof(ExitDefinition)) { ExitDefinition newDef = (ExitDefinition)def; _exitDef.color = newDef.color; } Refresh(); }
public override void Set(TileObjectDefintion def) { base.Set(def); if (def.GetType() == typeof(TeleportDefinition)) { TeleportDefinition newDef = (TeleportDefinition)def; _def.teleportCycleIdx = newDef.teleportCycleIdx; } Refresh(); }
public override void Set(TileObjectDefintion def) { base.Set(def); if (def.GetType() == typeof(SpikesDefintion)) { SpikesDefintion newSpikesDef = (SpikesDefintion)def; spikesDef.isRaised = newSpikesDef.isRaised; } Refresh(); }
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); }
public void CreateTOAtPos(System.Type typ, TileObjectDefintion toDef) { TileObject toInst = PrefabLibrary.I.GetTileObject(typ); InitTO(toInst, toDef); }
public virtual void Set(TileObjectDefintion def) { ToDef.pos = def.pos; ToDef.className = def.className; }