Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- /*
- * This is the base block class! This class is extended by other blocks.
- */
- public static class Utilities
- {
- public static Vector2[] returnUVs(Vector2 center, float tilesize)
- {
- Vector2[] UVs = new Vector2[4];
- UVs[0] = new Vector2(tilesize * center.x + tilesize, tilesize * center.y);
- UVs[1] = new Vector2(tilesize * center.x + tilesize, tilesize * center.y + tilesize);
- UVs[2] = new Vector2(tilesize * center.x, tilesize * center.y + tilesize);
- UVs[3] = new Vector2(tilesize * center.x, tilesize * center.y);
- return UVs;
- }
- }
- public class Block {
- private const float tilesize = 0.25f;
- private Vector2 uvTop { get; set; }
- private Vector2 uvBottom { get; set; }
- private Vector2 uvNorth { get; set; }
- private Vector2 uvSouth { get; set; }
- private Vector2 uvEast { get; set; }
- private Vector2 uvWest { get; set; }
- private BlockDirection blockDirection { get; set; }
- private Gravity gravity = Gravity.None;
- private BlockType blockType = BlockType.NA;
- public virtual SideType returnIfSolid(Side side)
- {
- return SideType.Solid; //all four sides are solid of default block.
- }
- }
- public enum BlockType
- {
- NA,
- Grass,
- Dirt,
- Rock,
- Gravel,
- Sand,
- Bedrock,
- Air,
- WaterSpring,
- WaterFlow5,
- WaterFlow4,
- WaterFlow3,
- WaterFlow2,
- WaterFlow1
- }
- public enum Side
- {
- Top,
- Bottom,
- North,
- South,
- East,
- West
- }
- public enum SideType
- {
- Open,
- Solid,
- SlabTop,
- SlabSideBottom,
- SlabSideTop,
- Watera
- }
- public enum Gravity
- {
- None,
- Yes
- }
- public enum BlockDirection
- {
- Up,
- Down,
- North,
- South,
- East,
- West
- }
Advertisement
Add Comment
Please, Sign In to add comment