Implement TargetingPolicy, Cover can only target other allies
This commit is contained in:
parent
611601934d
commit
3e0004d4cb
21 changed files with 151 additions and 26 deletions
32
Assets/Battle/Targeting/SingleTargeting.cs
Normal file
32
Assets/Battle/Targeting/SingleTargeting.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SingleTargeting
|
||||
{
|
||||
private TargetingPolicy targetingPolicy;
|
||||
private BattleParticipant participantClicked;
|
||||
|
||||
public SingleTargeting(TargetingPolicy targetingPolicy) {
|
||||
this.targetingPolicy = targetingPolicy;
|
||||
}
|
||||
|
||||
public bool CanTarget(BattleParticipant participant) {
|
||||
return this.targetingPolicy.CanTarget(participant);
|
||||
}
|
||||
|
||||
public IEnumerator ChooseTarget() {
|
||||
while (this.participantClicked == null) {
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyParticipantSpriteClicked(BattleParticipant paticipant) {
|
||||
this.participantClicked = paticipant;
|
||||
}
|
||||
|
||||
public BattleParticipant GetTarget() {
|
||||
return this.participantClicked;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue