Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        // Locate UI and script components
        attackBar  = GameObject.Find("AttackBar").GetComponent <Slider>();
        defenseBar = GameObject.Find("DefenseBar").GetComponent <Slider>();
        speedBar   = GameObject.Find("SpeedBar").GetComponent <Slider>();

        attackText  = GameObject.Find("AttackText").GetComponent <Text>();
        defenseText = GameObject.Find("DefenseText").GetComponent <Text>();
        speedText   = GameObject.Find("SpeedText").GetComponent <Text>();

        crewManagement = boat.GetComponent <CrewManagement>();

        // Initialize UI bar min / max values
        attackBar.maxValue = maxStat;
        attackBar.minValue = minStat;

        defenseBar.maxValue = maxStat;
        defenseBar.minValue = minStat;

        speedBar.maxValue = maxStat;
        speedBar.minValue = minStat;

        DisplayUpdate();
    }
Ejemplo n.º 2
0
        // After player has created a crew, display all crew members
        public static void ShowCrewCreatedMsg(List <BaseCriminal> crew)
        {
            Console.Clear();
            Console.WriteLine(Heading.DisplayCrewCreated());
            List <BaseCriminal> sortedCrew = CrewManagement.SortCrew(crew);

            sortedCrew.ForEach(c =>
            {
                if (sortedCrew.Count() <= 3)
                {
                    Console.WriteLine($@"{c.Face}
                ");
                }
                if (c.IsPlayer == true)
                {
                    Console.WriteLine($@"You: {c.Name}");
                    Console.WriteLine($" base skill level: {c.BaseSkill}");
                }

                if (c.IsPlayer == false)
                {
                    Console.WriteLine($@"{c.Name}");
                    Console.WriteLine($@" {c.MoraleDescription}
 base skill level: {c.BaseSkill}");
                }
                Console.WriteLine("");
            });

            Console.Write("Press any key to begin planning heists ");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        public static void SplitCash(List <BaseCriminal> crew, List <BaseLocation> locations)
        {
            Color.SplitYellow();
            // get crew cash
            int totalCash = 0;

            crew.ForEach(c => totalCash = c.CrewTotalCash);
            BaseCriminal player = crew.Find(c => c.IsPlayer);

            if (totalCash > 0)
            {
                // If there is a crew, split cash. Else, end game
                if (crew.Count() > 1)
                {
                    Console.Clear();

                    // Display headings and crew info
                    Console.WriteLine(Heading.DisplayHeadingSplit());
                    Console.WriteLine(Heading.DisplaySubheadingSplit());
                    CrewManagement.DisplayCrewInfoShortened(crew);

                    // Money bag image
                    Console.WriteLine(Misc.DisplayMoneyBag());

                    // Display crews name and current morale status
                    Console.WriteLine("Crew");
                    Console.WriteLine("-----");
                    crew.ForEach(c =>
                    {
                        if (!c.IsPlayer)
                        {
                            Console.WriteLine($"{c.Name} - {c.MoraleDescription}");
                        }
                    });

                    Console.WriteLine("");
                    Console.WriteLine("The more money you take, the better off you'll be when you skip town.");
                    Console.WriteLine("");
                    Console.WriteLine("1) attempt to split cash evenly among crew members and part ways");
                    Console.WriteLine("2) ice a crew member");
                    if (player.HasPlayerEncouragedCrew == false)
                    {
                        Console.WriteLine("3) give congratulations speech");
                    }

                    int select = Menu.MenuInput(3);

                    switch (select)
                    {
                    case 1:
                        // Player gives up chance to shoot. Otherwise the player will always have the chance to ice the last person
                        Ice.WillCrewMemberShoot(crew, locations, true);
                        GameOver(crew, locations, true, player);
                        break;

                    case 2:
                        // Player ices an associate
                        List <BaseCriminal> smallerCrew = Ice.IceCrewMember(crew, locations, true);
                        if (player.PlayerFiredWeapon)
                        {
                            Ice.WillCrewMemberShoot(smallerCrew, locations, false);
                        }
                        smallerCrew.ForEach(c =>
                        {
                            if (c.IsPlayer)
                            {
                                c.PlayerFiredWeapon = false;
                            }
                        });
                        SplitCash(smallerCrew, locations);
                        break;

                    case 3:
                        SplitCash(CrewManagement.EncourageCrew(crew, true), locations);
                        break;
                    }
                    GameOver(crew, locations, true, player);
                }
                else
                {
                    GameOver(crew, locations, true, player);
                }
            }
            else
            {
                GameOver(crew, locations, true, player);
            }
        }
Ejemplo n.º 4
0
        public static List <BaseCriminal> CreateInitialCrew()
        {
            List <BaseCriminal> initialCrew = new List <BaseCriminal>();
            bool recruiting = true;
            int  playerContactsLeft;

            // Create the player
            initialCrew.Add(Intro.CreatePlayer(initialCrew));

            // Ask player if they want to add crew members or go solo
            string recruitMessage = "Go solo or recruit a crew of associates (you can recruit associates later)? [solo/crew]: ";

            Console.Write(recruitMessage);
            // Store their response
            string playerInput = Console.ReadLine().ToLower();

            while (playerInput != "solo" && playerInput != "crew")
            {
                Console.Write(recruitMessage);
                playerInput = Console.ReadLine().ToLower();
            }

            if (playerInput == "solo")
            {
                return(initialCrew);
            }

            else if (playerInput == "crew")
            {
                // Clear the player info from screen
                Console.Clear();

                Console.WriteLine(Heading.DisplayCrewHire());

                // While we are recruiting, prompt user to continue recruiting
                while (recruiting)
                {
                    Console.WriteLine("");
                    string recruitingMessage = "Continue recruiting? [y/n]: ";

                    // Loop through the initialCrew, checking how many
                    // Criminals the player has left to contact
                    List <BaseCriminal> modifiedCrew = new List <BaseCriminal>();

                    // Loop over the initial criminal list
                    initialCrew.ForEach(c =>
                    {
                        // If the player has contacts available, allow them to recruit criminals
                        playerContactsLeft = c.PlayerContactCount;
                        if (c.IsPlayer && playerContactsLeft > 0)
                        {
                            modifiedCrew.Add(c);
                            modifiedCrew.Add(CrewManagement.RecruitNewAssociate(initialCrew));

                            c.PlayerContactCount = --playerContactsLeft;
                            Console.WriteLine("");
                            if (playerContactsLeft > 0)
                            {
                                Console.WriteLine($"{playerContactsLeft} associates available to contact.");
                            }
                            if (playerContactsLeft == 0)
                            {
                                Console.WriteLine($"All associates contacted.");
                            }

                            // Check based on if the player wants to continue hiring
                            if (playerContactsLeft > 0)
                            {
                                if (modifiedCrew.Count() > 1)
                                {
                                    Console.WriteLine($"{initialCrew.Count() + 1} associates in crew.");
                                }
                                Console.WriteLine("");
                                Console.Write(recruitingMessage);
                                string response = Console.ReadLine().ToLower();

                                while (response != "y" && response != "n")
                                {
                                    Console.Write(recruitingMessage);
                                    response = Console.ReadLine().ToLower();
                                }

                                recruiting = response == "y" ? true : false;
                            }

                            if (playerContactsLeft == 0)
                            {
                                recruiting = false;
                            }

                            initialCrew = modifiedCrew;
                        }
                        // If the player is out of contacts, add the current crew member to the list
                        // then set the updated crew to the initial crew
                        else
                        {
                            modifiedCrew.Add(c);
                            initialCrew = modifiedCrew;
                        }
                    });
                }
                Console.WriteLine("");
                Console.Write("Press any key to review crew ");
                Console.ReadKey();
                return(initialCrew);
            }
            return(initialCrew);
        }