public void FinalizeRoadSegment(Vector2 dir, float len) { UpdateRoadSegment(dir, len); mCurrentNode.FinalizeVector(); mCurrentNode = new ShowVector(mCurrentNode.GetVectorEndPos(), dir, kRoadSize); mTheRoad.Add(mCurrentNode); }
protected override void InitializeWorld() { World.SetWorldCoordinate(new Vector2(-5f, -5f), (1.5f * kDistanceCovered + 5f)); DrawGrid(); mDir = new Vector2(1, 0); mCurrentPos = new Vector2(); mCurrentPos = kInitPosition; mCurrentVec = new ShowVector(kInitPosition, mDir, mVectorSize); }
protected override void UpdateWorld() { if (GamePad.ButtonBackClicked()) { Exit(); } #region add a new ViewVector if (GamePad.ButtonAClicked()) { if (null != mCurrentVec) { mCurrentVec.FinalizeVector(); mCurrentPos = mCurrentVec.EndPos(); } mCurrentVec = new ShowVector(mCurrentPos, mDir, mVectorSize); } #endregion #region Update vectorDir by right thumbStick mDir += GamePad.ThumbSticks.Right; mDir.Normalize(); #endregion #region Update vectorSize by left thumbStick y mVectorSize += GamePad.ThumbSticks.Left.Y; #endregion #region show another Vector addition if (null != mCurrentVec) { mCurrentVec.SetVectorDir(mDir); mCurrentVec.SetVectorSize(mVectorSize); } #endregion #region restart ... if (GamePad.ButtonBClicked()) { World.RemoveAllFromDrawSet(); mCurrentVec = null; mAlreadyShown = 0; mCurrentPos = kInitPosition; DrawGrid(); } #endregion EchoToTopStatus("Segments shown:" + mAlreadyShown + "CurrentPos=" + mCurrentPos); EchoToBottomStatus("Vector Direction" + mDir + " Size: " + mVectorSize); }
private void InitializeRoad() { mCurrentNode = new ShowVector(ClassExample.kInitPosition, new Vector2(1, 0), kRoadSize); mTheRoad.Add(mCurrentNode); }