예제 #1
0
        /// <summary>
        /// Not pretty.
        /// Not correct.
        /// Not important.
        /// </summary>
        private async static Task updateSpearLocation()
        {
            double a = MathCalculation.Delta(SatanController.CurrentPlayer.Location.Longitude, SatanController.DirectionLocation.Longitude) /
                       MathCalculation.Delta(SatanController.CurrentPlayer.Location.Latitude, SatanController.DirectionLocation.Latitude);
            double b = SatanController.CurrentPlayer.Location.Longitude - (a * SatanController.CurrentPlayer.Location.Latitude);

            if (SatanController.CurrentPlayer.Location.Latitude < SatanController.DirectionLocation.Latitude)
            {
                for (double x = 0; x < (0.1 / throwPower); x += 0.0001)
                {
                    Gungnir.Location = new Location(
                        SatanController.CurrentPlayer.Location.Latitude + x,
                        (a * (SatanController.CurrentPlayer.Location.Latitude + x)) + b
                        );
                    await Task.Delay(200);

                    PropertieUpdateEvent();
                }
            }
            else
            {
                for (double x = 0; x > (-0.1 / throwPower); x -= 0.0001)
                {
                    Gungnir.Location = new Location(
                        SatanController.CurrentPlayer.Location.Latitude + x,
                        (a * (SatanController.CurrentPlayer.Location.Latitude + x)) + b
                        );
                    await Task.Delay(200);

                    PropertieUpdateEvent();
                }
            }
            return;
        }
예제 #2
0
        private static async void ThrowSpear(int power)
        {
            int Pow = MathCalculation.CalculateDistance(power);

            if (SatanController.DirectionLocation == null || Gungnir == null)
            {
                return;
            }
            Gungnir.Location = SatanController.CurrentPlayer.Location;
            await updateSpearLocation();

            UpdateGameStateEvent();
        }