simplify runtime set access
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
db7559cd16
commit
ec2ede72ed
@ -131,7 +131,7 @@ private void OnDisable()
|
|||||||
|
|
||||||
private void Retarget()
|
private void Retarget()
|
||||||
{
|
{
|
||||||
if (heroSet == null || heroSet.Count == 0)
|
if (heroSet.IsEmpty)
|
||||||
{
|
{
|
||||||
// No heroes to target.
|
// No heroes to target.
|
||||||
// TODO(zeph): switch to a special behavior?
|
// TODO(zeph): switch to a special behavior?
|
||||||
@ -140,13 +140,7 @@ private void Retarget()
|
|||||||
}
|
}
|
||||||
// TODO(zeph): target based on threat, once threat exists
|
// TODO(zeph): target based on threat, once threat exists
|
||||||
var k = Random.Range(0, heroSet.Count);
|
var k = Random.Range(0, heroSet.Count);
|
||||||
var it = heroSet.GetEnumerator();
|
target = heroSet[k].gameObject;
|
||||||
// This seems to be the best way to do this...?
|
|
||||||
for (var i = 0; i < k; i++)
|
|
||||||
{
|
|
||||||
it.MoveNext();
|
|
||||||
}
|
|
||||||
target = it.Current.gameObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetBehavior(BehaviorState behavior)
|
private void SetBehavior(BehaviorState behavior)
|
||||||
|
@ -37,5 +37,7 @@ IEnumerator IEnumerable.GetEnumerator()
|
|||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public T this[int index] { get { return items[index]; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user