Skip to content

Instantly share code, notes, and snippets.

@zonaryFUND
Last active February 2, 2022 15:50
Show Gist options
  • Save zonaryFUND/ae98f07cbe75ead3f41e6d30e04f23f9 to your computer and use it in GitHub Desktop.
Save zonaryFUND/ae98f07cbe75ead3f41e6d30e04f23f9 to your computer and use it in GitHub Desktop.
public class BattleMain: MonoBehaviour {
public event EventHandler<List<UnitInfo>> UnitInfoUpdateHandler;
public SomeBattleProcess() {
// ~~~~何らかの戦闘処理でUnitInfoのリストが更新
UnitInfoUpdateHandler(this, this.unitInfoList);
}
}
////////////////////////////////
public class MapViewManager: MonoBehaviour {
[SerializeField]
BattleMain main;
void Start() {
main.UnitInfoUpdateHandler += this.OnUnitListUpdated;
}
void OnUnitListUpdated(object sender, List<UnitInfo> unitInfoList) {
// Viewの更新処理
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment