예제 #1
0
        public override void MoveSnake(object source, ElapsedEventArgs e)
        {
            RotateBy(Rotation);
            DirectionVector.Normalize();
            CurrentPosition += DirectionVector;

            Console.WriteLine("X: " + CurrentPosition.X + " Y: " + CurrentPosition.Y + " R: " + Rotation);
        }
예제 #2
0
파일: EdgeShape.cs 프로젝트: pabllopf/Alis
        /// <summary>
        ///     Sets the v 1
        /// </summary>
        /// <param name="v1">The </param>
        /// <param name="v2">The </param>
        public void Set(Vec2 v1, Vec2 v2)
        {
            Vertex1 = v1;
            Vertex2 = v2;

            DirectionVector = Vertex2 - Vertex1;
            Length          = DirectionVector.Normalize();
            NormalVector    = Vec2.Cross(DirectionVector, 1.0f);

            Corner1Vector = NormalVector;
            Corner2Vector = -1.0f * NormalVector;
        }