public Vec2i GetTeleportPosition() { Vec2i pos = new Vec2i(position); foreach (Trigger t in owner.triggerList) { TeleportExitZone tel = t as TeleportExitZone; if (tel != null && tel.GetTeleportID() == id) { pos.X = Math.Min(pos.X, tel.position.X); pos.Y = Math.Min(pos.Y, tel.position.Y); } } return(pos); }
public override void OnAfterMapGen() { Vec2i mypos = GetTeleportPosition(); foreach (Trigger t in owner.triggerList) { TeleportExitZone tel = t as TeleportExitZone; if (tel != null && tel.GetTeleportID() == id) { Vec2i exitpos = tel.GetTeleportPosition(); Vec2i delta = exitpos - mypos; deltaTeleportation = delta * Block.BLOCK_SIZE; return; } } }