/// <summary> /// Teleports player to target /// </summary> /// <param name="sender">Source menu item</param> public static void Target(MenuItem sender) { TeleportTarget target = (sender.Data as TeleportTarget); Utils.TeleportWithoutGroundCheck(target.Coords); Utils.ShowNotification(GlobalConst.Message.TP_TARGET); }
public override void ExecuteAction(System.Action onFinish) { if (IsInsideHouse) { Vector3 playerPos = GameManager.Instance.Player.transform.position; Vector3 targetPos = GameManager.Instance.House.Entry.position; GameManager.Instance.Player.transform.position = new Vector3(targetPos.x, targetPos.y, playerPos.z); } else { MapChunk chunk = GameManager.Instance.MapInstances[ChunkCoord]; if (chunk == null) { Debug.Log("Chunk not found for " + ChunkCoord); return; } TeleportTarget target = chunk.TeleportTargets.Find(x => x.Name.Equals(TargetName)); if (target == null) { Debug.Log("Teleport target " + TargetName + " does not exist"); return; } Vector3 playerPos = GameManager.Instance.Player.transform.position; Vector3 targetPos = target.Target.transform.position; GameManager.Instance.Player.transform.position = new Vector3(targetPos.x, targetPos.y, playerPos.z); } }
public TeleportTarget GetCopy() { TeleportTarget tt = new TeleportTarget(); tt.SetData(this.GetData(new Hashtable())); return tt; }
public static TeleportTarget[] Add(TeleportTarget n, TeleportTarget[] list) { ArrayList tmp = new ArrayList(); foreach(TeleportTarget str in list) tmp.Add(str); tmp.Add(n); return tmp.ToArray(typeof(TeleportTarget)) as TeleportTarget[]; }
public static TeleportTarget[] Remove(int index, TeleportTarget[] list) { ArrayList tmp = new ArrayList(); foreach(TeleportTarget str in list) tmp.Add(str); tmp.RemoveAt(index); return tmp.ToArray(typeof(TeleportTarget)) as TeleportTarget[]; }
/// <summary> /// Convert real game data to a string line , Info: TeleportTarget /// </summary> public override void Record(object info) { teleportTarget = (TeleportTarget)info; }