コード例 #1
0
ファイル: ClassExample.cs プロジェクト: MVoght87/CSS-385
        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);
        }
コード例 #2
0
ファイル: MyRoad.cs プロジェクト: MVoght87/CSS-385
 public void UpdateRoadSegment(Vector2 dir, float len)
 {
     mCurrentNode.SetVectorDir(dir);
     mCurrentNode.SetVectorSize(len);
 }