Beispiel #1
0
    public void FighterDies(AbstractFighter fighter, AbstractFighter killer)
    {
        int            fighterNum     = fighter.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM);
        FighterResults fighterResults = resultsDict[fighterNum];

        if (!BattleLoader.current_loader.stockInfinity)
        {
            fighterResults.stocks -= 1;
            if (fighterResults.stocks <= 0)
            {
                UnregisterObject(fighter.getBattleObject());
                //If there's one or less players left, end the battle
                if (fighters.Count <= 1)
                {
                    EndBattle();
                }
            }
            else
            {
                fighter.Respawn();
            }
        }
        fighterResults.falls += 1;
        fighterResults.score -= 1;

        //If the killer is null, it's a self destruct and we need to adjust the score as such
        if (killer == null)
        {
            fighterResults.score         -= 1;
            fighterResults.selfDestructs += 1;

            fighterResults.deathsAgainst[fighterNum] += 1;
            fighterResults.killsAgainst[fighterNum]  += 1;
        }
        else
        {
            int            killerNum     = killer.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM);
            FighterResults killerResults = resultsDict[killerNum];

            killerResults.score += 1;
            killerResults.killsAgainst[fighterNum]  += 1;
            fighterResults.deathsAgainst[killerNum] += 1;
        }
    }
    void Start()
    {
        ResultsScreen resultsScreen = GameObject.FindObjectOfType <ResultsScreen>();
        bool          valid         = false;

        if (resultsScreen != null)
        {
            if (resultsScreen.results.Count >= (playerNum + 1))
            {
                results = resultsScreen.results[playerNum];
                if (results.fighterName != "")
                {
                    nameLabel.text = results.fighterName;
                    valid          = true;
                }
            }
        }
        if (!valid)
        {
            gameObject.SetActive(false);
        }
    }
 public void AddFighterResult(FighterResults result)
 {
     results.Add(result);
 }