Slime Temp and Bug fixes

>Fixed some bakes with the Hail
>Fixed the movement bugs with the king's movement
>Added the Slime in a semi-functional state
This commit is contained in:
Katherine
2022-02-10 15:54:16 -06:00
parent 3c1e36726a
commit 35c5c41f5a
7 changed files with 136 additions and 52 deletions

View File

@@ -16,6 +16,7 @@ public class HailArea : MonoBehaviour
int timer = 0;
RaycastHit hit;
[SerializeField] private LayerMask LayerMask;
float height = 0f;
// FixedUpdate is called once per .02 seconds (or 50 times a second)
void FixedUpdate()
@@ -29,8 +30,7 @@ public class HailArea : MonoBehaviour
//Random pos Z Zmax-radius -> Zmin+radius
Vector3 position = new Vector3(Random.Range(Xmin + radius, Xmax - radius), 100, Random.Range(Zmin + radius, Zmax - radius));//Finds where the hail will spawn in the air
if (Physics.Raycast(position, transform.TransformDirection(Vector3.down), out hit, float.MaxValue)) {//Raycasts to find where the ground is
Debug.DrawRay(position, transform.TransformDirection(Vector3.down) * 100, Color.yellow);
if (Physics.Raycast(position, transform.TransformDirection(Vector3.down), out hit, float.MaxValue, LayerMask)) {//Raycasts to find where the ground is
height = 100 - hit.distance;
}
position = new Vector3(position.x, 100+height, position.z); //find ground and set y occordingly