public BehaviorNodeReturnCode SelectBestOpportunity(BaseNavyArmy army) { NavyArmy navyArmy = army as NavyArmy; if (navyArmy == null) { return(BehaviorNodeReturnCode.Failure); } float num = 0.1f; BehaviorOpportunity secondaryTarget = null; for (int i = 0; i < navyArmy.Opportunities.Count; i++) { if (navyArmy.Opportunities[i].Score > num) { num = navyArmy.Opportunities[i].Score; secondaryTarget = navyArmy.Opportunities[i]; } } navyArmy.SecondaryTarget = secondaryTarget; if (navyArmy.SecondaryTarget == null) { return(BehaviorNodeReturnCode.Failure); } return(BehaviorNodeReturnCode.Success); }
public override void DisplayDebug() { base.DisplayDebug(); if (this.OpportunityAttackableTarget != null) { GUILayout.Label(string.Format("Opportunity Attackable Target: {0}", this.OpportunityAttackableTarget.LocalizedName), new GUILayoutOption[0]); } if (this.SecondaryTarget != null) { GUILayout.Label(string.Format("Opportunity Target: {0}", this.SecondaryTarget.OpportunityPosition), new GUILayoutOption[0]); } for (int i = 0; i < this.Opportunities.Count; i++) { BehaviorOpportunity behaviorOpportunity = this.Opportunities[i]; behaviorOpportunity.Score.Display("Opportunity[{0}] = {1}: {2} at {3}", new object[] { i, behaviorOpportunity.Score.Value, behaviorOpportunity.Type, behaviorOpportunity.OpportunityPosition }); } GUILayout.Space(10f); }