コード例 #1
0
    // This function listens to the RemoveColonist event, and it removes the colonist given in the args from
    // both lists (if they're in the lists.) It's mostly important to check if they're in the list because
    // sometimes a colonist will be in assignable and sometimes not depending on if they're given a Task.
    void OnRemoveColonist(object sender, ColonistEventArgs args)
    {
        Colonist colonistToRemove = args.colonistPayload;

        if (allColonists.Contains(colonistToRemove))
        {
            allColonists.Remove(colonistToRemove);
        }

        if (assignableColonists.Contains(colonistToRemove))
        {
            assignableColonists.Remove(colonistToRemove);
        }
    }
コード例 #2
0
ファイル: StatusUI.cs プロジェクト: jonesnil/BeepBoopacolypse
    // This bit is kind of important. When the RemoveColonist event is called, that colonist
    // obviously should not be able to resolve any tasks assigned to them. This function grabs
    // the dead colonist and searches all the tasks it has for them, and if they have a task it
    // deletes it.
    //
    // Ideally one colonist should have only one job, and I've never seen that not be
    // the case, but just in case this function checks all tasks for that colonist and can potentially
    // remove multiple..
    void OnRemoveColonist(object sender, ColonistEventArgs args)
    {
        this.currentColonists -= 1;

        if (this.currentColonists <= this.maxColonists)
        {
            canAddColonist = true;
        }

        if (this.currentColonists <= 0)
        {
            GameEvents.InvokeGameOver(this.daysPassed, false);
        }

        Colonist    colonistToRemove = args.colonistPayload;
        int         counter          = 0;
        int         target           = taskHolder.Count;
        List <Task> dummyTaskHolder  = new List <Task>();

        while (counter < target)
        {
            if (taskHolder[counter].colonist == colonistToRemove)
            {
                dummyTaskHolder.Add(taskHolder[counter]);
            }

            counter += 1;
        }

        foreach (Task badTask in dummyTaskHolder)
        {
            badTask.active = false;
            taskHolder.Remove(badTask);
            GameEvents.InvokeTaskCompleted(badTask);
        }

        dummyTaskHolder = new List <Task>();

        UpdateDisplay();
    }
コード例 #3
0
    // When a robot attack happens this sets the text depending on if anyone died, and changes the alert type
    // to the right one.
    void OnRoboAttackUIStarted(object sender, ColonistEventArgs args)
    {
        alertType = AlertType.RobotAttack;

        OpenGameOverUI();

        if (args.colonistPayload != null)
        {
            dead = args.colonistPayload;
            gameOverText.text = "ROBOT ATTACK: They rushed us bad last night. We held them off for now, but " + dead.name + " was killed.";
            dayDisplay.text   = "Happiness -10";
            GameEvents.InvokeHappinessChanged(-10);
            restartButton.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Goodbye, " + dead.name;
        }
        else
        {
            gameOverText.text = "ROBOT ATTACK: They attacked last night, but we were ready. Even went out and popped the heads to stop the beeping.";
            dayDisplay.text   = "Happiness +10";
            GameEvents.InvokeHappinessChanged(10);
            restartButton.transform.GetChild(0).gameObject.GetComponent <Text>().text = "Nice.";
        }
    }
コード例 #4
0
ファイル: StatusUI.cs プロジェクト: jonesnil/BeepBoopacolypse
 // Don't try to advance the day on your robot attack alert.
 void OnRoboAttackUIStarted(object sender, ColonistEventArgs args)
 {
     advanceDayButton.interactable = false;
 }
コード例 #5
0
 // No clicking stuff during a robot attack.
 void OnRoboAttackUIStarted(object sender, ColonistEventArgs args)
 {
     inMenu = true;
 }