public void UpdateWalk(AthleteInformation information, Vector2 input) { Vector3 rightwardMovement = input.x * Vector3.right; Vector3 forwardMovement = input.y * Vector3.forward; Vector3 movementPerFrame = (rightwardMovement + forwardMovement) * walkSpeed; MovementPerFrame = movementPerFrame; }
public void UpdateDetection(AthleteInformation information) { HitInfo = Cast(information.AthleteObject.transform); IsGrounding = (HitInfo.collider != null); DetectedGround = IsGrounding ? HitInfo.collider.gameObject : null; //LogView.Log("Grounding: " + IsGrounding + " on " + DetectedGround); }
public void UpdateFriction(AthleteInformation information, GroundingDetector detector) { // parent = DetectedGround.transform の1行で済みそうなものだが、null.transform になった時にまずい。 if (detector.IsGrounding == false) { information.AthleteObject.transform.parent = defaultParent; return; } information.AthleteObject.transform.parent = detector.DetectedGround.transform; }
public void UpdateDirection(AthleteInformation information, Vector2 input) { float currentAngle = information.FaceObject.transform.eulerAngles.x; float verticalRotation = input.y * Sensitivity.y * -1; float horizontalRotation = input.x * Sensitivity.x; // 現在の可動範囲 = 限界値 - 現在の角度 // min(入力値, 現在の可動範囲) // 入力値が限界値までの残りの角度を超えると、残りの角度ぶんだけ回転する。 verticalRotation = CompressUpwardRotation(verticalRotation, currentAngle); verticalRotation = CompressDownwardRotation(verticalRotation, currentAngle); AntiTiltRotate(information.AthleteObject, horizontalRotation, 0); AntiTiltRotate(information.FaceObject, 0, verticalRotation); }
public GroundingDetector(AthleteInformation info) { layermask = LayerMaskGenerator.Generate(IgnoreLayer.Specified, info.AthleteObject.layer); // Debug.Log("Detector will ignore: [" + LayerMask.LayerToName(info.AthleteObject.layer) + "] layer."); }