Exemplo n.º 1
0
    public void Set_Sail()
    {
        Ship_Movement shipscript = ship.GetComponent <Ship_Movement>();

        if (b_agent.hasPath && shipscript.get_crew_count() >= required_crew_count)
        {
            CameraScript camscript = cam.GetComponent <CameraScript>();
            Camera_Orbit camorbit  = cam.GetComponent <Camera_Orbit>();
            camscript.enabled = false;
            camorbit.enabled  = true;

            shipscript.inport = false;
            //set_sail_button.SetActive(false);
            //enter_market_button.SetActive(false);
            //enter_tavern_button.SetActive(false);
            uiScript.TownUI(false);
            uiScript.DestroyCrewTav();
            audioScript.oceanSound(true);
        }
        else
        {
            uiScript.ErrorDisp("you must choose a destination before setting sail and have the required number of crew for your ship size");
        }
        if (med_cargo_count + timber_cargo_count + spice_cargo_count + rum_cargo_count == 0 && gold <= 0)
        {
            uiScript.loseDisp("You have gone bankrupt and have no way to make money, off to prison for your debts");
        }
    }
Exemplo n.º 2
0
    public void Confirm_course_Report()
    {
        Ship_Movement shipscript = ship.GetComponent <Ship_Movement>();

        if (shipscript.get_target_port() != current_location)
        {
            CameraScript camscript = cam.GetComponent <CameraScript>();
            Camera_Orbit camorbit  = cam.GetComponent <Camera_Orbit>();
            camscript.enabled = false;
            camorbit.enabled  = true;
            //chart_course_button.SetActive(true);
            //set_sail_button.SetActive(true);
            //enter_market_button.SetActive(true);
            //enter_tavern_button.SetActive(true);
            //confirm_course_button.SetActive(false);
            //reset_course_button.SetActive(false);
            uiScript.ChartReportUI(false);
            uiScript.WeekInfoUI(true);
            courseCharter.GetComponent <Charting_a_Course>().enabled = false;
        }
        else
        {
            uiScript.ErrorDisp("You're either in town already, or need to let stocks replenish");
        }
    }
Exemplo n.º 3
0
    public void continueJourney()
    {
        ManagerScript manage = manager.GetComponent <ManagerScript>();

        manage.in_week_report = false;
        Camera_Orbit camorbit = cam.GetComponent <Camera_Orbit>();

        camorbit.enabled = true;
        agent.isStopped  = false;
    }
Exemplo n.º 4
0
    public void In_To_Port(GameObject location)
    {
        Ship_Movement shipscript = ship.GetComponent <Ship_Movement>();

        shipscript.inport = true;
        current_location  = location;
        if (location.tag == "town")
        {
            SetUpTown(location);
        }
        CameraScript camscript = cam.GetComponent <CameraScript>();
        Camera_Orbit camorbit  = cam.GetComponent <Camera_Orbit>();

        camscript.enabled = true;
        camorbit.enabled  = false;
    }
Exemplo n.º 5
0
    public void Chart_a_Course_Report()
    {
        CameraScript camscript = cam.GetComponent <CameraScript>();
        Camera_Orbit camorbit  = cam.GetComponent <Camera_Orbit>();

        camscript.enabled = true;
        camorbit.enabled  = false;
        camscript.Look_at_Location(map);
        //chart_course_button.SetActive(false);
        //set_sail_button.SetActive(false);
        //enter_market_button.SetActive(false);
        //enter_tavern_button.SetActive(false);
        //confirm_course_button.SetActive(true);
        //reset_course_button.SetActive(true);
        //uiScript.TownUI(false);
        uiScript.ChartReportUI(true);
        courseCharter.GetComponent <Charting_a_Course>().enabled = true;
    }
Exemplo n.º 6
0
    //code for the stuff that comes after events
    public void weekReport()
    {
        int rations_used = 0;

        in_week_report = true;
        Camera_Orbit camorbit = cam.GetComponent <Camera_Orbit>();

        camorbit.enabled = false;
        Ship_Movement ship_script = ship.GetComponent <Ship_Movement>();
        int           spread      = ship_script.handle_mutiny_spread();

        if (spread > 0)
        {
            event_outcome += "\n" + spread + " crew members have lowered the loyalty of others in order to try and mutiny";
        }
        int gold_change = ship_script.get_wages();

        change_gold(-gold_change);
        //print(event_outcome);
        if (current_ration_state > (rations_cargo_count / 3))
        {
            current_ration_state--;
            uiScript.ErrorDisp("ration plan has been lowered for the future due to lack of food");
        }
        if (current_ration_state > (rations_cargo_count / 3))
        {
            current_ration_state--;
            uiScript.ErrorDisp("ration plan has been lowered for the future due to lack of food");
        }
        bool tempspice = using_spice;

        if (using_spice)
        {
            if (current_ration_state == 0)
            {
                tempspice      = false;
                event_outcome += "\nAttempted to give your crew spice but you had no food to pair it with";
            }
            else if (spice_cargo_count > 0)
            {
                spice_cargo_count--;
                event_outcome += "\nSpice was used and the loyalty of every crewmate was increased by 3";
            }
            else
            {
                tempspice      = false;
                event_outcome += "\nAttempted to give your crew spice when you had none";
            }
        }
        if (current_ration_state == 2)
        {
            event_outcome       += ship_script.extra_rations(tempspice);
            rations_cargo_count -= (ship_script.get_crew_count() * 2);
            rations_used         = (ship_script.get_crew_count() * 2);
        }
        if (current_ration_state == 1)
        {
            event_outcome       += ship_script.normal_rations(tempspice);
            rations_cargo_count -= ship_script.get_crew_count();
            rations_used         = ship_script.get_crew_count();
        }
        if (current_ration_state == 0)
        {
            event_outcome += ship_script.no_rations(tempspice);
            rations_used   = 0;
        }
        if (rations_cargo_count < 0)
        {
            rations_cargo_count = 0;
        }
        string report = gold_change + " gold was spent to pay your crew\n" + rations_used + " rations were used to fed your crew\n" + event_outcome;

        uiScript.weekInfoDisp(report);
        uiScript.EventResultUI(false);
        uiScript.WeekInfoUI(true);
        uiScript.updateCargoCount(((rations_cargo_count / 3) + med_cargo_count + timber_cargo_count + spice_cargo_count + rum_cargo_count), max_cargo);
        uiScript.cargoUpdate();
    }
Exemplo n.º 7
0
    public void handle_event(Event e, int result)
    {
        Camera_Orbit camorbit = cam.GetComponent <Camera_Orbit>();

        camorbit.enabled = false;
        if (e.get_id() == 0)
        {
            if (result == 1)
            {
                int stolen_good = Random.Range(0, 5);
                if (stolen_good == 0)
                {
                    rum_cargo_count -= 3;
                    event_outcome    = "three cases of rum were stolen";
                }
                if (stolen_good == 1)
                {
                    spice_cargo_count -= 3;
                    event_outcome      = "three cases of spice were stolen";
                }
                if (stolen_good == 2)
                {
                    timber_cargo_count -= 3;
                    event_outcome       = "three crates of timber were stolen";
                }
                if (stolen_good == 2)
                {
                    med_cargo_count -= 3;
                    event_outcome    = "three crates of medicine were stolen";
                }
            }
            if (result == 2)
            {
                int stolen_good = Random.Range(0, 5);
                if (stolen_good == 0)
                {
                    rum_cargo_count -= 1;
                    event_outcome    = "three cases of rum were stolen";
                }
                if (stolen_good == 1)
                {
                    spice_cargo_count -= 1;
                    event_outcome      = "three cases of spice were stolen";
                }
                if (stolen_good == 2)
                {
                    timber_cargo_count -= 1;
                    event_outcome       = "three crates of timber were stolen";
                }
                if (stolen_good == 2)
                {
                    med_cargo_count -= 1;
                    event_outcome    = "three crates of rum were stolen";
                }
            }
            if (med_cargo_count < 0)
            {
                med_cargo_count = 0;
            }
            if (timber_cargo_count < 0)
            {
                timber_cargo_count = 0;
            }
            if (spice_cargo_count < 0)
            {
                spice_cargo_count = 0;
            }
            if (rum_cargo_count < 0)
            {
                rum_cargo_count = 0;
            }
        }
        if (e.get_id() == 1)
        {
            if (result == 1)
            {
                timber_cargo_count  -= 3;
                rations_cargo_count -= 3;
                event_outcome        = "Three crates of timber and 3 rations were lost";
                if (timber_cargo_count < 0)
                {
                    uiScript.loseDisp("The storm tore your ship apart and with no resources to repair it, you and your crew remain adrift at sea");
                }
            }
            if (result == 2)
            {
                event_outcome = "The loyalty of all crew was lowered by one";
            }
        }
        if (e.get_id() == 2)
        {
            if (result == 0)
            {
                event_outcome = "The loyalty of all crew was raised by two";
            }
            if (result == 1)
            {
                med_cargo_count    -= 3;
                timber_cargo_count -= 3;
                event_outcome       = "three crates of medicine and three crates of timber were lost";
                if (timber_cargo_count < 0 || med_cargo_count < 0)
                {
                    uiScript.loseDisp("Too many are out of action from the lack of supplies, and the your ship slowly sets adrift, with your crew unable to stop");
                }
            }
            if (result == 2)
            {
                med_cargo_count--;
                timber_cargo_count--;
                event_outcome = "one crate of medicine and one crate of timber were lost";
                if (timber_cargo_count < 0 || med_cargo_count < 0)
                {
                    uiScript.loseDisp("Too many are out of action from the lack of supplies, and the your ship slowly sets adrift, with your crew unable to stop");
                }
            }
        }
        if (e.get_id() == 3)
        {
            int           r           = Random.Range(0, 4);
            Ship_Movement ship_script = ship.GetComponent <Ship_Movement>();
            int           add         = ship_script.get_lucky_num() * 2;
            if (r == 0)
            {
                rum_cargo_count += 1 + add;
                event_outcome    = (1 + add) + " crates of rum were found as floatsam";
            }
            if (r == 1)
            {
                spice_cargo_count += 1 + add;
                event_outcome      = (1 + add) + " crates of spice were found as floatsam";
            }
            if (r == 2)
            {
                timber_cargo_count += 1 + add;
                event_outcome       = (1 + add) + " crates of timber were found as floatsam";
            }
            if (r == 3)
            {
                med_cargo_count += 1 + add;
                event_outcome    = (1 + add) + " crates of medicine were found as floatsam";
            }
        }
        if (e.get_id() == 4)
        {
            if (result == 1)
            {
                med_cargo_count--;
                event_outcome = "one crate of medicine was lost to cure a sickness";
                if (med_cargo_count < 0)
                {
                    uiScript.loseDisp("Without medicine to help stop the spread, the disease ravages you all");
                }
            }
        }
        if (e.get_id() == 5)
        {
            if (result == 1)
            {
                timber_cargo_count--;
                event_outcome = "one crate of timber was lost to fix up your ship from rough seas";
                if (timber_cargo_count < 0)
                {
                    uiScript.loseDisp("Unable to repair your ship, the damaged vessal slowly drifts to open ocean, never to be seen again");
                }
            }
        }
        if (e.get_id() == 6)
        {
            timber_cargo_count--;
            event_outcome = "one crate of timber was lost to fix up your ship from an accident";
            if (timber_cargo_count < 0)
            {
                uiScript.loseDisp("Unable to repair your ship, the damaged vessal slowly drifts to open ocean, never to be seen again");
            }
        }
        if (e.get_id() == 7)
        {
            if (result == 0)
            {
                event_outcome = "One of your crew had their wage increase by 1 and their loyalty increase by 2";
            }
            if (result == 1)
            {
                event_outcome = "One of your crew has lost 3 loyalty from being denied a raise";
            }
        }
        if (e.get_id() == 8)
        {
            if (result == 0)
            {
                event_outcome = "all of your crew with less than 5 loyalty have lost 1 loyalty and the one who tried to mutiny is loyal again";
            }
            if (result == 1)
            {
                event_outcome = "One of your crew has walked the plank, and the rest know now to fear you";
            }
        }
        //uiScript.updateCargoCount(((rations_cargo_count / 3) + med_cargo_count + timber_cargo_count + spice_cargo_count + rum_cargo_count), max_cargo);
        //uiScript.cargoUpdate();
    }
Exemplo n.º 8
0
    public void trigger_event(Event e)
    {
        Camera_Orbit camorbit = cam.GetComponent <Camera_Orbit>();

        camorbit.enabled = false;
        print(e.get_name());
        // local_event.SetActive(true);
        // event_name.text = events[num].get_name();
        // evnet_flavor.text = events[num].get_flavor();
        // decision1.text = events[num].get_o1();
        // decision2.text = events[num].get_o2();
        // current_event = events[num].get_name();
        if (e.is_active())
        {
            //print("active");
            if (e.get_id() == 7 || e.get_id() == 8)
            {
                uiScript.EventUI(true);
                uiScript.updateEvent(e.get_name(), ship_crew[e.get_trigger()].get_name() + " " + e.get_flavor(), e.get_o1(), e.get_o2(), e.get_o1_descrip(), e.get_o2_descrip());
            }
            else
            {
                uiScript.EventUI(true);
                uiScript.updateEvent(e.get_name(), e.get_flavor(), e.get_o1(), e.get_o2(), e.get_o1_descrip(), e.get_o2_descrip());
            }
        }
        else
        {
            //print("not active");
            string result     = "something should be here";
            int    num_result = -1;
            if (e.get_id() == 3)
            {
                //print("made it float");
                if (num_lucky > 0)
                {
                    result = e.get_flavor() + "\n" + e.get_good_result();
                }
                else
                {
                    result = e.get_flavor() + "\n" + e.get_failed_result();
                }
            }
            if (e.get_id() == 4)
            {
                //print("made it sick");
                if (has_doctor > 0)
                {
                    result     = e.get_flavor() + "\n" + e.get_good_result();
                    num_result = 0;
                }
                else
                {
                    result     = e.get_flavor() + "\n" + e.get_failed_result();
                    num_result = 1;
                }
            }
            if (e.get_id() == 5)
            {
                //print("made it rough");
                if (has_bosun > 0)
                {
                    result     = e.get_flavor() + "\n" + e.get_good_result();
                    num_result = 0;
                }
                else
                {
                    result     = e.get_flavor() + "\n" + e.get_failed_result();
                    num_result = 1;
                }
            }
            if (e.get_id() == 6)
            {
                //print("made it acc");
                result = e.get_flavor() + "\n" + e.get_good_result();
            }

            //uiScript.updateEvent(e.get_name(), e.get_flavor(), e.get_o1(), e.get_o2(), e.get_o1_descrip(), e.get_o2_descrip());
            uiScript.EventResultUI(true);
            uiScript.eventResult(result, e.get_name());
            ManagerScript manage = manager.GetComponent <ManagerScript>();
            manage.handle_event(current_event, num_result);
        }
    }