WIP: enemy behavior #26
@@ -131,7 +131,7 @@ namespace DefaultNamespace
 | 
			
		||||
 | 
			
		||||
        private void Retarget()
 | 
			
		||||
        {
 | 
			
		||||
            if (heroSet == null || heroSet.Count == 0)
 | 
			
		||||
            if (heroSet.IsEmpty)
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
					
					zephyr marked this conversation as resolved
					
						
						
							Outdated
						
					
				 
				 | 
			||||
            {
 | 
			
		||||
                // No heroes to target.
 | 
			
		||||
                // TODO(zeph): switch to a special behavior?
 | 
			
		||||
@@ -140,13 +140,7 @@ namespace DefaultNamespace
 | 
			
		||||
            }
 | 
			
		||||
            // TODO(zeph): target based on threat, once threat exists
 | 
			
		||||
            var k = Random.Range(0, heroSet.Count);
 | 
			
		||||
            var it = heroSet.GetEnumerator();
 | 
			
		||||
            // This seems to be the best way to do this...?
 | 
			
		||||
            for (var i = 0; i < k; i++)
 | 
			
		||||
            {
 | 
			
		||||
                it.MoveNext();
 | 
			
		||||
            }
 | 
			
		||||
            target = it.Current.gameObject;
 | 
			
		||||
            target = heroSet[k].gameObject;
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 
					
					zephyr marked this conversation as resolved
					
						
						
							Outdated
						
					
				 
				
				
					
						madxmike
						commented  
			
		We probably just want to implement https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/indexers/using-indexers on RuntimeSet We probably just want to implement https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/indexers/using-indexers on RuntimeSet 
			
			
		 | 
			||||
        }
 | 
			
		||||
 | 
			
		||||
        private void SetBehavior(BehaviorState behavior)
 | 
			
		||||
 
 | 
			
		||||
@@ -37,5 +37,7 @@ namespace RuntimeSet
 | 
			
		||||
        {
 | 
			
		||||
            return GetEnumerator();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public T this[int index] { get { return items[index]; } }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user
	
heroSet.IsEmpty