public void Update() { if (BlockCollider.IsEnable() == false) { Destroy(); } }
public void SetCollision(BlockCollider collider, float x, float y, float z) { switch (ID) { case BlockID.Ladder: switch (BlockDirection) { case Direction.Left: collider.EnableBox(x + 0.45f, y, z, 0.1f, 1.0f, 1.0f); break; case Direction.Right: collider.EnableBox(x - 0.45f, y, z, 0.1f, 1.0f, 1.0f); break; case Direction.Front: collider.EnableBox(x, y, z - 0.45f, 1.0f, 1.0f, 0.1f); break; case Direction.Back: collider.EnableBox(x, y, z + 0.45f, 1.0f, 1.0f, 0.1f); break; } break; case BlockID.StoneSlope: case BlockID.GrassSlope: CollisionType colType = GetCollisionType(); if (collider.Type != colType) { collider.SetMesh(BuildCollider(new CollisionMeshData()), colType, x, y, z); } else { collider.EnableMesh(x, y, z); } break; default: if (IsSolid()) { collider.EnableBox(x, y, z, 1.0f, 1.0f, 1.0f); } else { collider.Disable(); } break; } }
public void ReturnCollider(BlockCollider col) { col.Disable(); colliders.Enqueue(col); }