BeforeTrigKill() { base.BeforeTrigKill(); if (MatchMaterialIndex == MaterialReinitializor_.GetCurrentMaterialIndex()) { CollaborativeParentNode.AddReward(1f * CollaborativeParentNode.RewardSchemeScale); } else { CollaborativeParentNode.AddReward(-1f * CollaborativeParentNode.RewardSchemeScale); } } // TrigEvent
RewardRanking(ArenaNode ParentNode, ArenaNode ChildNode) { // compute reward based on ranking float StepReward_ = 0f; if (ParentNode.RankingWinType == RankingWinTypes.Survive) { // Survive: dead ranking at 1 means reward 0, the higher the dead ranking, the better StepReward_ += (float)ChildNode.GetKilledRanking() * globalManager.RewardRankingCoefficient; } else if (ParentNode.RankingWinType == RankingWinTypes.Depart) { // Depart: dead last (ranking getNumTeams()) means reward 0, the lower the dead ranking, the better StepReward_ += ((float)ParentNode.GetNumChildNodes() - (float)ChildNode.GetKilledRanking() - 1f) * globalManager.RewardRankingCoefficient; } else { Debug.LogError("RankingWinType is invalid."); } // add the computed reward ChildNode.AddReward(StepReward_ * ParentNode.RewardSchemeScale); }