Наследование: MonoBehaviour
Пример #1
0
    public void MarsAttackCalculation()                                                         // this is called once every turn to set And/or count the time untill attack
    {
        if (HangarManager.Instance().AnythingLaunched == true && MartianWarningPassed == false) //This onetime use 'if' sets the initiation of the possibility of martian attack
        {
            TurnsPassedUntillMartianWarning = TurnCounter;
            MartianWarningPassed            = true;
        }

        if (MartianWarningPassed == true)
        {
            if (MartianAttackSet == false)
            {
                //Random rnd = new Random();
                int MartianAttackFrequency = Random.Range(25, 50);

                TurnsUntillMartianAttack = MartianAttackFrequency; // This Calculus wont work:TurnsPassedUntillMartianWarning + MartianAttackFrequency;
                MartianAttackNumber++;                             // we keep track on what attacknumber it is that the martians are conducting in order to set how many Martian fighter bombers attack
                MartianAttackSet = true;
            }

            if (MartianAttackSet == true)
            {
                TurnsUntillMartianAttack--;// count down until attack

                if (TurnsUntillMartianAttack == 0)
                {
                    MartianAttack(MartianAttackNumber); // we call the Martian attack because the moonbase is now to be attacked.
                    MartianAttackSet = false;           // we reset the martian attack so a new countdown can be given next round
                }



                //WE NEED TO SET a warning if a radar is present at the base
                for (int i = 0; i < HangarManager.Instance().FinishedItems.Count; i++)
                {
                    if (HangarManager.Instance().FinishedItems[i].ItemID == 17)
                    {
                        MoonBaseHasRadar = true; //
                        break;
                    }
                }

                if (MoonBaseHasRadar == true) //Remember this is called every turn if martiansattack is true..
                {
                    // give warning in log(first time!!) and defense module of when an attack will occur. countdown each round
                }
            }
        }
    }
Пример #2
0
    public void Land() //when a ship is in transit to the moon and days untill arrival reaches 0 // THIS NEEDS TO BE REDONE
    {
        if (InTransitMoon == true && DaysUntilArrival == 0)
        {
            OnMoon = HangarManager.Instance().InsertShip(this);

            if (!OnMoon)
            {
                //Handle no-space in bays
            }
            //For production part:
            //HangarManager.instance().InsertShip(Instantiate(Resources.Load("BaseItems/Grazer") as BaseItem));

            InTransitMoon = false;
        }
    }
    void Recal(int val = 0)
    {
        //우정포인트를 제하고 화면상에 우정포인트 관련된 것들을 제대로 보이게 만들어 주는 부분.
        ValueDeliverScript.buddyPoint = ValueDeliverScript.buddyPoint - usingPoint;
        //ValueDeliverScript.friendshipPoint -= usingPoint;   //실제 우정포인트의 총량을 감소시킨다.

        HangarManager hangerCon = GameObject.Find("GameManager").GetComponent <HangarManager>();

        if (ValueDeliverScript.buddyPoint < 100)
        {
            GetComponent <HangarManager>().ShotFriendshipPoint();
        }

        point100Label.text = (int.Parse(point100Label.text) - 1).ToString("00");

        //0이면 숫자 안나오게//
        if (point100Label.text == "00")
        {
            point100Label.text = "";
        }

        getItem.spriteName = itemName;
        getValue.text      = text;
        getItem.MakePixelPerfect();


        //발생된 아이템을 알려주는 정보 확인창을 띄운다.

        if (val != 27)
        {
            FreindshipPointGetItemWindow();
        }
        else
        {
            hangarManager.upgradePointWindow.transform.FindChild("PointAdd").GetComponent <UILabel>().text = "X 1";
            flightUpointSetScript.RedrawStatePoint();
            hangarManager.ShowUpgradePointWindow();
        }
        //최신 내역으로 갱신//
        GetComponent <GasTimeScript>().MedalRecount(); //화면에 표시되는 메달양을 다시 계산하여 재표시하여줌.
        GetComponent <GasTimeScript>().CoinRecount();  //화면에 표시되는 동전양을 다시 계산하여 재표시하여줌.
        GetComponent <HangarManager>().LoadEquip();    //이큅창들에 들어가는 아이템 표시를 다시 계산하고.
        StartCoroutine(IEquipStartSetting());          //그 계산한것을 기반으로 어떤것이 선택되어야되는지에 대해서 재계산한다.
        //최신 내역으로 갱신//
        ValueDeliverScript.SaveGameData();
    }
Пример #4
0
    public bool HasEnergyFor(BaseItem ProductionItem)
    {
        EnergyOnBase = 170;

        for (int i = 0; i < HangarManager.Instance().FinishedItems.Count; i++)
        {
            if (HangarManager.Instance().FinishedItems[i].ItemID == 6)
            {
                if (EnergyOnBase >= 170)
                {
                    EnergyOnBase = 680;
                }
            }
            if (HangarManager.Instance().FinishedItems[i].ItemID == 7)
            {
                if (EnergyOnBase >= 680)
                {
                    EnergyOnBase = 3200;
                }
            }
            if (HangarManager.Instance().FinishedItems[i].ItemID == 8)
            {
                if (EnergyOnBase >= 3200)
                {
                    EnergyOnBase = 25000;
                }
            }
            if (HangarManager.Instance().FinishedItems[i].ItemID == 9)
            {
                if (EnergyOnBase >= 25000)
                {
                    EnergyOnBase = 37000;
                }
            }
        }
        Debug.Log("ENERGY ON BASE: " + EnergyOnBase);
        if (ProductionItem.PowerNeeded <= EnergyOnBase)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
Пример #5
0
    private int count; // for counting up eleements in the finished list

    public void FinishBuild()
    {
        HangarManager.Instance().FinishedItems.Add(this);                                                              // take this object and put it into the list of finished items
                                                          /*HangarManager.Instance().InProductionItems.Remove(this);*/ // take this object and remove it from the list of items which is in production

        if (this.ItemTypeNr == 1)
        {
            HangarManager.Instance().ShipsInService.Add(this);
            // Maybe more here
        }

        if (this.ItemID == 6) // if this is a SolarMK2 then set its panel true. //Note.. we need to update the finished item list if it gets destroyed
        {
            HangarManager.Instance().SolagenMK2.SetActive(true);
        }
        if (this.ItemID == 7) //
        {
            HangarManager.Instance().SolagenMK2.SetActive(true);
            HangarManager.Instance().SolagenMK3.SetActive(true);
        }
        if (this.ItemID == 8)
        {
            HangarManager.Instance().SolagenMK2.SetActive(true);
            HangarManager.Instance().SolagenMK3.SetActive(true);
            HangarManager.Instance().SolagenMK4.SetActive(true);
        }

        this.InProduction = false; // As this item is finished we set it to false

        //Below here: we tell what is finished dbuild and what eventually is next in production que
        string NextProductionItem = "No more items in production que!";

        if (HangarManager.Instance().InProductionItems.Count > 1)
        {
            NextProductionItem = "Still running! "; //+ HangarManager.Instance().InProductionItems[HangarManager.Instance().InProductionItems.Count-1].ItemName; // MAYBE -1 in the list count
        }
        MessageManager.Instance().UpdateMessagePanel("Turn: " + NextTurn.Instance().TurnCounter + ". Item Finished: \n", "          " + this.ItemName + ".   Production status is: " + NextProductionItem + "\n");

        foreach (var FinishedItem in HangarManager.Instance().FinishedItems)                                         // trying to read out the list of build things
        {
            Debug.Log("Finished Item nr " + count + " is:" + HangarManager.Instance().FinishedItems + FinishedItem); // Show in the Debug log whats on this list to show iterate through
            count++;
        }
    }
Пример #6
0
    public void Turn() // This method increments the resource varibles in regard to the resource incrementation and updates GUITEXT!
    {
        // This is made for the moon only, later add on needs another structure for this

        // If PowerManager.powerSurplus > PowerNeededFor mining{ ....  // Power will always be sufficient

        WaterOnBase    += 3; //THis Should be changed down for the prototype a there i energy enough
        TitanOnBase    += 6;
        AluOnBase      += 4;
        CopperOnBase   += 0;
        SilicaOnBase   += 4;
        IronOnBase     += 4;
        SilverOnBase   += 0;
        PlatinumOnBase += 0;
        UraniumOnBase  += 0;



        for (int i = 0; i < HangarManager.Instance().FinishedItems.Count; i++)
        {
            if (HangarManager.Instance().FinishedItems[i].ItemID == 6 && EnergyOnBase < 3200)
            {
                EnergyOnBase = 680;
                continue;
            }
            if (HangarManager.Instance().FinishedItems[i].ItemID == 7 && EnergyOnBase < 25000)
            {
                EnergyOnBase = 3200;
                continue;
            }
            if (HangarManager.Instance().FinishedItems[i].ItemID == 8 && EnergyOnBase < 37000)
            {
                EnergyOnBase = 25000;
                continue;
            }
            if (HangarManager.Instance().FinishedItems[i].ItemID == 9)
            {
                EnergyOnBase = 37000;
                continue;
            }
        }
        UpdateResourceText();
    }
Пример #7
0
 // Start is called before the first frame update
 public virtual void Start()
 {
     gameManager   = GameManager._instance;
     hangarManager = HangarManager._instance;
 }
Пример #8
0
 void Awake()
 {
     _instance = this;
 }
Пример #9
0
    public int LengthOfShipsInProduction; // a way to count up Ships in production As these need for counting up nr of in production items correctly

    public void ProgressTurn()            // Resource increment is handled in its own Turn method in ResourceManager
    {
        TurnCounter++;

        MarsAttackCalculation(); //This method calculates if and when Martians attack, and then calls Marsattack()method when attack happen



        HangarManager.Instance().DisplayEquipmentList();

        var TextComponent = TurnText.GetComponent <Text>();          // For incrementing of the turn

        TextComponent.text = TurnCounter + "";                       //

        var TextComponent2 = InproductionText.GetComponent <Text>(); // we need this to append and subtract items on the build stack (reverse of que)

        var TextComponent3 = TurnTextForGUI.GetComponent <Text>();   // Turns left..


        for (int i = 0; i < 8; i++)
        {
            // if the bay is empty (nothing is in production/finished or the spacecraft has launched)  show the defaualt empty thing
            HangarManager.Instance().UpdateValuesInHangar(i, HangarManager.Instance().Bays[i].ship);
        }


        foreach (BaseItem obj in HangarManager.Instance().ShipsInService)
        {
            //HERE WE NEED TO DECREMENT DAYSUNTILLARRIVAL FOR ALL SHIPS THAT ARE ENROUTE UNTILL THEY REACH 0



            // if something breaks, check if the shipidentifer actually is in the list
            Debug.Log(obj.ShipName + " is on moon : " + obj.OnMoon);
        }

        if (HangarManager.Instance().InProductionItems.Count > 0)
        {
            LengthOfInProductionList = HangarManager.Instance().InProductionItems.Count - 1;      // THIS DOES NOT SEEM RIGHT WE might also need a LENGTHOFSHIP BUILD -Not sure though
            Debug.Log(LengthOfInProductionList + ";" + HangarManager.Instance().InProductionItems.Count);
            HangarManager.Instance().InProductionItems[LengthOfInProductionList].ProgressBuild(); // PROGRESSING BUILD -> in here we also handle what todo when build is finished


            // under here we adjust the baynumber for already finished ships, if there are such

            if (HangarManager.Instance().InProductionItems[LengthOfInProductionList].ItemTypeNr == 1) // NOT SURE we only want to update the hangar ships in production and not update items which is not ships
            {
                LengthOfShipsInProduction = 0;                                                        // reset it for a new count
                for (int i = 0; i < LengthOfInProductionList; i++)
                {
                    if (HangarManager.Instance().InProductionItems[i].ItemTypeNr == 1) //if it is a ship
                    {
                        LengthOfShipsInProduction++;
                    }
                }

                //HangarManager.Instance().UpdateValuesInHangar(LengthOfInProductionList + NrOfFinishedShipsInHangar, HangarManager.Instance().InProductionItems[LengthOfInProductionList]); // TEST.Changing the last item in the production TRYING TO MAKE THIS change display WORKS!!!
            }

            //*!?
            //HangarManager.Instance().UpdateValuesInHangar(LengthOfShipsInProduction + NrOfFinishedShipsInHangar, HangarManager.Instance().InProductionItems[LengthOfShipsInProduction]); // TEST.Changing the last item in the production TRYING TO MAKE THIS change display WORKS!!!
            // go into each hangar bay , and update the UI with the necessary information depending on the status


            TextComponent3.text = "" + HangarManager.Instance().InProductionItems[LengthOfInProductionList].TurnsUntillFinished; // HERE WE SET THE TURNSLEFT in the production panel

            TextComponent2.text = "";                                                                                            // Clear the text for the production list -- Sorta Works
            //foreach(var Item in HangarManager.Instance().InProductionItems) // here we check the list of items set into production - because it is possible to set several things into production at the same time


            for (int i = HangarManager.Instance().InProductionItems.Count - 1; i >= 0; i--) //counting backwards to avoid problems when removing an element(baseitem) from the list
            {
                //for each item in production we progress build -NOTE THIS SHOULD ONLY BE DONE FOR LAST ITEM IN THE LIST!!!
                Debug.Log("items curently in production mode: " + HangarManager.Instance().InProductionItems[i]); // this should be put into a list in the Production Canvas - Attempt on this just below

                TextComponent2.text += "/ " + HangarManager.Instance().InProductionItems[i] + "\n";               // Here we add all the current objects inside the ProductionItems to the text which should display what has been chosen for the production stack!!

                if (HangarManager.Instance().InProductionItems[i].InProduction == false)
                {
                    // We need to remove the graphical representation of this object in the production module(false). And set the next in line to be represented:
                    if (HangarManager.Instance().InProductionItems.Count > 1)
                    {
                        if (HangarManager.Instance().InProductionItems[i].ItemID == 0 && HangarManager.Instance().InProductionItems[i - 1].ItemID != 0) // If probe then remove the graphical representation of it unless next in production is also probe
                        {
                            ProbeInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 1)
                            {
                                GrazerInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 8)
                            {
                                SolaGenInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 2)
                            {
                                WaveriderInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 9)
                            {
                                FusionReactorInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 3)
                            {
                                CarrackInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 4)
                            {
                                SIOSInProduction.SetActive(true);
                            }
                        }

                        if (HangarManager.Instance().InProductionItems[i].ItemID == 1 && HangarManager.Instance().InProductionItems[i - 1].ItemID != 1) // If grazer then remove the graphical representation of it
                        {
                            GrazerInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 0)
                            {
                                ProbeInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 8)
                            {
                                SolaGenInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 2)
                            {
                                WaveriderInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 9)
                            {
                                FusionReactorInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 3)
                            {
                                CarrackInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 4)
                            {
                                SIOSInProduction.SetActive(true);
                            }
                        }

                        if ((HangarManager.Instance().InProductionItems[i].ItemID == 6 || HangarManager.Instance().InProductionItems[i].ItemID == 7 || HangarManager.Instance().InProductionItems[i].ItemID == 8) && (HangarManager.Instance().InProductionItems[i - 1].ItemID != 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID != 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID != 8)) // If solagenMK2 or MK3 or MK3 then remove the graphical representation of it
                        {
                            SolaGenInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 0)
                            {
                                ProbeInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 1)
                            {
                                GrazerInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 2)
                            {
                                WaveriderInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 9)
                            {
                                FusionReactorInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 3)
                            {
                                CarrackInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 4)
                            {
                                SIOSInProduction.SetActive(true);
                            }
                        }

                        if (HangarManager.Instance().InProductionItems[i].ItemID == 2 && HangarManager.Instance().InProductionItems[i - 1].ItemID != 2) // If grazer then remove the graphical representation of it
                        {
                            WaveriderInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 0)
                            {
                                ProbeInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 8)
                            {
                                SolaGenInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 1)
                            {
                                GrazerInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 9)
                            {
                                FusionReactorInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 3)
                            {
                                CarrackInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 4)
                            {
                                SIOSInProduction.SetActive(true);
                            }
                        }

                        if (HangarManager.Instance().InProductionItems[i].ItemID == 9 && HangarManager.Instance().InProductionItems[i - 1].ItemID != 9) // If fusion then remove the graphical representation of it
                        {
                            FusionReactorInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 0)
                            {
                                ProbeInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 8)
                            {
                                SolaGenInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 1)
                            {
                                GrazerInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 2)
                            {
                                WaveriderInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 3)
                            {
                                CarrackInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 4)
                            {
                                SIOSInProduction.SetActive(true);
                            }
                        }

                        if (HangarManager.Instance().InProductionItems[i].ItemID == 3 && HangarManager.Instance().InProductionItems[i - 1].ItemID != 3) // If grazer then remove the graphical representation of it
                        {
                            CarrackInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 0)
                            {
                                ProbeInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 8)
                            {
                                SolaGenInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 1)
                            {
                                GrazerInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 2)
                            {
                                WaveriderInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 9)
                            {
                                FusionReactorInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 4)
                            {
                                SIOSInProduction.SetActive(true);
                            }
                        }

                        if (HangarManager.Instance().InProductionItems[i].ItemID == 4 && HangarManager.Instance().InProductionItems[i - 1].ItemID != 4) // If grazer then remove the graphical representation of it
                        {
                            SIOSInProduction.SetActive(false);
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 0)
                            {
                                ProbeInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 6 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 7 || HangarManager.Instance().InProductionItems[i - 1].ItemID == 8)
                            {
                                SolaGenInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 1)
                            {
                                GrazerInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 2)
                            {
                                WaveriderInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 9)
                            {
                                FusionReactorInProduction.SetActive(true);
                            }
                            if (HangarManager.Instance().InProductionItems[i - 1].ItemID == 3)
                            {
                                CarrackInProduction.SetActive(true);
                            }
                        }
                    }
                    if (HangarManager.Instance().InProductionItems.Count <= 1)
                    {
                        ProbeInProduction.SetActive(false); // if no production is left after this, then erase all graphical representation of production items in the production module
                        GrazerInProduction.SetActive(false);
                        SolaGenInProduction.SetActive(false);
                        SIOSInProduction.SetActive(false);
                        CarrackInProduction.SetActive(false);
                        WaveriderInProduction.SetActive(false);
                        FusionReactorInProduction.SetActive(false);
                    }


                    HangarManager.Instance().InProductionItems.RemoveAt(i);                         // remove this BaseItem from the inproduction list
                    TextComponent2.text = "";                                                       // empty the textfield
                    for (int j = HangarManager.Instance().InProductionItems.Count - 1; j >= 0; j--) //refill the text again (which now should be without the removed text part)
                    {
                        TextComponent2.text += "/ " + HangarManager.Instance().InProductionItems[j] + "\n";
                    }
                }
            }

            NrOfFinishedShipsInHangar = 0;                                         //reset the number for a new count of actual finished ships in hangar
            for (int k = 0; k < HangarManager.Instance().FinishedItems.Count; k++) // We count through the items in the finisheditemslist
            {
                if (HangarManager.Instance().FinishedItems[k].ItemTypeNr == 1)     // && HangarManager.Instance().InProductionItems.Count==1 // finding thoe that are spacecraft + LATER: also we need to know where the ship position is!!!! All clones should be set to the moon when being created
                {
                    NrOfFinishedShipsInHangar++;
                }
            }
        }

        ProgressSpaceTravel(); //at the end of the progress turn method we 'move' all ships

        //If There has been a warning from the Martian commander the player would be informed by his security advisor after 1 round
        if (TurnsPassedUntillMartianWarning + 1 == TurnCounter && MartianWarningPassed == true)
        {
            MessageManager.Instance().UpdateEncounterMessagePanel("I might have usable information! ", "Your medical officer adresses you at your command station:\n" +
                                                                  " 'Sirs, 4 years back, I worked on a secret project for Musk Space Incorporated, involving genetically enhancing humans into H**o Martianis,a human mutant which would be able to breathe on Mars without the need for spacesuits." +
                                                                  "I do not know if they succeded, but I can see that the Martian threat message uses the proprietary message protocol of Musk Incorporated and thus the threat message might originate from them.\n\n" +
                                                                  "I remember from the Musk Genetic alteration program, that they had severe problems with controling the temprement of the test subjects, who often exploded in anger over the smallest of issues." +
                                                                  "\nIf indeed these threats originate from the H**o Martianis and they got the big Musk base up there as they proposed, we might be facing a seriou threat sir'");
            CommunicationAdvisor.SetActive(true);     //Show the AdviSor
        }
    }
 void Awake()
 {
     hangarManager = GameObject.Find("GameManager").GetComponent <HangarManager>();
 }
Пример #11
0
    public void InstantiateBuild(int BuildNumber)                   // HERE SHOULD ALSO BE A PARAMETER FOR BUILDTYPE to determine if it is a ship or not!
    {
        BaseItem newObject = BaseItemDatabase.GetItem(BuildNumber); //NOTE: THIS HAS BEEN MOVED OUTSIDE THE IF condition BELOW!!!

        HangarManager.Instance().InProductionItems.Add(newObject);

        if (ResourceManager.instance.HasResourcesFor(newObject) && ResourceManager.instance.HasEnergyFor(newObject)) // Do we have the required resources ANd Energy
        {                                                                                                            //If yes
            if (newObject.ItemTypeNr == 1 && HangarManager.Instance().HasEmptySpot())                                //Is there an empty spot in the hangar?
            {
                ItemCounter++;                                                                                       //every time we build something this is incremented to give unique names etc.
                newObject.InProduction   = true;
                newObject.ShipIdentifier = ItemCounter;
                newObject.ShipName       = newObject.ItemName + "0" + ItemCounter;
                HangarManager.Instance().InsertShip(newObject); //Insert Item BuildNumber (e.g. 0 = probe)
                DaysUntilFinished = newObject.TurnsUntillFinished;


                Debug.Log(newObject.PowerNeeded + " PowerNeeded ");

                // Below a call to a method to set the data from the selected object for production into a specific hangar. MIGHT not belong here!!
                TypeName = newObject.ItemName;
            }
            else if (newObject.ItemTypeNr == 1 && HangarManager.Instance().HasEmptySpot() == false)
            {
                //Message player that there is no room in Hangar
                Destroy(newObject);  //Ødelæg objectet

                NotEnoughRoomInHangarPanel.SetActive(true);
            }



            //All other non SpaceCraftObjects handled here
            if (newObject.ItemTypeNr == 2)                         // if this is an energyitem
            {
                newObject.InProduction = true;                     // set the item to be in production
                HangarManager.Instance().InsertEquipment(newObject);
                DaysUntilFinished = newObject.TurnsUntillFinished; // not sure if this is used....
            }
            if (newObject.ItemTypeNr == 3)                         // if this is an Weaponitem
            {
                newObject.InProduction = true;                     // set the item to be in production
                HangarManager.Instance().InsertEquipment(newObject);
                DaysUntilFinished = newObject.TurnsUntillFinished; // not sure if this is used....
            }
            if (newObject.ItemTypeNr == 4)                         // if this is an Supplementaryitem
            {
                newObject.InProduction = true;                     // set the item to be in production
                HangarManager.Instance().InsertEquipment(newObject);
                DaysUntilFinished = newObject.TurnsUntillFinished; // not sure if this is used....
            }

            /* else // if the type = 1 and there is no space it should be destroyed
             * {
             * Destroy(newObject); //Ødelæg objectet
             * NotenoughResourcesPanel.SetActive(true);
             * } */
        }
        else     //If no:
        {
            //fortæl spilleren at der ikke er resourcer nok
            if (ResourceManager.instance.HasResourcesFor(newObject) == false)
            {
                NotenoughResourcesPanel.SetActive(true);
            }

            if (ResourceManager.instance.HasEnergyFor(newObject) == false)
            {
                NotEnoughEnergyPanel.SetActive(true);
            }
            Destroy(newObject);     //Ødelæg objectet
        }
    }