12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class GroundHeightStep : AbstractSafetyAreaStep
- {
- private float planeHeight;
- public GroundHeightStep()
- {
- ResetPlaneHeight();
- }
- public void SetHeadPosition(Vector3 headPosition)
- {
- float largestHeight = headPosition.y - PlayAreaConstant.DEFAULT_HEIGHT_FROM_HEAD;
- if (largestHeight < planeHeight)
- {
- planeHeight = largestHeight;
- }
- }
- public void SetPlaneHeight(float interactionObjectHeight)
- {
- if (interactionObjectHeight < planeHeight)
- {
- planeHeight = interactionObjectHeight;
- }
- }
- public float GetPlaneHeight()
- {
- return planeHeight;
- }
- public void ResetPlaneHeight()
- {
- planeHeight = float.MaxValue;
- }
- }
|