Exemple #1
0
    // we need manager here because we call this method in prefab context
    public bool PrefabValidatePosition(Manager m, MapPoint point, CellRotation rotation)
    {
        manager = m;

        MapRect rect = GetCellIndexes(point, rotation);

        bool res = m.House.Phantom.PlacePhantom(point, rect);


        if (IsRectFree(rect, true) == false)
        {
            res = false;
        }


        return(res);
    }
Exemple #2
0
    public MapRect GetCellIndexes(MapPoint point, CellRotation rotation)
    {
        int minX = point.X;
        int minY = point.Y;
        int maxX = minX;
        int maxY = minY;


        switch (rotation)
        {
        case CellRotation.None:
            maxX += SizeX - 1;
            maxY += SizeY - 1;
            break;

        case CellRotation.C90:
            maxX += SizeY - 1;
            minY -= SizeX - 1;

            break;

        case CellRotation.C180:
            minX -= SizeX - 1;
            minY -= SizeY - 1;

            break;

        case CellRotation.C270:
            minX -= SizeY - 1;
            maxY += SizeX - 1;

            break;
        }

        return(new MapRect(minX, minY, maxX, maxY));
    }
Exemple #3
0
 public void SetRotation(CellRotation rotation)
 {
     transform.localRotation = Quaternion.Euler(0, 0, angles[rotation]);
     this.rotation           = rotation;
 }
	public void SetRotation(CellRotation rotation)
	{
		transform.localRotation = Quaternion.Euler(0,0,angles[rotation]);
		this.rotation = rotation;
	}
	public MapRect GetCellIndexes(MapPoint point, CellRotation rotation)
	{
		int minX = point.X;
		int minY = point.Y;
		int maxX = minX;
		int maxY = minY;

		
		switch(rotation)
		{
		case CellRotation.None:
			maxX += SizeX-1;
			maxY += SizeY-1;
			break;
		case CellRotation.C90:
			maxX += SizeY-1;
			minY -= SizeX-1;
			
			break;
		case CellRotation.C180:
			minX -= SizeX-1;
			minY -= SizeY-1;
			
			break;
		case CellRotation.C270:
			minX -= SizeY-1;
			maxY += SizeX-1;
			
			break;
		}

		return new MapRect(minX,minY,maxX,maxY);
	}
	// we need manager here because we call this method in prefab context
	public bool PrefabValidatePosition(Manager m, MapPoint point, CellRotation rotation)
	{
		manager = m;

		MapRect rect = GetCellIndexes(point,rotation);

		bool res = m.House.Phantom.PlacePhantom(point,rect);


		if(IsRectFree(rect,true)==false)
			res = false;


		return res;
	}