コード例 #1
0
    bool GetTarget()
    {
        // Get target from Arcade.
        // TODO: Make sure LastGame won't be picked twice in a row.
        if (!LastGame)
        {
            TargetGame = arcade.GetIdealGame(GamePref, TypePref);
        }
        else if (LastGame && LastGame.Title != GamePref)
        {
            TargetGame = arcade.GetIdealGame(GamePref, TypePref);
        }
        else
        {
            TargetGame = arcade.GetIdealGame("none", TypePref);
        }
        Debug.Log("Retrieved target game: " + TargetGame.Title);

        if (!TargetGame)
        {
            // Enter leaving state.
            Debug.Log("Man, I really need a leaving state because I certainly need to leave");
            return(false);
        }

        // Determine interest.
        // Interest is literally how many times a person will replay a game.
        // Interest is built up by how fun a game is, if it's a person's preferred type,
        // and brought down by the condition or the age
        // and modified by the price and the difficulty
        Interest = TargetGame.Fun;
        if (TargetGame.Title == GamePref)
        {
            Interest *= 1.0f;
        }
        else if (TargetGame.GameType == TypePref)
        {
            Interest *= 1.0f;
        }

        // Set Target position to that.
        if (customerAI)
        {
            customerAI.SetDestination(TargetGame.ServicePosition());
        }

        return(true);
    }