void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { toolRedirection = null; } if (Input.GetMouseButtonDown(0) && GetMoussePos() != Vector3.zero) { if (toolRedirection == null) { switch (curTool) { case Tools.none: MapManager.map.GetParcel(GetMoussePos().ToVec2Int()).Interact(); break; case Tools.road: StartCoroutine(MakeRoad()); break; case Tools.depot: MapManager.map.AddConstruction(GetMoussePos().ToVec2Int(), new Depot()); break; case Tools.loadingBay: MapManager.map.AddConstruction(GetMoussePos().ToVec2Int(), new LoadingBay()); break; case Tools.busStop: MapManager.map.AddConstruction(GetMoussePos().ToVec2Int(), new BusStop()); break; case Tools.destroy: MapManager.map.Destroy(GetMoussePos().ToVec2Int()); break; } } else { toolRedirection(GetMoussePos().ToVec2Int()); } } }
public void RedirectTool(MainToolRedir func) { toolRedirection = func; Debug.Log("Redirec Main Tool"); }
public void SetTool(int tool) { curTool = (Tools)tool; toolRedirection = null; }