Esempio n. 1
0
        protected override void SpecificUpdate()
        {
            Vector2 offsetPosition = entity.position - lastPosition;

            // Heading North
            if (offsetPosition.Y < -1)
            {
                helmet.SetToNorth();
            }

            // Heading South
            else if (offsetPosition.Y > 1)
            {
                helmet.SetToSouth();
            }

            // Heading West
            else if (offsetPosition.X < -1)
            {
                helmet.SetToWest();
            }

            // Heading East
            else if (offsetPosition.X > 1)
            {
                helmet.SetToEast();
            }
        }
        public void update()
        {
            if (entity == null)
            {
                return;
            }

            Vector2 offsetPosition = entity.position - lastPosition;

            // Heading North
            if (offsetPosition.Y < -1)
            {
                body.SetToNorth();
                head.SetToNorth();
            }

            // Heading South
            else if (offsetPosition.Y > 1)
            {
                body.SetToSouth();
                head.SetToSouth();
            }

            // Heading West
            else if (offsetPosition.X < -1)
            {
                body.SetToWest();
                head.SetToWest();
            }

            // Heading East
            else if (offsetPosition.X > 1)
            {
                body.SetToEast();
                head.SetToEast();
            }

            SpecificUpdate();
            lastPosition = entity.position;
        }