Exemplo n.º 1
0
        private async void OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            var laps = Convert.ToInt32(ety_laps.Text);

            if (laps < 1)
            {
                await DisplayAlert("Eingabefehler", "Bitte überprüfen Sie die Anzahl der Runden!", "OK");

                return;
            }

            var technique = (Swimming.Techniques)Enum.Parse(typeof(Swimming.Techniques), pkr_swimmingTechniques.SelectedIndex.ToString());

            if (pkr_swimmingTechniques.SelectedIndex == -1)
            {
                await DisplayAlert("Eingabefehler", "Bitte wählen Sie eine Technik aus!", "OK");

                return;
            }

            var time = (TimeSpan)e.Item;

            var swimming = new Swimming()
            {
                Laps        = laps,
                Technique   = technique,
                Time        = time,
                RecordTaken = DateTime.Now
            };

            await RegisterExercise(swimming);
        }
Exemplo n.º 2
0
    public void OnTrigger(Swimming Swi, ShipBallaster Bal)
    {
        foreach (ChainShoot c in HookManager.Instance.chains)
        {
            if (c.bPicked)
            {
                Points   += PointsPerTreasure;
                c.bPicked = false;
                c.DestroyChain();
                HookManager.Instance.readiness[HookManager.Instance.chains.IndexOf(c)] = false;
            }
        }

        Points = Bal.Repair(Points / PointsPerHp) * PointsPerHp;
        if (Points < (Swi.maxPetrol - Swi.CurrentPetrol) * PointsPerFuel)
        {
            Swi.CurrentPetrol += Points / PointsPerFuel;
            Points             = 0.0f;
        }
        else
        {
            Points           -= (Swi.maxPetrol - Swi.CurrentPetrol) * PointsPerFuel;
            Swi.CurrentPetrol = Swi.maxPetrol;
        }
    }
Exemplo n.º 3
0
    //Enter Water
    void OnTriggerEnter(Collider collision)
    {
        if (collision.GetComponent <DamageArea>())//When the Character's Damage Area Trigger Touches the Water Swim Trigger
        {
            if (collision.GetComponentInParent <AntAI>())
            {
                AntScript         = collision.GetComponentInParent <AntAI>();
                AntScript.inWater = true;
                whichScript       = 1;
            }
            else if (collision.GetComponentInParent <DemigodAI>())
            {
                DemigodScript         = collision.GetComponentInParent <DemigodAI>();
                DemigodScript.inWater = true;
                whichScript           = 2;
            }
            else if (collision.GetComponentInParent <MinotaurAI>())
            {
                MinotaurScript         = collision.GetComponentInParent <MinotaurAI>();
                MinotaurScript.inWater = true;
                whichScript            = 3;
            }
            else if (collision.GetComponentInParent <MedusaAI>())
            {
                MedusaScript         = collision.GetComponentInParent <MedusaAI>();
                MedusaScript.inWater = true;
                whichScript          = 4;
            }
            else if (collision.GetComponentInParent <PlayerHealth>())//1
            {
                PlayerScript         = collision.GetComponentInParent <PlayerHealth>();
                PlayerSwim           = collision.GetComponentInParent <Swimming>();
                PlayerScript.inWater = true;
                PlayerSwim.inWater   = true;
                whichScript          = 5;
            }
            else if (collision.GetComponentInParent <ChimeraAI>())
            {
                ChimeraScript         = collision.GetComponentInParent <ChimeraAI>();
                ChimeraScript.inWater = true;
                whichScript           = 6;
            }

            if (whichScript == 5)//Why is this here??????????????????????? Why not just put these statements in the *1 above? Same below in Trigger Exit
            {
                PlayerSwim.whatToDo(true);
                underwaterAudio.Play();
            }
        }
    }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Flight         flight   = new Flight();
            Run            run      = new Run();
            Swimming       swimming = new Swimming();
            Meow           meow     = new Meow();
            Сrack          crack    = new Сrack();
            Twitter        twitter  = new Twitter();
            List <IAnimal> list     = new List <IAnimal>();

            list.Add(new Cat <Run, Twitter>());
            list.Add(new Herring <Swimming, Swimming>());
            list.Add(new Sparrow <Run, Twitter>());
            foreach (IAnimal rec in list)
            {
                try
                {
                    rec.Motion();
                }
                catch (BeingNotProperty ex)
                {
                    log = LogManager.GetCurrentClassLogger();
                    log.Error("У данного существа нет такого свойства!" + rec.GetType().ToString(), ex);
                }

                try
                {
                    rec.Vocalize();
                }
                catch (BeingNotProperty ex)
                {
                    log = LogManager.GetCurrentClassLogger();
                    log.Error("у данного существа нет такого свойства!" + rec.GetType().ToString(), ex);
                }
            }

            Console.ReadKey();
        }
Exemplo n.º 5
0
        //protected NoSwimming noSwimming;

        public BaseTank()
        {
            swimming = Swim;
            draw     = DrawTank;
        }
Exemplo n.º 6
0
        void AddWorkoutInputMenu(User user)
        {
            DateTime      whenWorkedOut;
            double        distance = 0;
            int           minutesWorkedOut;
            bool          happyWithChoice;
            double        points = 0;
            TypeOfWorkout workoutChoice;

            Console.Clear();//RENSAR FÖREGÅENDE MENY FÖR LÄTTARE LÄSNING.

            Console.WriteLine("När tränade du? (åååå-mm-dd)");
            Console.Write("Datum: ");
            whenWorkedOut = error.TryTime();

            Console.Clear();
            while (true)
            {
                Console.WriteLine("Vilken typ av träning önskar du registrera?");
                Console.WriteLine($"{Convert.ToInt32(TypeOfWorkout.Walking)}. Gång");
                Console.WriteLine($"{Convert.ToInt32(TypeOfWorkout.Running)}. Löpning");
                Console.WriteLine($"{Convert.ToInt32(TypeOfWorkout.Swimming)}. Simning");
                Console.WriteLine($"{Convert.ToInt32(TypeOfWorkout.Strength)}. Styrketräning");
                workoutChoice = GetChoiceFromUser();
                Console.Clear();

                if (workoutChoice == TypeOfWorkout.Walking ||
                    workoutChoice == TypeOfWorkout.Running ||
                    workoutChoice == TypeOfWorkout.Swimming)
                {
                    Console.Write("Distans i KM: ");
                    distance = error.TryDouble();
                    Console.Clear();
                    break;
                }
                else if (workoutChoice == TypeOfWorkout.Strength)
                {
                    break;
                }

                Console.Clear();
                error.ErrorMessage();
                Console.Write("\nTryck valfri tangent för att fortsätta.");
                Console.ReadKey();
            }
            Console.Write("Träningstid i minuter: ");
            minutesWorkedOut = error.TryInt();
            Console.Clear();

            Console.Write("Är du nöjd med träningen (J/N)?");
            happyWithChoice = error.TryYesOrNo();
            Console.Clear();

            if (happyWithChoice == true)
            {
                var db = new Database("Server=40.85.84.155;Database=Student5;User=Student5;Password=YH-student@2019;");
                if (workoutChoice == TypeOfWorkout.Walking)
                {
                    points = pointsCalculator.PointsForWalking(minutesWorkedOut, distance);
                    var workout = new Walking(TypeOfWorkout.Walking, whenWorkedOut,
                                              minutesWorkedOut, points, distance);
                    db.AddWorkouts(workout, user);
                }
                else if (workoutChoice == TypeOfWorkout.Running)
                {
                    points = pointsCalculator.PointsForRunning(minutesWorkedOut, distance);
                    var workout = new Running(TypeOfWorkout.Running, whenWorkedOut,
                                              minutesWorkedOut, points, distance);
                    db.AddWorkouts(workout, user);
                }
                else if (workoutChoice == TypeOfWorkout.Swimming)
                {
                    points = pointsCalculator.PointsForSwimming(minutesWorkedOut, distance);
                    var workout = new Swimming(TypeOfWorkout.Swimming, whenWorkedOut,
                                               minutesWorkedOut, points, distance);
                    db.AddWorkouts(workout, user);
                }
                else if (workoutChoice == TypeOfWorkout.Strength)
                {
                    points = pointsCalculator.PointsForStength(minutesWorkedOut);
                    var workout = new Strength(TypeOfWorkout.Strength, whenWorkedOut,
                                               minutesWorkedOut, points);
                    db.AddWorkouts(workout, user);
                }
            }
            else
            {
                Console.WriteLine("Du kommer nu att returneras till huvudmenyn.");
            }
            if (happyWithChoice == true)
            {
                Comments comment = new Comments();
                Console.WriteLine($"Ditt träningspass har nu registrerats. Du fick {points} poäng!");
                if (points >= 80)
                {
                    Console.WriteLine(comment.PositiveComment());
                }
                else
                {
                    Console.Write(comment.NegativeComment());
                }
            }
            Console.Write("\nKlicka på valfri tangent för att fortsätta.");
            Console.ReadKey();
        }