private void UpdateRightHand() { if (targetRightHand == LimbState.Up) { currentRightHand += Time.deltaTime * speed; if (currentRightHand > lastRightHand + rungDistance) { currentRightHand = lastRightHand + rungDistance; lastRightHand = currentRightHand; targetRightHand = LimbState.Stationary; } } else if (targetRightHand == LimbState.Down) { currentRightHand -= Time.deltaTime * speed; if (currentRightHand < lastRightHand - rungDistance) { currentRightHand = lastRightHand - rungDistance; lastRightHand = currentRightHand; targetRightHand = LimbState.Stationary; } } Vector3 rightHandPosition = RightHand.transform.position; rightHandPosition.y = currentRightHand; RightHand.transform.position = rightHandPosition; }
// Use this for initialization void Start() { LeftFoot = GameObject.Find("Left Foot Logic"); LeftHand = GameObject.Find("Left Hand Logic"); RightFoot = GameObject.Find("Right Foot Logic"); RightHand = GameObject.Find("Right Hand Logic"); rungDistance = 0.3f; speed = 0.5f; lastLeftFoot = currentLeftFoot = 0.0f * rungDistance; lastLeftHand = currentLeftHand = 4.0f * rungDistance; lastRightFoot = currentRightFoot = 0.0f * rungDistance; lastRightHand = currentRightHand = 4.0f * rungDistance; targetLeftFoot = LimbState.Stationary; targetLeftHand = LimbState.Stationary; targetRightFoot = LimbState.Stationary; targetRightHand = LimbState.Stationary; falling = false; fallVelocity = 0.0f; taskCompleted = false; }
private void UpdateRightFoot() { if (targetRightFoot == LimbState.Up) { currentRightFoot += Time.deltaTime * speed; if (currentRightFoot > lastRightFoot + rungDistance) { currentRightFoot = lastRightFoot + rungDistance; lastRightFoot = currentRightFoot; targetRightFoot = LimbState.Stationary; } } else if (targetRightFoot == LimbState.Down) { currentRightFoot -= Time.deltaTime * speed; if (currentRightFoot < lastRightFoot - rungDistance) { currentRightFoot = lastRightFoot - rungDistance; lastRightFoot = currentRightFoot; targetRightFoot = LimbState.Stationary; } } Vector3 rightFootPosition = RightFoot.transform.position; rightFootPosition.y = currentRightFoot; RightFoot.transform.position = rightFootPosition; }
private void UpdateLeftFoot() { if (!falling) { if (targetLeftFoot == LimbState.Up) { currentLeftFoot += Time.deltaTime * speed; if (currentLeftFoot > lastLeftFoot + rungDistance) { currentLeftFoot = lastLeftFoot + rungDistance; lastLeftFoot = currentLeftFoot; targetLeftFoot = LimbState.Stationary; } } else if (targetLeftFoot == LimbState.Down) { currentLeftFoot -= Time.deltaTime * speed; if (currentLeftFoot < lastLeftFoot - rungDistance) { currentLeftFoot = lastLeftFoot - rungDistance; lastLeftFoot = currentLeftFoot; targetLeftFoot = LimbState.Stationary; } } Vector3 leftFootPosition = LeftFoot.transform.position; leftFootPosition.y = currentLeftFoot; LeftFoot.transform.position = leftFootPosition; } }
public void RightHandDown() { targetRightHand = LimbState.Down; }
public void RightHandUp() { targetRightHand = LimbState.Up; }
public void RightFootDown() { targetRightFoot = LimbState.Down; }
public void RightFootUp() { targetRightFoot = LimbState.Up; }
public void LeftHandDown() { targetLeftHand = LimbState.Down; }
public void LeftHandUp() { targetLeftHand = LimbState.Up; }
public void LeftFootDown() { targetLeftFoot = LimbState.Down; }
public void LeftFootUp() { targetLeftFoot = LimbState.Up; }
///<exclude/> public bool Equals(LimbState other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return other._Tm.Equals(_Tm) && other._OapMatrix.Equals(_OapMatrix) && other._Status.Equals(_Status); }