Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        bool red_touching         = touching[(int)BasicPlayer.PlayerType.RED];
        bool blue_touching        = touching[(int)BasicPlayer.PlayerType.BLUE];
        bool both_touching        = red_touching && blue_touching;
        bool only_one_touching    = red_touching ^ blue_touching;
        bool one_or_both_touching = red_touching || blue_touching;

        bool win_condition = false;

        switch (who_is_this_for)
        {
        case IntendedFor.JUST_RED:
            win_condition = red_touching;
            break;

        case IntendedFor.JUST_BLUE:
            win_condition = blue_touching;
            break;

        case IntendedFor.EITHER_ONE_BUT_NOT_BOTH:
            win_condition = only_one_touching;
            break;

        case IntendedFor.EITHER_ONE_OR_BOTH:
            win_condition = one_or_both_touching;
            break;

        case IntendedFor.BOTH:
            win_condition = both_touching;
            break;
        }

        if (win_condition)
        {
            DungeonMaster.LevelFinished();
        }
    }