예제 #1
0
    void Awake()
    {
        crewList     = new CrewPerson[3];
        nameList     = new string[9];
        nameList [0] = "Womp";
        nameList [1] = "Smells";
        nameList [2] = "Mel";
        nameList [3] = "Dingo";
        nameList [4] = "Stumpy Stu";
        nameList [5] = "Cart";
        nameList [6] = "Farts";
        nameList [7] = "Hot Cheetos";
        nameList [8] = "Messy Jesse";

        for (int i = 0; i < crewList.Length; i++)
        {
            string name        = nameList[Random.Range(0, nameList.Length)];
            int    age         = Random.Range(18, 60),
                   engineering = Random.Range(18, 60),
                   fab         = Random.Range(18, 60),
                   mine        = Random.Range(18, 60);
            crewList [i] = new CrewPerson(name, age, engineering, fab, mine, i, crewpics[Random.Range(0, crewpics.Length)]);
        }


        crewDisplay1.GetComponent <SpriteRenderer> ().sprite = crewList [0].sprite;
        crewDisplay2.GetComponent <SpriteRenderer> ().sprite = crewList [1].sprite;
        crewDisplay3.GetComponent <SpriteRenderer> ().sprite = crewList [2].sprite;

        crew1main.sprite = crewList [0].sprite;
        crew2main.sprite = crewList [1].sprite;
        crew3main.sprite = crewList [2].sprite;
    }
예제 #2
0
 public IEnumerator filterUpgrade(CrewPerson crew)
 {
     if (ShipStatKeeper.filterCanUpgrade && Inventory.upgradeInv [2] > 3)
     {
         int count = -10;
         Inventory.upgradeInv [2] -= 3;
         while (count < 100)
         {
             count += 10;
             yield return(oxygenWait);
         }
         if (count >= 100)
         {
             crew.active = false;
             researchBehavior.roomLevels [7]++;
             ShipStatKeeper.filterCanUpgrade = false;
             yield break;
         }
     }
     else
     {
         if (!ShipStatKeeper.filterCanUpgrade)
         {
             Debug.Log("Can't upgrade! insufficient research");
         }
         else if (Inventory.upgradeInv [2] <= 3)
         {
             Debug.Log("Can't upgrade! insufficient filters");
         }
     }
 }
예제 #3
0
    IEnumerator Resting(CrewPerson crew)
    {
        WaitForSeconds wait       = new WaitForSeconds(1);
        float          multiplier = (5 - crew.health) * 5;

        for (int i = 0; i < multiplier; i++)
        {
            Debug.Log("Healing");
            yield return(wait);
        }

        if (crew.health < 3)
        {
            crew.health += 3;
        }
        else if (crew.health == 3)
        {
            crew.health += 2;
        }
        else
        {
            crew.happiness++;
        }
        Inventory.Inv [2]--;
        crew.active = false;
    }
예제 #4
0
 public void fix(int filters, CrewPerson crew)
 {
     if (health < 100 && filters >= 1)
     {
         Inventory.upgradeInv [3]--;
         crew.active = true;
         StartCoroutine(filterReplace(crew));
     }
 }
예제 #5
0
 public void fixCheck(int toolbox, CrewPerson crew)
 {
     if (toolbox >= 1 && health < 100 && crew.energy > 2)
     {
         Inventory.upgradeInv [0] -= 2;
         crew.active = true;
         crew.active = true;
         StartCoroutine(fix(crew));
     }
 }
예제 #6
0
    IEnumerator outBed(CrewPerson crew)
    {
        bool done = false;

        for (int i = 0; i < wakeTime; i++)
        {
            yield return(wait);
        }
        if (done)
        {
            crew.awake = true;
            yield break;
        }
    }
예제 #7
0
    IEnumerator fix(CrewPerson crew)
    {
        int count = -10;

        while (count < 100)
        {
            count += 10;
            yield return(wait);
        }
        if (count >= 100)
        {
            crew.active = false;
            health     += 50;
            yield break;
        }
    }
예제 #8
0
    IEnumerator filterReplace(CrewPerson crew)
    {
        crew.active = true;
        int count = -10;

        while (count < 100)
        {
            count += 10;
            yield return(oxygenWait);
        }
        if (count >= 100)
        {
            crew.active = false;
            health      = 100;
            yield break;
        }
    }
예제 #9
0
    IEnumerator maintain(CrewPerson crew)
    {
        int count = -10;

        while (count < 100)
        {
            Debug.Log("Maintaining");

            count += 10;
            yield return(upgradeWait);
        }
        if (count >= 100)
        {
            Debug.Log("Maintainance over");
            crew.active = false;
            yield break;
        }
    }
예제 #10
0
    public void maintainCheck(int toolbox, CrewPerson crew)
    {
        Debug.Log("maintain check");

        if (toolbox >= 1)
        {
            crew.active        = true;
            Inventory.Inv [0] -= 1;
            crew.active        = true;
            StartCoroutine(maintain(crew));
            Debug.Log("Started upgrade");
        }
        else
        {
            if (!ShipStatKeeper.engineCanUpgrade)
            {
                Debug.Log("not enough toolkits");
            }
        }
    }
예제 #11
0
    IEnumerator research(int room, CrewPerson crew)
    {
        if (room == 2)
        {
            wait = new WaitForSeconds(engineT [RoomManager.rooms [room].level]);
        }
        else if (room == 1)
        {
            wait = new WaitForSeconds(toolFabT [RoomManager.rooms [room].level]);
        }
        else if (room == 6)
        {
            wait = new WaitForSeconds(airFilterT [RoomManager.rooms [room].level]);
        }

        int target = 0;

        while (target < 10 + RoomManager.rooms [room].level)
        {
            target++;
            Debug.Log("researching " + target);
            yield return(wait);
        }
        if (target >= 10 + RoomManager.rooms [room].level)
        {
            Debug.Log("done w level research");
            if (room == 1)
            {
                ToolFab++;
            }
            else if (room == 2)
            {
                Engine++;
            }
            else if (room == 6)
            {
                Filter++;
            }
        }
    }
예제 #12
0
    IEnumerator addMineInv(int itemIndex, float crewSkill, CrewPerson crew, int index)      // 1 progress every 0.25 sec
    {
        Debug.Log("addMineInv started");


        float target             = FabTime [itemIndex];
        float productionProgress = 0;

        while (productionProgress < target)
        {
            productionProgress += (crewSkill * 0.01f) + (ShipStatKeeper.gravity * 0.5f);
            if (productionProgress + (crewSkill * 0.01f) + (ShipStatKeeper.gravity * 0.5f) > target)
            {
                Inv [itemIndex] += 1;
                Debug.Log("Made inv thing" + Inv[itemIndex]);
                crew.currentActivity = 0;
                crew.active          = false;
                action [index].text  = "";

                yield break;
            }
            crew.currentActivity = 3 + itemIndex;
            Debug.Log("Making" + Inv[itemIndex]);
            int temp = (int)(100 * productionProgress / target);
            action [index].text = mineItems [itemIndex] + ": " + temp + "%";
            crew.active         = true;
            yield return(wait);
        }

        Inv [itemIndex] += 1;
        Debug.Log("Made inv thing" + Inv[itemIndex]);
        crew.currentActivity = 0;
        crew.active          = false;
        action [index].text  = "";

        yield break;
    }