Beispiel #1
0
        public static Tuple <int, float> GetFlightFacingDirectionAndPitchDirection(MyPlayer modPlayer)
        {
            int octantDirection = 0;
            int octantPitch     = 0;

            // since the player is mirrored, there's really only 3 ordinal positions we care about
            // up angle, no angle and down angle
            // we don't go straight up or down cos it looks weird as shit
            switch (modPlayer.mouseWorldOctant)
            {
            case -3:
            case -2:
            case -1:
                octantPitch = -1;
                break;

            case 0:
            case 4:
                octantPitch = 0;
                break;

            case 1:
            case 2:
            case 3:
                octantPitch = 1;
                break;
            }

            // for direction we have to do things a bit different.
            Vector2 mouseVector = modPlayer.GetMouseVectorOrDefault();

            if (mouseVector == Vector2.Zero)
            {
                // we're probably trying to run direction on a player who isn't ours, don't do this. They can control their own dir.
                octantDirection = 0;
            }
            else
            {
                octantDirection = mouseVector.X < 0 ? -1 : 1;
            }

            return(new Tuple <int, float>(octantDirection, octantPitch * 45f));
        }