Пример #1
0
    /* Essential methods for functionality
     */
    protected virtual bool RegisterToBlackBoard()
    {
        selfKey = bb.Register(self, null, objectName);

        // Successful if selfKey is no longer null
        return(selfKey != null);
    }
Пример #2
0
    // Happens every round
    public void OnRoundBegins(int roundNumber)
    {
        // Reset the BlackBoard to clear out information from the previous round
        bb.ClearBlackBoard();

        // Reset Distribution if enabled
        distr.ResetCount();

        // Set diagnostics on battle screen
        GameObject nameObj = GameObject.Find("Name");

        if (nameObj != null)
        {
            NameHolder name = nameObj.GetComponent <NameHolder>();
            if (name != null)
            {
                name.setRoundStarted(true);
            }
        }

        // Add information about each player to Blackboard
        bb.Register(Constants.p1Key, new Dictionary <string, string>()
        {
            // Who am I?
            { Constants.playerName, "" },

            // Passives
            { Constants.indexLifePoints, p1.currentLifePoints.ToString() },
            { Constants.indexFavor, Constants.MIN_FAVOR.ToString() },
            { Constants.indexRally, Constants.MIN_RALLY.ToString() },
            { Constants.indexBalance, Constants.STARTING_BALANCE.ToString() },

            // Extra data for conditioning on moves
            { Constants.lastHitDamage, "0" },
            { Constants.lastAttackByPlayer, "" },
            { Constants.landedLastAttack, "" },
            { Constants.lastEvade, "" },
            { Constants.lastEvadeSuccessful, "" },
            { Constants.lastAttackByOpponent, "" },
            { Constants.opponentLandedLastAttack, "" },

            // Extra data for skill tree nodes

            // Surprise
            { Surprise.attackCount, "0" },
            { Surprise.evadeCount, "0" },

            // Distance to opponent
            { Constants.distToOpponent, Vector3.Distance(UFE.GetPlayer1Controller().transform.position, UFE.GetPlayer2Controller().transform.position).ToString() },

            // Match results
            { Constants.winner, "false" }
        });
        bb.Register(Constants.p2Key, new Dictionary <string, string>()
        {
            // Who am I?
            { Constants.playerName, "" },

            // Passives
            { Constants.indexLifePoints, p2.currentLifePoints.ToString() },
            { Constants.indexFavor, Constants.MIN_FAVOR.ToString() },
            { Constants.indexRally, Constants.MIN_RALLY.ToString() },
            { Constants.indexBalance, Constants.STARTING_BALANCE.ToString() },

            // Extra data for conditioning on moves
            { Constants.lastHitDamage, "0" },
            { Constants.lastAttackByPlayer, "" },
            { Constants.landedLastAttack, "" },
            { Constants.lastEvade, "" },
            { Constants.lastEvadeSuccessful, "" },
            { Constants.lastAttackByOpponent, "" },
            { Constants.opponentLandedLastAttack, "" },

            // Extra data for skill tree nodes

            // Surprise
            { Surprise.attackCount, "0" },
            { Surprise.evadeCount, "0" },

            // Distance to opponent
            { Constants.distToOpponent, Vector3.Distance(UFE.GetPlayer1Controller().transform.position, UFE.GetPlayer2Controller().transform.position).ToString() },

            // Match results
            { Constants.winner, "false" }
        });

        // Save BlackBoard state
        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            bb.UpdateProperty(Constants.p1Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username);
            bb.DumpBlackBoard(Constants.p2Key);
        }
        else
        {
            if (UFE.GetLocalPlayer() == 1)
            {
                bb.UpdateProperty(Constants.p1Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username);
            }
            else
            {
                bb.UpdateProperty(Constants.p2Key, Constants.playerName, GameObject.Find("Name").GetComponent <NameHolder>().username);
            }
        }
    }
Пример #3
0
 /* Essential methods for functionality
  */
 // Adds some extra properties to the BlackBoard to assist with interaction
 protected bool RegisterToBlackBoard(Dictionary <string, string> values)
 {
     // Returns true if the id was accepted and put into the dictionary
     return(bb.Register(id, values) == id);
 }