public bool PrefabIsDoor() { if (WallObject == null) { WallObject = GetComponentInterface <IWallObject>(); } return(WallObject != null && WallObject is DoorController); }
public void Reset() { _CurrentMode = Mode.None; _SelectedObject = null; if (OnReset != null) { OnReset(); } }
//public void ForeachWall(System.Action<WallPoint,WallController> action) //{ //} public WallController PrefabSetWall(Manager m, WallPoint point) { IWallObject wo = GetComponentInterface <IWallObject>(); WallController w = m.House.ReplaceWall(point, this); if (wo != null) { wo.PrefabPrepareWall(m, w); } return(w); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (_SelectedManager.CurrentMode == ObjectsManager.Mode.None || _SelectedManager.CurrentMode == ObjectsManager.Mode.Vert) { return; } var wallObj = _SelectedManager.SelectedObject as WallObject; if (wallObj != null) { _ChosenObject = (WallObject)EditorGUILayout.ObjectField(wallObj, typeof(WallObject), false); _SelectedManager.SelectObject(_ChosenObject); } }
public void SelectMode(Mode mode) { _CurrentMode = mode; switch (mode) { case Mode.Doors: _SelectedObject = ScriptableObjectUtils.CreateOrGet <Door>("default"); break; case Mode.Windows: _SelectedObject = ScriptableObjectUtils.CreateOrGet <Window>("default"); break; case Mode.Vert: _SelectedObject = new RoomVert(null, new Vector2()); break; } if (OnChangeMode != null) { OnChangeMode(); } }
// returns true if wall has to be destroyed public bool EditorUpdateWall() { if (houseController == null) { houseController = GetComponentInParent <HouseController>(); } CellController tr = houseController.GetCell(new MapPoint(position.X, position.Y)); CellController tl = houseController.GetCell(new MapPoint(position.X - 1, position.Y)); CellController br = houseController.GetCell(new MapPoint(position.X, position.Y - 1)); CellController bl = houseController.GetCell(new MapPoint(position.X - 1, position.Y - 1)); if (tr != null && tl != null && br != null && bl != null) { return(true); } if (tr == null && tl == null && br == null && bl == null) { return(true); } wallSprite.Top = (tr == null) ^ (tl == null); wallSprite.Bottom = (br == null) ^ (bl == null); wallSprite.Right = (tr == null) ^ (br == null); wallSprite.Left = (tl == null) ^ (bl == null); wallSprite.UpdateWall(); IWallObject wo = GetComponentInterface <IWallObject>(); if (wo != null && wo is WindowController) { (wo as WindowController).EditorUpdateWall(houseController); } return(false); }
public bool PrefabValidatePosition(Manager m, WallPoint point) { IWallObject wo = GetComponentInterface <IWallObject>(); if (wo != null && wo.PrefabValidatePosition(m, point) == false) { return(false); } if (!m.House.IsInsideBuilding(point)) { return(false); } WallController w = null; w = m.House.GetWall(new WallPoint(point.X - 1, point.Y)); if (w != null && w.WallObject != null) { return(false); } w = m.House.GetWall(new WallPoint(point.X + 1, point.Y)); if (w != null && w.WallObject != null) { return(false); } w = m.House.GetWall(new WallPoint(point.X, point.Y - 1)); if (w != null && w.WallObject != null) { return(false); } w = m.House.GetWall(new WallPoint(point.X, point.Y + 1)); if (w != null && w.WallObject != null) { return(false); } return(true); }
protected override void Awake() { base.Awake(); houseController = GetComponentInParent <HouseController>(); WallObject = GetComponentInterface <IWallObject>(); }
public void SelectObject(IWallObject wallObj) { _SelectedObject = wallObj; }
protected override void Awake () { base.Awake (); houseController = GetComponentInParent<HouseController>(); WallObject = GetComponentInterface<IWallObject>(); }
public bool PrefabIsDoor() { if(WallObject==null) WallObject = GetComponentInterface<IWallObject>(); return (WallObject!=null && WallObject is DoorController); }