예제 #1
0
 public bool PrefabIsDoor()
 {
     if (WallObject == null)
     {
         WallObject = GetComponentInterface <IWallObject>();
     }
     return(WallObject != null && WallObject is DoorController);
 }
예제 #2
0
 public void Reset()
 {
     _CurrentMode    = Mode.None;
     _SelectedObject = null;
     if (OnReset != null)
     {
         OnReset();
     }
 }
예제 #3
0
    //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);
    }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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();
            }
        }
예제 #6
0
    // 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);
    }
예제 #7
0
    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);
    }
예제 #8
0
 protected override void Awake()
 {
     base.Awake();
     houseController = GetComponentInParent <HouseController>();
     WallObject      = GetComponentInterface <IWallObject>();
 }
예제 #9
0
 public void SelectObject(IWallObject wallObj)
 {
     _SelectedObject = wallObj;
 }
예제 #10
0
	protected override void Awake ()
	{
		base.Awake ();
		houseController = GetComponentInParent<HouseController>();
		WallObject = GetComponentInterface<IWallObject>();
	}
예제 #11
0
	public bool PrefabIsDoor()
	{
		if(WallObject==null)
			WallObject = GetComponentInterface<IWallObject>();
		return (WallObject!=null && WallObject is DoorController);
	}