示例#1
0
        public static void Display(VillageTask task)
        {
            // Access player
            Player player = Program.Player;

            // Define menu title
            string menuTitle = $"Doing task: \"{task.Description}\"";

            // Calculate health reduction per tick
            float tickDamage = player.VillagesManager.GetTaskHealthRequirement(task) / task.DurationTicks;

            // Display progress
            ConstantProgress.Start(menuTitle, 200, task.DurationTicks, (isDone) =>
            {
                // Update player's health
                player.ApplyDamage(tickDamage);

                // Process last frame
                if (isDone)
                {
                    // Update player's reputation
                    player.VillagesManager.AddReputation(task.ReputationBonus);

                    // Remove task from the village
                    task.Village.Tasks.RemoveTask(task);
                }
            });
        }
示例#2
0
        public static void Display(Village targetVillage)
        {
            // Get player
            Player player = Program.Player;

            // Get number of ticks that are needed to move to the village
            // .GetDistanceToInTicks(targetVillage, player)
            int numberOfTicks = player.VillagesManager.GetDistanceToInTicks(targetVillage);

            // Get distance to the target village in km
            double distanceToVillage = player.VillagesManager.CurrentVillage.GetDistanceTo(targetVillage);

            // Define menu title
            string menuTitle = $"Traveling to \"{targetVillage.Name}\"";

            // Calculate health reduction per tick
            float damagePerTick = player.VillagesManager.GetTripHealthRequirement(targetVillage) / numberOfTicks;

            // Display progress
            ConstantProgress.Start(menuTitle, 200, numberOfTicks, (isDone) =>
            {
                // Apply trip damage to the player
                player.ApplyDamage(damagePerTick);

                if (isDone)
                {
                    // Move player to the target village
                    player.VillagesManager.Migrate(targetVillage);
                }
            }, (doneProcent) =>
            {
                return($"{(distanceToVillage - distanceToVillage * doneProcent) :0}km left");
            });
        }
示例#3
0
        public static void Display()
        {
            // Setting & Display the progress screen
            ConstantProgress.Start("Sleeping", 250, () =>
            {
                // Update player's stats
                Program.Player.GainSleep(1);
            });

            // Move to the main menu when the process were interrupted
            return;
        }