public void UpdatePanelOnMouse() { Vector2 p = Camera.main.ScreenToWorldPoint(new Vector2(Input.mousePosition.x, Input.mousePosition.y)); NVector pos = new NVector((int)p.x, (int)p.y, GameMgmt.Get().newMap.view.ActiveLevel); Debug.Log($"Click on {pos}"); if (!pos.Valid()) { NAudio.PlayBuzzer(); return; } //active action? if (_action != null) { _action.Click(pos); } else { UpdatePanel(pos); } //center mouse? if (LSys.tem.options["centermouse"].Bool()) { S.CameraMove().MoveTo(pos); } }
private void ConnectGameObjs() { gameRound = ScriptableObject.CreateInstance <GameRoundMgmt>(); //unit = GameObject.Find("UnitMgmt").GetComponent<UnitMgmt>(); //building = GameObject.Find("BuildingMgmt").GetComponent<BuildingMgmt>(); //newMap = FindObjectOfType<GameMap>(); //cameraMove = FindObjectOfType<CameraMove>(); self = this; }
public static MapElementInfo MapElement(NVector pos) { if (GameMgmt.Get().unit.Free(pos)) { return(Building(pos)); } else { return(Unit(pos)); } }
public static InputAction InputAction() { return(GameMgmt.Get().inputAction); }
public static GameMap Map() { return(GameMgmt.Get().newMap); }
public static GameMgmt Game() { return(GameMgmt.Get()); }
public static UnitInfo Unit(NVector pos) { return(GameMgmt.Get().unit.At(pos)); }
public static UnitMgmt Unit() { return(GameMgmt.Get().unit); }
public static BuildingInfo Building(NVector pos) { return(GameMgmt.Get().building.At(pos)); }
public static BuildingMgmt Building() { return(GameMgmt.Get().building); }
public static GameRoundMgmt Round() { return(GameMgmt.Get().gameRound); }
public static Town Town(int tid) { return(GameMgmt.Get().data.towns.Get(tid)); }
public static TownMgmt Towns() { return(GameMgmt.Get().data.towns); }
public static PlayerMgmt Players() { return(GameMgmt.Get().data.players); }
public static bool Valid(int x, int y) { return(!(y < 0 || x < 0 || y >= GameMgmt.Get().data.map.height || x >= GameMgmt.Get().data.map.width)); }
public static CameraMove CameraMove() { return(GameMgmt.Get().cameraMove); }