34 lines
898 B
C#
34 lines
898 B
C#
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 participant) {
|
|
if (CanTarget(participant)) {
|
|
this.participantClicked = participant;
|
|
}
|
|
}
|
|
|
|
public BattleParticipant GetTarget() {
|
|
return this.participantClicked;
|
|
}
|
|
}
|