VZRSH4U473FCZOP5EXURPXXN5J6F3ZLT435YY7A2JHLG2ZZB5KLQC
577EKAKIUP5R4STCPLRNJT6IJR6G232FAJ2T7DSCK2LOJZ5EG55QC
4JF2MUNF23IFAVVECZNP3JJLFPEB36V7FDRQOKIZNF6Q2FAGOFRQC
IFN4UDLTN7TD26CPONDCRHW4G3DJEXEYV62ZHZC4QD7DKJ76JAEQC
CD5FF75KTOBTMVMTMCKMR6F5DFKOF26I5K43ITNHGBI3ZAZHA4RAC
5I5QA3YK5G5QQCXMSDOEAX3A74LVXV7PYWAIHMLFANR2GUFWMKGQC
NZIEX6J6Q6DSJKNSCTHNIA6EJDQEGMK3ZSP3LKX2UAEDHURQPRVQC
NDNQ6AAKGOI4GFSYCT2H7ZAXNGAOXRER5DOSIO7PWNY7HYTCYD4AC
QAZ3YAYCPNY45B4NZDRONZ5RHAYNAKDG7PZUNHUHAVU2LTJ5XCVAC
7PYVWF7I4JWTDZ5M7Q5BCKGEICUXHXKWEYQB4OGUXZE5VBJ45PBQC
SXUEBCCDPGKZIWBSRNELNL75BHYDNWLWXU6QOKYWIWFPLWTOIHHQC
2TL7WPKMS754ZKG3HYVMURQ5DIZJMUOGGIFFRHK6NX7KBIPRPTJAC
KBOT5YUY4FDPAKAAHBUDE6XHHW3EUDPLEKRRUTYPAYB7TNGLZNHQC
XF52N4U7HWXOF4PDSCR7LCUENLTSXLWEZGS2IJ6562KYI567Z2GAC
4PLSNSVW4VOQW5ZXXZGUWB56WI33SXTGWOCD7PNE36OWDGD7NRJAC
XIPU27GAVXMAKDP42DDSYNA6DSN5WBHH6AG4EK6YIIM43AQQHQAAC
DIEGZM3YMQCKTQW3NLESFZBOGMWW6FT6TZOUL7IUAJD2X5IISUYAC
MDJQTAONL4M7SFFORMXLJHA7WBDTDTRZAZ544JR23SODSCWSVZ3AC
LTG4LQJEMFY22QOI6E5HM3U4OE3JCYRFJ6VGW3KI3AFTMHZCTWRAC
FIMVA3BI72IWMBRN5T3PKDCKSJW667BH25INKDWSPWGHLRKCNAPAC
S6LIARO3HIMP67ZDRIPPU3NC4GM6JQQODDIFGZH5HBN75JHFFSQAC
MNQAZILY2KCL4TQRVIHDZT3IBVF2636GC5BCZPR2YA76C4JI353QC
O236B5LO6PHJ4TPZGYXDVSLB5EGXXRRLYYVWI46DPL5LEGXEIHZQC
M3YG7SBTVP5RPIHG2OU4KL55YLWTAITUAU7JB5DZ525O7CBSPH3QC
KPPOCAKQU7R77PJZITQIVAWZNCFWYKCCLCIRY4CYFDELDQ3NFT6AC
R5JJA7VQ5HCQ6TZEFMORFMPYBXTMIOBAH6YMDCG4QZKBJZCQLR4AC
MML56TWYWB6SUY5JEWHG2PNLAH3JY72PGCEXIGOYE54EAC2WSWBAC
DTKCWM4J7PFNWAAES3RZHQGDA6PTDNX4TZVOXAKF5V7LCZBI3XUAC
CXQW7UICWDJFL3M44O2XVH6JNCRDGRBMPMYR2LEGFJCANPG4YASAC
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public WeaponEquippedArgs(Weapon weapon, Weaver weaver) {
Weapon = weapon;
Weaver = weaver;
}
}
public CombatFormEquippedArgs(CombatForm combatForm, Weaver weaver) {
CombatForm = combatForm;
Weaver = weaver;
}
}
public class CombatFormEquippedArgs : EventArgs
{
public CombatForm CombatForm { get; }
public Weaver Weaver { get; }
public class Weaver : MonoBehaviour
{
[SerializeField] Inventory _inventory;
[SerializeField] List<CombatFormRef> _knownForms;
Weapon _equippedWeapon;
CombatForm _equippedForm;
Dictionary<Weapon, CombatForm> _preferedCombatFormByWeapon = new Dictionary<Weapon, CombatForm>();
bool _isWeaving;
public static event EventHandler<WeaponEquippedArgs> OnWeaponEquipped;
public static event EventHandler<CombatFormEquippedArgs> OnCombatFormEquipped;
private void Start() {
EquipAnyWeapon();
}
private void EquipAnyWeapon() {
_equippedWeapon = _inventory.GetAvailableWeapons().First();
}
}
private void SetCombatForm(CombatForm combatForm) {
_equippedForm = combatForm;
OnCombatFormEquipped?.Invoke(this, new CombatFormEquippedArgs(_equippedForm, this));
}
private void EquipPreferredCombatFormOfWeapon(Weapon weapon) {
_preferedCombatFormByWeapon.TryGetValue(weapon, out CombatForm tryEquipForm);
SetCombatForm(tryEquipForm);
public bool TryDrawWeapon(string weaponName) {
bool isWeaponInInventory = false;
if (_inventory) {
isWeaponInInventory = _inventory.TryGetWeaponByName(weaponName, out Weapon tryEquipWeapon);
if (isWeaponInInventory) {
_equippedWeapon = tryEquipWeapon;
OnWeaponEquipped?.Invoke(this, new WeaponEquippedArgs(_equippedWeapon, this));
EquipPreferredCombatFormOfWeapon(_equippedWeapon);
}
return isWeaponInInventory;
}
public bool TryEquipCombatForm(string combatFormName) {
CombatForm combatForm = GetAvailableCombatFormsForEquipedWeapon().Where(combatForm => combatForm.name == combatFormName).FirstOrDefault();
_preferedCombatFormByWeapon[_equippedWeapon] = combatForm;
SetCombatForm(combatForm);
return (combatForm != null);
}
public void PrintEquipedWeaponDebug() {
if (_equippedWeapon != null) {
var sb = new System.Text.StringBuilder();
sb.Append(String.Format($"PrintEquipedWeaponDebug (equipedWeapon = {_equippedWeapon.name})"));
foreach (var form in _equippedWeapon.GetCompatibleForms()) {
sb.Append(String.Format($", (form = {form.name})"));
}
print(sb);
sb.Clear();
sb.Append(String.Format($"PrintEquipedWeaponDebug knownForms = ("));
foreach (var form in _knownForms) {
sb.Append(String.Format($" {form.name}"));
}
sb.Append(" )");
print(sb);
}
}
public IEnumerable<Weapon> GetWeaponsInInventory() => _inventory.GetAvailableWeapons();
public IEnumerable<CombatForm> GetAvailableCombatFormsForEquipedWeapon() => _knownForms.Select(combatFormRef => combatFormRef.Value).Intersect(_equippedWeapon.GetCompatibleForms());
public Weapon EquippedWeapon => _equippedWeapon;
public CombatForm EquippedForm => _equippedForm;
}
_isWeaving = false;
}
}
public bool TryQueueWeave(RuneWeaving weaving) {
bool weaveQueued;
if (true) {
weaveQueued = true;
if (!_isWeaving) {
StartCoroutine(Weave(weaving));
_isWeaving = true;
}
}
return weaveQueued;
}
IEnumerator Weave(RuneWeaving weaving) {
// Just started Weaving, not advancing right now
const float maxWeavingTime = 10f;
float weavingTime = 0f;
weaving.Reset();
yield return null;
print("Starting Weave");
// maxWeavingTime in case loop doesn't end...
while (weaving.Advance(Time.deltaTime) && (weavingTime < maxWeavingTime)) {
weavingTime += Time.deltaTime;
yield return null;
}
public class WeaponEquippedArgs : EventArgs
{
public Weapon Weapon { get; }
public Weaver Weaver { get; }
using UnityEngine;
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SelectionIndicator : MonoBehaviour
{
[SerializeField] Transform selectionUI;
// [SerializeField] float scale = 1.25f;
Transform _selected;
void Start()
{
PlayerKeyActions.OnUnitSelected += PlayerKeyActions_OnUnitSelected;
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
}
private void Awake() {
selectionUI.gameObject.SetActive(false);
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs e)
{
SetSelectedTransform(e.PartyMember.transform);
}
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs e)
{
SetSelectedTransform(e.UnitTransform);
}
private void SetSelectedTransform(Transform selected) {
_selected = selected;
selectionUI.gameObject.SetActive(true);
SetUnitVisual(_selected);
}
private void Update() {
SetUnitVisual(_selected);
}
private void SetUnitVisual(Transform selected) {
if (selected) {
Bounds bounds = selected.GetComponent<Renderer>().bounds;
this.transform.position = new Vector3(bounds.center.x, 0, bounds.center.z);
//this.transform.localScale = new Vector3(bounds.size.x, bounds.size.y, bounds.size.z) * scale;
}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class UnitController : MonoBehaviour
{
[SerializeField] Transform selectedUnit;
[SerializeField] NavMeshAgent selectedAgent;
[SerializeField] EventAggregator eventAggregator;
private void Start() {
PlayerKeyActions.OnUnitSelected += PlayerKeyActions_OnUnitSelected;
PlayerKeyActions.OnUnitMove += PlayerKeyActions_OnUnitMove;
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
}
private void WeaponSelectUI_OnWeaponSelected(object sender, WeaponSelectedArgs e)
{
trySelectWeaver.TryDrawWeapon(e.Weapon.name);
}
if (selectedUnit.TryGetComponent(out Weaver trySelectWeaver)) {
WeaponSelectUI.OnWeaponSelected += WeaponSelectUI_OnWeaponSelected;
CombatFormSelectUI.OnCombatFormSelected += CombatFormSelectUI_OnCombatFormSelected;
}
private void CombatFormSelectUI_OnCombatFormSelected(object sender, CombatFormSelectedArgs e)
{
trySelectWeaver.TryEquipCombatForm(e.CombatForm.name);
}
if (selectedUnit.TryGetComponent(out Weaver trySelectWeaver)) {
private void EventAggregator_OnSelectRuneWeavingCast(object sender, WeaveCastArgs e) {
if (selectedUnit != null && selectedUnit.TryGetComponent(out Weaver trySelectWeaver)) {
trySelectWeaver.TryQueueWeave(e.Weave);
}
}
eventAggregator.OnSelectRuneWeavingCast += EventAggregator_OnSelectRuneWeavingCast;
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs)
{
selectedUnit = partyMemberSelectedArgs.PartyMember.transform;
selectedAgent = trySelectAgent;
}
}
private void PlayerKeyActions_OnUnitMove(object sender, UnitMoveArgs unitMoveArgs)
{
if (selectedAgent) {
selectedAgent.destination = unitMoveArgs.Point;
}
}
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
selectedUnit = unitSelectedArgs.UnitTransform;
selectedAgent = trySelectAgent;
} else {
selectedAgent = null;
}
}
}
if (selectedUnit.TryGetComponent(out NavMeshAgent trySelectAgent)) {
if (partyMemberSelectedArgs.PartyMember.TryGetComponent(out NavMeshAgent trySelectAgent)) {
fileFormatVersion: 2
guid: 8858ba606ebfde6458f30a186c8ad28d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeDilationController : MonoBehaviour
{
public float dilationStep = 0.25f;
public const float MaxTimeDilation = 4f;
private const float MinTimeDilation = 0f;
private const int TimeDilationPercision = 2;
private float baseTimeScale;
[SerializeField] EventAggregator eventAggregator;
void Start() {
eventAggregator.OnTimeDilationSpeedUp += PlayerKeyActions_onTimeDilationSpeedUp;
eventAggregator.OnTimeDilationSpeedDown += PlayerKeyActions_onTimeDilationSpeedDown;
eventAggregator.OnTimeDilationSpeedReset += PlayerKeyActions_onTimeDilationSpeedReset;
baseTimeScale = Time.timeScale;
}
void OnDestroy() {
eventAggregator.OnTimeDilationSpeedUp -= PlayerKeyActions_onTimeDilationSpeedUp;
eventAggregator.OnTimeDilationSpeedDown -= PlayerKeyActions_onTimeDilationSpeedDown;
eventAggregator.OnTimeDilationSpeedReset -= PlayerKeyActions_onTimeDilationSpeedReset;
}
private void PlayerKeyActions_onTimeDilationSpeedReset(object sender, EventArgs e)
{
Time.timeScale = baseTimeScale;
}
private void PlayerKeyActions_onTimeDilationSpeedDown(object sender, EventArgs e)
{
Time.timeScale = MathF.Max(MinTimeDilation, MathF.Round(Time.timeScale - dilationStep, TimeDilationPercision));
}
private void PlayerKeyActions_onTimeDilationSpeedUp(object sender, EventArgs e)
{
Time.timeScale = MathF.Min(MaxTimeDilation, MathF.Round(Time.timeScale + dilationStep, TimeDilationPercision));
}
}
fileFormatVersion: 2
guid: ba0a2df10f2516e4299a7014b1202b72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Linq;
[CreateAssetMenu(fileName = "Inventory", menuName = "Combat/Inventory")]
public class Inventory : ScriptableObject {
[SerializeField] List<WeaponRef> availableWeapons;
Dictionary<String, Weapon> _availableWeaponsByName;
private void OnEnable() {
if (availableWeapons?.Any() == true) {
_availableWeaponsByName = availableWeapons.Distinct().ToDictionary(weaponRef => weaponRef.Value.name, weaponRef => weaponRef.Value);
}
}
private void OnDisable() {
if (_availableWeaponsByName != null) {
_availableWeaponsByName.Clear();
}
}
public bool TryGetWeaponByName(string weaponName, out Weapon weapon) {
bool isWeaponInInventory = false;
weapon = null;
if (_availableWeaponsByName != null) {
isWeaponInInventory = _availableWeaponsByName.TryGetValue(weaponName, out weapon);
}
return isWeaponInInventory;
}
public IEnumerable<Weapon> GetAvailableWeapons() => availableWeapons.Select(weaponRef => weaponRef.Value);
}
fileFormatVersion: 2
guid: d6a87c4bb1f209a41aaa2c193053affb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PartyMember : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 75e71a71725d6e349b07a83cb8ab7801
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PartyCompositionArgs : EventArgs {
public IEnumerable<PartyMember> partyMembers{get;}
public PartyCompositionArgs(List<PartyMember> partyMembers) {
this.partyMembers = partyMembers;
}
}
public class Party : MonoBehaviour
{
List<PartyMember> partyMembers;
public event EventHandler<PartyCompositionArgs> OnCompositionChanged;
bool shouldUpdate;
private void Awake() {
partyMembers = new List<PartyMember>();
shouldUpdate = false;
}
void Start()
{
InitParty();
}
private void InitParty()
{
foreach (Transform child in transform)
{
PartyMember partyMember;
if (child.TryGetComponent<PartyMember>(out partyMember))
{
partyMembers.Add(partyMember);
}
}
}
// Update is called once per frame
void Update()
{
if (shouldUpdate) {
OnCompositionChanged?.Invoke(this, new PartyCompositionArgs(partyMembers));
shouldUpdate = false;
}
}
}
shouldUpdate = true;
fileFormatVersion: 2
guid: db6f21e9b0b869942802f67cde95f529
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
[SerializeField] float MoveSpeed = 10f;
[SerializeField] float rotateSpeed = 100f;
private void MoveTransform(Vector3 moveVector) {
transform.position += ((transform.forward * moveVector.z) + (transform.right * moveVector.x)) * Time.unscaledDeltaTime * MoveSpeed;
}
public void MoveForward() {
MoveTransform(Vector3.forward);
}
public void MoveBack() {
MoveTransform(Vector3.back);
}
public void MoveRight() {
MoveTransform(Vector3.right);
}
public void MoveLeft() {
MoveTransform(Vector3.left);
}
private void RotateTransform(Vector3 rotationVector) {
transform.eulerAngles += rotationVector * Time.deltaTime * rotateSpeed;
}
public void RotateLeft() {
RotateTransform(Vector3.up);
}
public void RotateRight() {
RotateTransform(Vector3.down);
}
}
fileFormatVersion: 2
guid: 52f086f408b7f2047b40f24440a73050
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 07f01f81836cb3d488d4164378aa326b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class WeaponEquippedArgs : EventArgs
{
public Weapon Weapon { get; }
public Weaver Weaver { get; }
public WeaponEquippedArgs(Weapon weapon, Weaver weaver) {
Weapon = weapon;
Weaver = weaver;
}
}
public class CombatFormEquippedArgs : EventArgs
{
public CombatForm CombatForm { get; }
public Weaver Weaver { get; }
public CombatFormEquippedArgs(CombatForm combatForm, Weaver weaver) {
CombatForm = combatForm;
Weaver = weaver;
}
}
public class Weaver : MonoBehaviour
{
[SerializeField] Inventory _inventory;
[SerializeField] List<CombatFormRef> _knownForms;
Weapon _equippedWeapon;
CombatForm _equippedForm;
Dictionary<Weapon, CombatForm> _preferedCombatFormByWeapon = new();
bool _isWeaving;
Line<IAction> _ActionLine = new(capacity: 6);
public static event EventHandler<WeaponEquippedArgs> OnWeaponEquipped;
public static event EventHandler<CombatFormEquippedArgs> OnCombatFormEquipped;
private void Start() {
EquipAnyWeapon();
}
private void Update() {
if (!_ActionLine.IsEmpty()) {
if (!_ActionLine[0].Advance()) {
_ActionLine[0].Cancel();
_ActionLine.TryGetFirstOutOfLine(out IAction _);
}
}
}
private void SetCombatForm(CombatForm combatForm) {
_equippedForm = combatForm;
OnCombatFormEquipped?.Invoke(this, new CombatFormEquippedArgs(_equippedForm, this));
}
private void EquipPreferredCombatFormOfWeapon(Weapon weapon) {
_preferedCombatFormByWeapon.TryGetValue(weapon, out CombatForm tryEquipForm);
SetCombatForm(tryEquipForm);
}
private void EquipAnyWeapon() {
_equippedWeapon = _inventory.GetAvailableWeapons().First();
}
public bool TryDrawWeapon(string weaponName) {
bool isWeaponInInventory = false;
if (_inventory) {
isWeaponInInventory = _inventory.TryGetWeaponByName(weaponName, out Weapon tryEquipWeapon);
if (isWeaponInInventory) {
_equippedWeapon = tryEquipWeapon;
OnWeaponEquipped?.Invoke(this, new WeaponEquippedArgs(_equippedWeapon, this));
EquipPreferredCombatFormOfWeapon(_equippedWeapon);
}
}
return isWeaponInInventory;
}
public bool TryEquipCombatForm(string combatFormName) {
CombatForm combatForm = GetAvailableCombatFormsForEquipedWeapon().Where(combatForm => combatForm.name == combatFormName).FirstOrDefault();
_preferedCombatFormByWeapon[_equippedWeapon] = combatForm;
SetCombatForm(combatForm);
return combatForm != null;
}
public void PrintEquipedWeaponDebug() {
if (_equippedWeapon != null) {
var sb = new System.Text.StringBuilder();
sb.Append(String.Format($"PrintEquipedWeaponDebug (equipedWeapon = {_equippedWeapon.name})"));
foreach (var form in _equippedWeapon.GetCompatibleForms()) {
sb.Append(String.Format($", (form = {form.name})"));
}
print(sb);
sb.Clear();
sb.Append(String.Format($"PrintEquipedWeaponDebug knownForms = ("));
foreach (var form in _knownForms) {
sb.Append(String.Format($" {form.name}"));
}
sb.Append(" )");
print(sb);
}
}
public bool TryQueueWeave(RuneWeaving weaving, Transform target) {
WeaveAction weaveAction = new(this,weaving,target,2);
bool success = _ActionLine.TryWaitInLine(weaveAction);
return success;
}
public bool TryQueueFollow(Transform target) {
FollowAction followAction = new(this, target, 2);
bool success = _ActionLine.TryWaitInLine(followAction);
return success;
}
public Weapon EquippedWeapon => _equippedWeapon;
public CombatForm EquippedForm => _equippedForm;
public IEnumerable<Weapon> GetWeaponsInInventory() => _inventory.GetAvailableWeapons();
public IEnumerable<CombatForm> GetAvailableCombatFormsForEquipedWeapon() => _knownForms.Select(combatFormRef => combatFormRef.Value).Intersect(_equippedWeapon.GetCompatibleForms());
}
fileFormatVersion: 2
guid: d6a87c4bb1f209a41aaa2c193053affb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PartyMember : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 75e71a71725d6e349b07a83cb8ab7801
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PartyCompositionArgs : EventArgs {
public IEnumerable<PartyMember> partyMembers{get;}
public PartyCompositionArgs(List<PartyMember> partyMembers) {
this.partyMembers = partyMembers;
}
}
public class Party : MonoBehaviour
{
List<PartyMember> partyMembers;
public event EventHandler<PartyCompositionArgs> OnCompositionChanged;
bool shouldUpdate;
private void Awake() {
partyMembers = new List<PartyMember>();
shouldUpdate = false;
}
void Start()
{
InitParty();
}
private void InitParty()
{
foreach (Transform child in transform)
{
PartyMember partyMember;
if (child.TryGetComponent<PartyMember>(out partyMember))
{
partyMembers.Add(partyMember);
}
}
shouldUpdate = true;
}
// Update is called once per frame
void Update()
{
if (shouldUpdate) {
OnCompositionChanged?.Invoke(this, new PartyCompositionArgs(partyMembers));
shouldUpdate = false;
}
}
}
fileFormatVersion: 2
guid: ba0a2df10f2516e4299a7014b1202b72
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Linq;
[CreateAssetMenu(fileName = "Inventory", menuName = "Combat/Inventory")]
public class Inventory : ScriptableObject {
[SerializeField] List<WeaponRef> availableWeapons;
Dictionary<String, Weapon> _availableWeaponsByName;
private void OnEnable() {
if (availableWeapons?.Any() == true) {
_availableWeaponsByName = availableWeapons.Distinct().ToDictionary(weaponRef => weaponRef.Value.name, weaponRef => weaponRef.Value);
}
}
private void OnDisable() {
if (_availableWeaponsByName != null) {
_availableWeaponsByName.Clear();
}
}
public bool TryGetWeaponByName(string weaponName, out Weapon weapon) {
bool isWeaponInInventory = false;
weapon = null;
if (_availableWeaponsByName != null) {
isWeaponInInventory = _availableWeaponsByName.TryGetValue(weaponName, out weapon);
}
return isWeaponInInventory;
}
public IEnumerable<Weapon> GetAvailableWeapons() => availableWeapons.Select(weaponRef => weaponRef.Value);
}
fileFormatVersion: 2
guid: 3ad19603638de4044bef31348978d2c1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4d326ebc15accee48b1e6ad5ff1bdeaa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class WeaveAction : IAction
{
FollowAction _followAction;
Transform _target;
Weaver _weaver;
RuneWeaving _runeWeaving;
float _range;
bool _startedWeaving = false;
public WeaveAction(Weaver unit, RuneWeaving runeWeaving, Transform target, float range) {
if (range < 0) {
throw new ArgumentException("Cannot be < 0", "range");
}
_followAction = new(unit, target, range);
_target = target;
_range = range;
_weaver = unit;
_runeWeaving = runeWeaving;
}
public bool Advance() {
bool isAdvanced;
isAdvanced = _followAction.Advance();
if (Vector3.Distance(_weaver.transform.position, _target.position) > _range) {
if (_startedWeaving) {
Debug.Log("Target escaped");
isAdvanced = false;
}
}
else {
if (_startedWeaving == false) {
Debug.Log("Target got in range, weaving");
}
_startedWeaving = true;
isAdvanced = _runeWeaving.Advance(Time.deltaTime);
}
return isAdvanced;
}
public bool Cancel() {
bool success;
success = _followAction.Cancel();
_runeWeaving.Reset();
return success;
}
}
fileFormatVersion: 2
guid: 5a1c3686db271cc4bb71c4be7e01b7ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
// using System.Collections;
// using System.Collections.Generic;
// using UnityEngine;
public interface IAction
{
public bool Advance();
// public bool Halt();
public bool Cancel();
}
fileFormatVersion: 2
guid: 9de5e2e8f490ef44b8aa823e7917c32b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class FollowAction : IAction
{
Transform _target;
Vector3 _lastTargetPosition;
NavMeshAgent _agent;
float _originalStoppingDistance;
public FollowAction(Weaver unit, Transform target, float stoppingDistance) {
_target = target ?? throw new ArgumentNullException("targetToFollow");
if (unit == null) {
throw new ArgumentNullException("unit");
}
if (stoppingDistance < 0) {
throw new ArgumentException("Cannot be < 0", "stoppingDistance");
}
if (unit.TryGetComponent(out _agent) == false) {
throw new ArgumentException("Missing NavMeshAgent", "unit");
}
_lastTargetPosition = _target.position;
_originalStoppingDistance = _agent.stoppingDistance;
_agent.stoppingDistance = stoppingDistance;
_agent.SetDestination(_lastTargetPosition);
_agent.isStopped = false;
}
public bool Advance() {
if (_lastTargetPosition != _target.position) {
_lastTargetPosition = _target.position;
_agent.SetDestination(_lastTargetPosition);
}
return _agent.pathPending || _agent.remainingDistance > _agent.stoppingDistance;
}
public bool Cancel() {
_agent.isStopped = true;
_agent.stoppingDistance = _originalStoppingDistance;
_agent.ResetPath();
return true;
}
}
public RuneWeavingBank runeWeavingBank;
public WeaveNavigator weaveNavigator;
public TMP_InputField weaveName;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleSaveWeave();
break;
case PointerEventData.InputButton.Right:
break;
public class WeaveSaveClicker : MonoBehaviour, IPointerClickHandler
{
public RuneWeavingBank runeWeavingBank;
public WeaveNavigator weaveNavigator;
public TMP_InputField weaveName;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleSaveWeave();
break;
case PointerEventData.InputButton.Right:
break;
}
public RuneWeavingBank watchedRuneWeavingBank;
public EventAggregator eventAggregator;
TMP_Dropdown _weaveDropDown;
void Awake() {
_weaveDropDown = GetComponent<TMP_Dropdown>();
}
public class WeavePicker : MonoBehaviour
{
public RuneWeavingBank watchedRuneWeavingBank;
public EventAggregator eventAggregator;
TMP_Dropdown _weaveDropDown;
void Awake() {
_weaveDropDown = GetComponent<TMP_Dropdown>();
}
void FillWeaveDropDown() {
_weaveDropDown.ClearOptions();
_weaveDropDown.AddOptions(watchedRuneWeavingBank.GetWeaves().Select(weave => new TMP_Dropdown.OptionData(weave.weaveName)).ToList());
}
void FillWeaveDropDown() {
_weaveDropDown.ClearOptions();
_weaveDropDown.AddOptions(watchedRuneWeavingBank.GetWeaves().Select(weave => new TMP_Dropdown.OptionData(weave.weaveName)).ToList());
}
public GameObject TimeCounterNodeTemplate;
public RectTransform TimeCounterTransform;
public GameObject MartialSequenceNodeTemplate;
public RectTransform MartialSequenceTransform;
public GameObject RuneBindingSequenceNodeTemplate;
public RectTransform RuneBindingSequenceTransform;
public class WeaveNavigator : MonoBehaviour
{
public GameObject TimeCounterNodeTemplate;
public RectTransform TimeCounterTransform;
public GameObject MartialSequenceNodeTemplate;
public RectTransform MartialSequenceTransform;
public GameObject RuneBindingSequenceNodeTemplate;
public RectTransform RuneBindingSequenceTransform;
readonly List<GameObject> _timeSequenceNodes = new();
readonly List<MartialSequenceClicker> _martialSequence = new();
float _martialSequenceTime;
readonly List<GameObject> _timeSequenceNodes = new();
readonly List<MartialSequenceClicker> _martialSequence = new();
float _martialSequenceTime;
readonly List<RuneBindingSequenceClicker> _runeBindingSequence = new();
float _runeBindingSequenceTime;
VerticalLayoutGroup scrollLayoutGroup;
readonly List<RuneBindingSequenceClicker> _runeBindingSequence = new();
float _runeBindingSequenceTime;
VerticalLayoutGroup scrollLayoutGroup;
void UpdateScrollLayoutGroup() {
scrollLayoutGroup.spacing += 0.01f;
if (scrollLayoutGroup.spacing > 0.01f) {
scrollLayoutGroup.spacing = 0f;
void UpdateScrollLayoutGroup() {
scrollLayoutGroup.spacing += 0.01f;
if (scrollLayoutGroup.spacing > 0.01f) {
scrollLayoutGroup.spacing = 0f;
}
void UpdateTimeSequenceNodes() {
if (_martialSequenceTime > _timeSequenceNodes.Count) {
GameObject timeNode = Instantiate(TimeCounterNodeTemplate, TimeCounterTransform);
TextMeshProUGUI secLabel = timeNode.GetComponentInChildren<TextMeshProUGUI>();
void UpdateTimeSequenceNodes() {
if (_martialSequenceTime > _timeSequenceNodes.Count) {
GameObject timeNode = Instantiate(TimeCounterNodeTemplate, TimeCounterTransform);
TextMeshProUGUI secLabel = timeNode.GetComponentInChildren<TextMeshProUGUI>();
secLabel.text = (_timeSequenceNodes.Count + 1).ToString();
_timeSequenceNodes.Add(timeNode);
timeNode.SetActive(true);
secLabel.text = (_timeSequenceNodes.Count + 1).ToString();
_timeSequenceNodes.Add(timeNode);
timeNode.SetActive(true);
}
else if (_martialSequenceTime + 1 < _timeSequenceNodes.Count) {
GameObject timeNodeToRemove = _timeSequenceNodes[^1];
_timeSequenceNodes.RemoveAt(_timeSequenceNodes.Count - 1);
Destroy(timeNodeToRemove.gameObject);
}
else if (_martialSequenceTime + 1 < _timeSequenceNodes.Count) {
GameObject timeNodeToRemove = _timeSequenceNodes[^1];
_timeSequenceNodes.RemoveAt(_timeSequenceNodes.Count - 1);
Destroy(timeNodeToRemove.gameObject);
}
}
void AddMoveToSequence(CombatMove move) {
GameObject combatMoveNode = Instantiate(MartialSequenceNodeTemplate, MartialSequenceTransform);
TextMeshProUGUI nameLabel = combatMoveNode.GetComponentInChildren<TextMeshProUGUI>();
MartialSequenceClicker martialSequenceClicker = combatMoveNode.GetComponent<MartialSequenceClicker>();
void AddMoveToSequence(CombatMove move) {
GameObject combatMoveNode = Instantiate(MartialSequenceNodeTemplate, MartialSequenceTransform);
TextMeshProUGUI nameLabel = combatMoveNode.GetComponentInChildren<TextMeshProUGUI>();
MartialSequenceClicker martialSequenceClicker = combatMoveNode.GetComponent<MartialSequenceClicker>();
martialSequenceClicker.CombatMove = move;
_martialSequence.Add(martialSequenceClicker);
_martialSequenceTime += move.speed;
UpdateTimeSequenceNodes();
}
void RemoveMoveFromSequence(int positionInSequence) {
MartialSequenceClicker martialSequenceClicker = _martialSequence[positionInSequence];
_martialSequenceTime -= martialSequenceClicker.CombatMove.speed;
void RemoveMoveFromSequence(int positionInSequence) {
MartialSequenceClicker martialSequenceClicker = _martialSequence[positionInSequence];
_martialSequenceTime -= martialSequenceClicker.CombatMove.speed;
_martialSequence.RemoveAt(positionInSequence);
UpdateTimeSequenceNodes();
}
void AddRuneToSequence(Rune rune) {
GameObject runeBindingNode = Instantiate(RuneBindingSequenceNodeTemplate, RuneBindingSequenceTransform);
TextMeshProUGUI nameLabel = runeBindingNode.GetComponentInChildren<TextMeshProUGUI>();
RuneBindingSequenceClicker runeBindingSequenceClicker = runeBindingNode.GetComponent<RuneBindingSequenceClicker>();
RectTransform runeBindingNodeTransform = runeBindingNode.GetComponent<RectTransform>();
void AddRuneToSequence(Rune rune) {
GameObject runeBindingNode = Instantiate(RuneBindingSequenceNodeTemplate, RuneBindingSequenceTransform);
TextMeshProUGUI nameLabel = runeBindingNode.GetComponentInChildren<TextMeshProUGUI>();
RuneBindingSequenceClicker runeBindingSequenceClicker = runeBindingNode.GetComponent<RuneBindingSequenceClicker>();
RectTransform runeBindingNodeTransform = runeBindingNode.GetComponent<RectTransform>();
runeBindingSequenceClicker.Rune = rune;
_runeBindingSequence.Add(runeBindingSequenceClicker);
_runeBindingSequenceTime += rune.speed;
runeBindingSequenceClicker.Rune = rune;
_runeBindingSequence.Add(runeBindingSequenceClicker);
_runeBindingSequenceTime += rune.speed;
runeBindingNodeTransform.sizeDelta *= rune.speed;
nameLabel.text = rune.name;
runeBindingNode.SetActive(true);
}
runeBindingNodeTransform.sizeDelta *= rune.speed;
nameLabel.text = rune.name;
runeBindingNode.SetActive(true);
}
void RemoveRuneFromSequence(int positionInSequence) {
RuneBindingSequenceClicker runeBindingSequenceClicker = _runeBindingSequence[positionInSequence];
_runeBindingSequenceTime -= runeBindingSequenceClicker.Rune.speed;
void RemoveRuneFromSequence(int positionInSequence) {
RuneBindingSequenceClicker runeBindingSequenceClicker = _runeBindingSequence[positionInSequence];
_runeBindingSequenceTime -= runeBindingSequenceClicker.Rune.speed;
_runeBindingSequence.RemoveAt(positionInSequence);
Destroy(runeBindingSequenceClicker.gameObject);
}
public bool CanAddMove(CombatMove move) {
return move != null;
}
public bool CanRemoveMove(int positionInSequence) {
return (positionInSequence < _martialSequence.Count) &&
(_runeBindingSequenceTime <= _martialSequenceTime - _martialSequence[positionInSequence].CombatMove.speed + 0.01f);
public bool CanAddMove(CombatMove move) {
return move != null;
}
public bool CanRemoveMove(int positionInSequence) {
return (positionInSequence < _martialSequence.Count) &&
(_runeBindingSequenceTime <= _martialSequenceTime - _martialSequence[positionInSequence].CombatMove.speed + 0.01f);
}
}
public bool TryRemoveMove(MartialSequenceClicker clicker) {
int positionInSequence = _martialSequence.IndexOf(clicker);
bool moveRemovedFromSequence = false;
if (CanRemoveMove(positionInSequence)) {
RemoveMoveFromSequence(positionInSequence);
UpdateScrollLayoutGroup();
moveRemovedFromSequence = true;
}
public bool TryRemoveMove(MartialSequenceClicker clicker) {
int positionInSequence = _martialSequence.IndexOf(clicker);
bool moveRemovedFromSequence = false;
if (CanRemoveMove(positionInSequence)) {
RemoveMoveFromSequence(positionInSequence);
UpdateScrollLayoutGroup();
moveRemovedFromSequence = true;
return moveRemovedFromSequence;
public bool TryAddMove(CombatMove move) {
bool moveAddedToSequence = false;
if (CanAddMove(move)) {
AddMoveToSequence(move);
UpdateScrollLayoutGroup();
moveAddedToSequence = true;
public bool CanAddRune(Rune rune) {
return rune != null && _runeBindingSequenceTime + rune.speed <= _martialSequenceTime + 0.01f;
public bool CanRemoveRune(int positionInSequence) {
return positionInSequence < _runeBindingSequence.Count;
}
public bool TryRemoveRune(RuneBindingSequenceClicker clicker) {
int positionInSequence = _runeBindingSequence.IndexOf(clicker);
bool runeRemovedFromSequence = false;
if (CanRemoveRune(positionInSequence)) {
RemoveRuneFromSequence(positionInSequence);
UpdateScrollLayoutGroup();
runeRemovedFromSequence = true;
}
public bool TryRemoveRune(RuneBindingSequenceClicker clicker) {
int positionInSequence = _runeBindingSequence.IndexOf(clicker);
bool runeRemovedFromSequence = false;
if (CanRemoveRune(positionInSequence)) {
RemoveRuneFromSequence(positionInSequence);
UpdateScrollLayoutGroup();
runeRemovedFromSequence = true;
return runeRemovedFromSequence;
}
public bool TryAddRune(Rune rune) {
bool runeAddedToSequence = false;
if (CanAddRune(rune)) {
AddRuneToSequence(rune);
UpdateScrollLayoutGroup();
runeAddedToSequence = true;
}
return runeAddedToSequence;
return runeRemovedFromSequence;
}
public bool TryAddRune(Rune rune) {
bool runeAddedToSequence = false;
if (CanAddRune(rune)) {
AddRuneToSequence(rune);
public void Clear() {
for (var i = _runeBindingSequence.Count - 1; i >= 0; i--) {
RemoveRuneFromSequence(i);
}
for (var i = _martialSequence.Count - 1; i >= 0; i--) {
RemoveMoveFromSequence(i);
}
public void Clear() {
for (var i = _runeBindingSequence.Count - 1; i >= 0; i--) {
RemoveRuneFromSequence(i);
}
for (var i = _martialSequence.Count - 1; i >= 0; i--) {
RemoveMoveFromSequence(i);
}
UpdateScrollLayoutGroup();
}
public void Reload(RuneWeavingContainer weaveToLoad) {
Clear();
foreach (var combatMove in weaveToLoad.runeWeaving.martialSequence.GetSequence()) {
AddMoveToSequence(combatMove);
}
public void Reload(RuneWeavingContainer weaveToLoad) {
Clear();
foreach (var combatMove in weaveToLoad.runeWeaving.martialSequence.GetSequence()) {
AddMoveToSequence(combatMove);
foreach (var rune in weaveToLoad.runeWeaving.runeBindingSequence.GetSequence()) {
AddRuneToSequence(rune);
}
UpdateScrollLayoutGroup();
foreach (var rune in weaveToLoad.runeWeaving.runeBindingSequence.GetSequence()) {
AddRuneToSequence(rune);
public RuneWeaving GenerateWeave() {
return new RuneWeaving(_martialSequence.Select(clicker => clicker.CombatMove),
_runeBindingSequence.Select(clicker => clicker.Rune));
UpdateScrollLayoutGroup();
}
public RuneWeaving GenerateWeave() {
return new RuneWeaving(_martialSequence.Select(clicker => clicker.CombatMove),
_runeBindingSequence.Select(clicker => clicker.Rune));
public WeaveNavigator weaveNavigator;
public RuneWeavingBank runeWeavingBank;
public TMP_Dropdown weavePicker;
public class WeaveLoadClicker : MonoBehaviour, IPointerClickHandler
{
public WeaveNavigator weaveNavigator;
public RuneWeavingBank runeWeavingBank;
public TMP_Dropdown weavePicker;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleLoadWeave();
break;
case PointerEventData.InputButton.Right:
break;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleLoadWeave();
break;
case PointerEventData.InputButton.Right:
break;
}
void HandleLoadWeave() {
if (ValidWeaveName.TryParse(weavePicker.options[weavePicker.value].text, out ValidWeaveName validWeaveName)) {
if (runeWeavingBank.TryGetWeaveByName(validWeaveName, out RuneWeavingContainer runeWeavingContainer)) {
weaveNavigator.Reload(runeWeavingContainer);
void HandleLoadWeave() {
if (ValidWeaveName.TryParse(weavePicker.options[weavePicker.value].text, out ValidWeaveName validWeaveName)) {
if (runeWeavingBank.TryGetWeaveByName(validWeaveName, out RuneWeavingContainer runeWeavingContainer)) {
weaveNavigator.Reload(runeWeavingContainer);
}
public RuneWeavingBank runeWeavingBank;
public TMP_Dropdown weavePicker;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleDeleteWeave();
break;
case PointerEventData.InputButton.Right:
break;
public class WeaveDeleteClicker : MonoBehaviour, IPointerClickHandler
{
public RuneWeavingBank runeWeavingBank;
public TMP_Dropdown weavePicker;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleDeleteWeave();
break;
case PointerEventData.InputButton.Right:
break;
}
bool HandleDeleteWeave() {
bool deletedFromBank = false;
if (ValidWeaveName.TryParse(weavePicker.options[weavePicker.value].text, out ValidWeaveName validWeaveName)) {
deletedFromBank = runeWeavingBank.TryDeleteWeaveByName(validWeaveName);
bool HandleDeleteWeave() {
bool deletedFromBank = false;
if (ValidWeaveName.TryParse(weavePicker.options[weavePicker.value].text, out ValidWeaveName validWeaveName)) {
deletedFromBank = runeWeavingBank.TryDeleteWeaveByName(validWeaveName);
}
return deletedFromBank;
public WeaveNavigator WeaveNavigator;
public TMP_InputField weaveName;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleClearWeave();
break;
case PointerEventData.InputButton.Right:
break;
public class WeaveClearClicker : MonoBehaviour, IPointerClickHandler
{
public WeaveNavigator WeaveNavigator;
public TMP_InputField weaveName;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleClearWeave();
break;
case PointerEventData.InputButton.Right:
break;
}
}
void HandleClearWeave() {
WeaveNavigator.Clear();
weaveName.text = "";
public EventAggregator eventAggregator;
bool _show = false;
Canvas _weaveBuilderScreen;
void Start() {
_weaveBuilderScreen = transform.GetComponent<Canvas>();
SetVisibility(_show);
eventAggregator.OnToggleWeaveBuilderScreen += EventAggregator_onToggleWeaveBuilderScreen;
}
private void EventAggregator_onToggleWeaveBuilderScreen(object sender, EventArgs e)
[RequireComponent(typeof(Canvas))]
public class WeaveBuilderScreenToggle : MonoBehaviour
_show = !_show;
SetVisibility(_show);
}
public EventAggregator eventAggregator;
bool _show = false;
Canvas _weaveBuilderScreen;
void Start() {
_weaveBuilderScreen = transform.GetComponent<Canvas>();
SetVisibility(_show);
eventAggregator.OnToggleWeaveBuilderScreen += EventAggregator_onToggleWeaveBuilderScreen;
}
private void SetVisibility(bool visible) {
_weaveBuilderScreen.gameObject.SetActive(_show);
private void EventAggregator_onToggleWeaveBuilderScreen(object sender, EventArgs e) {
_show = !_show;
SetVisibility(_show);
}
private void SetVisibility(bool visible) {
_weaveBuilderScreen.gameObject.SetActive(_show);
}
_weaponDropDown = GetComponent<TMP_Dropdown>();
}
public Inventory availableWeapons;
public CombatFormPicker combatFormPicker;
TMP_Dropdown _weaponDropDown;
void Awake() {
_weaponDropDown = GetComponent<TMP_Dropdown>();
}
void Start() {
FillWeaponDropDown();
_weaponDropDown.onValueChanged.AddListener(delegate {
WeaponDropDownValueChanged(_weaponDropDown);
});
}
void Start() {
FillWeaponDropDown();
_weaponDropDown.onValueChanged.AddListener(delegate {
WeaponDropDownValueChanged(_weaponDropDown);
});
}
void FillWeaponDropDown() {
_weaponDropDown.ClearOptions();
_weaponDropDown.AddOptions(availableWeapons.GetAvailableWeapons().Select(weapon => new TMP_Dropdown.OptionData(weapon.name)).ToList());
WeaponDropDownValueChanged(_weaponDropDown);
}
void FillWeaponDropDown() {
_weaponDropDown.ClearOptions();
_weaponDropDown.AddOptions(availableWeapons.GetAvailableWeapons().Select(weapon => new TMP_Dropdown.OptionData(weapon.name)).ToList());
WeaponDropDownValueChanged(_weaponDropDown);
}
void WeaponDropDownValueChanged(TMP_Dropdown change) {
string selectedWeaponName = change.options[change.value].text;
var weapon = availableWeapons.GetAvailableWeapons().Where(weapon => weapon.name == selectedWeaponName).First();
combatFormPicker.onSelectedWeapon(weapon);
void WeaponDropDownValueChanged(TMP_Dropdown change) {
string selectedWeaponName = change.options[change.value].text;
var weapon = availableWeapons.GetAvailableWeapons().Where(weapon => weapon.name == selectedWeaponName).First();
combatFormPicker.onSelectedWeapon(weapon);
}
[SerializeField] TextMeshProUGUI runeName;
[SerializeField] TextMeshProUGUI runeCastTime;
[SerializeField] Image runeImage;
public class RuneDescriptionUI : MonoBehaviour
{
[SerializeField] TextMeshProUGUI runeName;
[SerializeField] TextMeshProUGUI runeCastTime;
[SerializeField] Image runeImage;
public void OnRuneLeftClicked(RuneRef runeRef) {
runeImage.sprite = runeRef.RuneSprite;
runeName.text = runeRef.rune.name;
runeCastTime.text = runeRef.rune.speed.ToString() + " Seconds";
public void OnRuneLeftClicked(RuneRef runeRef) {
runeImage.sprite = runeRef.RuneSprite;
runeName.text = runeRef.rune.name;
runeCastTime.text = runeRef.rune.speed.ToString() + " Seconds";
}
public int GridLocation { get; set; }
[SerializeField] PopulateRuneGrid runeGridParent;
[RequireComponent(typeof(Image))]
public class RuneClicker : MonoBehaviour, IPointerClickHandler
{
public int GridLocation { get; set; }
[SerializeField] PopulateRuneGrid runeGridParent;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleRuneViewInfo();
break;
case PointerEventData.InputButton.Right:
HandleRuneAddToSequence();
break;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleRuneViewInfo();
break;
case PointerEventData.InputButton.Right:
HandleRuneAddToSequence();
break;
}
[SerializeField] WeaveNavigator _weaveNavigator;
public Rune Rune {get; set;}
public class RuneBindingSequenceClicker : MonoBehaviour, IPointerClickHandler
{
[SerializeField] WeaveNavigator _weaveNavigator;
public Rune Rune { get; set; }
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
break;
case PointerEventData.InputButton.Right:
HandleRuneBindingSequenceNodeRemove();
break;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
break;
case PointerEventData.InputButton.Right:
HandleRuneBindingSequenceNodeRemove();
break;
}
public GameObject runeImagePrefab;
[SerializeField] WeaveNavigator _weaveNavigator;
[SerializeField] Canvas runeDescriptionCanvas;
RuneDescriptionUI _runeDescriptionUI;
public RuneBank RunesBank;
readonly List<RuneClicker> gridItems = new();
bool _isSelected;
int _currentSelectedGridLocation;
public class PopulateRuneGrid : MonoBehaviour
{
public GameObject runeImagePrefab;
[SerializeField] WeaveNavigator _weaveNavigator;
[SerializeField] Canvas runeDescriptionCanvas;
RuneDescriptionUI _runeDescriptionUI;
public RuneBank RunesBank;
readonly List<RuneClicker> gridItems = new();
bool _isSelected;
int _currentSelectedGridLocation;
private void PopulateGrid() {
foreach (var (runeRef, index) in RunesBank.Runes.Select((runeRef, index)=>(runeRef, index))) {
GameObject runeImageObject = Instantiate(runeImagePrefab, transform);
if (runeImageObject.TryGetComponent(out RuneClicker runeClicker) && runeImageObject.TryGetComponent(out Image runeImage)) {
runeImage.sprite = runeRef.RuneSprite;
runeClicker.GridLocation = index;
gridItems.Add(runeClicker);
runeImageObject.SetActive(true);
private void PopulateGrid() {
foreach (var (runeRef, index) in RunesBank.Runes.Select((runeRef, index) => (runeRef, index))) {
GameObject runeImageObject = Instantiate(runeImagePrefab, transform);
if (runeImageObject.TryGetComponent(out RuneClicker runeClicker) && runeImageObject.TryGetComponent(out Image runeImage)) {
runeImage.sprite = runeRef.RuneSprite;
runeClicker.GridLocation = index;
gridItems.Add(runeClicker);
runeImageObject.SetActive(true);
}
}
public void OnRuneViewInfo(int gridLocation) {
Outline outline;
if (_isSelected == true) {
public void OnRuneViewInfo(int gridLocation) {
Outline outline;
if (_isSelected == true) {
if (gridItems[_currentSelectedGridLocation].TryGetComponent<Outline>(out outline)) {
outline.enabled = false;
}
}
SetSelectedGridLocation(gridLocation);
public void OnRuneAddToSequence(int gridLocation) {
_weaveNavigator.TryAddRune(RunesBank.Runes[gridLocation]);
}
public void OnRuneAddToSequence(int gridLocation) {
_weaveNavigator.TryAddRune(RunesBank.Runes[gridLocation]);
}
public GameObject MovePickUIPrefab;
public RectTransform Content;
public WeaveNavigator WeaveNavigator;
Weapon _selectedWeapon;
CombatForm _selectedCombatForm;
Image currentSelected;
public class MovePicker : MonoBehaviour
{
public GameObject MovePickUIPrefab;
public RectTransform Content;
public WeaveNavigator WeaveNavigator;
Weapon _selectedWeapon;
CombatForm _selectedCombatForm;
Image currentSelected;
void ClearGrid() {
foreach (Transform move in Content) {
if (move.gameObject.activeSelf == true) {
Destroy(move.gameObject);
void ClearGrid() {
foreach (Transform move in Content) {
if (move.gameObject.activeSelf == true) {
Destroy(move.gameObject);
}
private void PopulateGrid(Weapon weapon, CombatForm combatForm) {
CombatMoveSet formedMoveSet = combatForm.FormedMoveSet(weapon.GetCombatMoveSet());
foreach (var move in formedMoveSet.CombatMoves()) {
GameObject movePickUIObject = Instantiate(MovePickUIPrefab, Content);
TextMeshProUGUI moveNameLabel = movePickUIObject.GetComponentInChildren<TextMeshProUGUI>();
if (moveNameLabel != null) {
moveNameLabel.text = move.moveName;
}
if (movePickUIObject.TryGetComponent<MoveClicker>(out MoveClicker moveClicker)) {
moveClicker.Move = move;
private void PopulateGrid(Weapon weapon, CombatForm combatForm) {
CombatMoveSet formedMoveSet = combatForm.FormedMoveSet(weapon.GetCombatMoveSet());
foreach (var move in formedMoveSet.CombatMoves()) {
GameObject movePickUIObject = Instantiate(MovePickUIPrefab, Content);
TextMeshProUGUI moveNameLabel = movePickUIObject.GetComponentInChildren<TextMeshProUGUI>();
if (moveNameLabel != null) {
moveNameLabel.text = move.moveName;
}
if (movePickUIObject.TryGetComponent<MoveClicker>(out MoveClicker moveClicker)) {
moveClicker.Move = move;
}
movePickUIObject.SetActive(true);
movePickUIObject.SetActive(true);
public void OnSelectedCombatForm(Weapon weapon, CombatForm combatForm) {
_selectedCombatForm = combatForm;
_selectedWeapon = weapon;
if ((_selectedWeapon != null) && (_selectedCombatForm != null)) {
ClearGrid();
PopulateGrid(_selectedWeapon, _selectedCombatForm);
}
public void OnSelectedCombatForm(Weapon weapon, CombatForm combatForm) {
_selectedCombatForm = combatForm;
_selectedWeapon = weapon;
if ((_selectedWeapon != null) && (_selectedCombatForm != null)) {
ClearGrid();
PopulateGrid(_selectedWeapon, _selectedCombatForm);
}
}
public void OnSelectedMove(MoveClicker moveClicker) {
if (currentSelected != null) {
currentSelected.color = Color.white;
}
public void OnSelectedMove(MoveClicker moveClicker) {
if (currentSelected != null) {
currentSelected.color = Color.white;
if (moveClicker.TryGetComponent<Image>(out currentSelected)) {
currentSelected.color = Color.green;
}
if (moveClicker.TryGetComponent<Image>(out currentSelected)) {
currentSelected.color = Color.green;
public void OnMoveAddToSequence(MoveClicker moveClicker) {
WeaveNavigator.TryAddMove(moveClicker.Move);
public CombatMove Move { get; set; }
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleMoveViewInfo();
break;
case PointerEventData.InputButton.Right:
HandleMoveAddToSequence();
break;
public CombatMove Move { get; set; }
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleMoveViewInfo();
break;
case PointerEventData.InputButton.Right:
HandleMoveAddToSequence();
break;
}
[SerializeField] WeaveNavigator _weaveNavigator;
public CombatMove CombatMove{get; set;}
public class MartialSequenceClicker : MonoBehaviour, IPointerClickHandler
{
[SerializeField] WeaveNavigator _weaveNavigator;
public CombatMove CombatMove { get; set; }
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
break;
case PointerEventData.InputButton.Right:
HandleMartialSequenceNodeRemove();
break;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
break;
case PointerEventData.InputButton.Right:
HandleMartialSequenceNodeRemove();
break;
}
public List<CombatFormRef> availableCombatForms;
public MovePicker movePicker;
Weapon _selectedWeapon;
TMP_Dropdown _CombatFormDropDown;
[RequireComponent(typeof(TMP_Dropdown))]
public class CombatFormPicker : MonoBehaviour
{
public List<CombatFormRef> availableCombatForms;
public MovePicker movePicker;
Weapon _selectedWeapon;
TMP_Dropdown _CombatFormDropDown;
void Awake() {
_CombatFormDropDown = GetComponent<TMP_Dropdown>();
_CombatFormDropDown.onValueChanged.AddListener(delegate {
void Awake() {
_CombatFormDropDown = GetComponent<TMP_Dropdown>();
_CombatFormDropDown.onValueChanged.AddListener(delegate {
CombatFormDropDownValueChanged(_CombatFormDropDown);
});
}
void FillCombatFormDropDown() {
_CombatFormDropDown.ClearOptions();
_CombatFormDropDown.AddOptions(
_selectedWeapon.GetCompatibleForms()
.Intersect(availableCombatForms.Select(combatFormRef => combatFormRef.Value))
.Select(CombatForm => new TMP_Dropdown.OptionData(CombatForm.name))
.ToList());
});
}
void FillCombatFormDropDown() {
_CombatFormDropDown.ClearOptions();
_CombatFormDropDown.AddOptions(
_selectedWeapon.GetCompatibleForms()
.Intersect(availableCombatForms.Select(combatFormRef => combatFormRef.Value))
.Select(CombatForm => new TMP_Dropdown.OptionData(CombatForm.name))
.ToList());
CombatFormDropDownValueChanged(_CombatFormDropDown);
}
}
public void onSelectedWeapon(Weapon weapon) {
_selectedWeapon = weapon;
if (_selectedWeapon != null) {
FillCombatFormDropDown();
public void onSelectedWeapon(Weapon weapon) {
_selectedWeapon = weapon;
if (_selectedWeapon != null) {
FillCombatFormDropDown();
}
}
void CombatFormDropDownValueChanged(TMP_Dropdown change) {
string selectedCombatFormName = change.options[change.value].text;
var combatFormRef = availableCombatForms.Where(combatFormRef => combatFormRef.Value.name == selectedCombatFormName).First();
movePicker.OnSelectedCombatForm(_selectedWeapon, combatFormRef.Value);
void CombatFormDropDownValueChanged(TMP_Dropdown change) {
string selectedCombatFormName = change.options[change.value].text;
var combatFormRef = availableCombatForms.Where(combatFormRef => combatFormRef.Value.name == selectedCombatFormName).First();
movePicker.OnSelectedCombatForm(_selectedWeapon, combatFormRef.Value);
}
fileFormatVersion: 2
guid: 3aece7ec3518c814c85789e97e119251
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: a699a146bf45e8041878140cecfdfebc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TargetIndicator : MonoBehaviour
{
[SerializeField] Transform selectionUI;
// [SerializeField] float scale = 1.25f;
Transform _selected;
public EventAggregator eventAggregator;
void Awake() {
selectionUI.gameObject.SetActive(false);
}
void OnDestroy() {
eventAggregator.OnUnitTargeted -= EventAggregator_OnUnitTargeted;
}
void Update() {
SetUnitVisual(_selected);
}
void Start() {
eventAggregator.OnUnitTargeted += EventAggregator_OnUnitTargeted;
}
void EventAggregator_OnUnitTargeted(object sender, UnitActionArgs e) {
SetSelectedTransform(e.UnitTransform);
}
void SetSelectedTransform(Transform selected) {
_selected = selected;
selectionUI.gameObject.SetActive(true);
SetUnitVisual(_selected);
}
void SetUnitVisual(Transform selected) {
if (selected) {
Bounds bounds = selected.GetComponent<Renderer>().bounds;
transform.position = new Vector3(bounds.center.x, 0, bounds.center.z);
//this.transform.localScale = new Vector3(bounds.size.x, bounds.size.y, bounds.size.z) * scale;
}
}
}
fileFormatVersion: 2
guid: 9db3f23d55c4f0c41a9fe89266d3533f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using TagFighter.UI;
using UnityEngine;
public class SelectionIndicator : MonoBehaviour
{
[SerializeField] Transform selectionUI;
// [SerializeField] float scale = 1.25f;
Transform _selected;
void Awake() {
selectionUI.gameObject.SetActive(false);
}
void OnDestroy() {
}
void Update() {
SetUnitVisual(_selected);
}
void Start() {
PlayerKeyActions.OnUnitSelected += PlayerKeyActions_OnUnitSelected;
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
}
void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs e) {
SetSelectedTransform(e.PartyMember.transform);
}
void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs e) {
SetSelectedTransform(e.UnitTransform);
}
void SetSelectedTransform(Transform selected) {
_selected = selected;
selectionUI.gameObject.SetActive(true);
SetUnitVisual(_selected);
}
void SetUnitVisual(Transform selected) {
if (selected) {
Bounds bounds = selected.GetComponent<Renderer>().bounds;
transform.position = new Vector3(bounds.center.x, 0, bounds.center.z);
//this.transform.localScale = new Vector3(bounds.size.x, bounds.size.y, bounds.size.z) * scale;
}
}
}
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped += Weaver_OnWeaponEquipped;
}
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped += Weaver_OnWeaponEquipped;
}
private void Weaver_OnWeaponEquipped(object sender, WeaponEquippedArgs e) {
string weaponName = e.Weapon == null ? "":e.Weapon.name;
SetSelectedWeaponByName(weaponName);
}
private void Weaver_OnWeaponEquipped(object sender, WeaponEquippedArgs e) {
string weaponName = e.Weapon == null ? "" : e.Weapon.name;
SetSelectedWeaponByName(weaponName);
}
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
Clear();
if ((unitSelectedArgs.UnitTransform.GetComponent<PartyMember>() != null) && unitSelectedArgs.UnitTransform.TryGetComponent<Weaver>(out var weaver)) {
CreateWeaponSelectionButtons(weaver);
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
Clear();
if ((unitSelectedArgs.UnitTransform.GetComponent<PartyMember>() != null) && unitSelectedArgs.UnitTransform.TryGetComponent<Weaver>(out var weaver)) {
CreateWeaponSelectionButtons(weaver);
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs) {
Clear();
if (partyMemberSelectedArgs.PartyMember.TryGetComponent<Weaver>(out var weaver)) {
CreateWeaponSelectionButtons(weaver);
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs) {
Clear();
if (partyMemberSelectedArgs.PartyMember.TryGetComponent<Weaver>(out var weaver)) {
CreateWeaponSelectionButtons(weaver);
}
private void CreateWeaponSelectionButtons(Weaver weaver) {
foreach (var weapon in weaver.GetWeaponsInInventory()) {
var weaponSelectUI = Instantiate(weaponSelectUIPrefab, transform).GetComponent<WeaponSelectUI>();
weaponSelectUI.SetWeapon(weapon);
private void CreateWeaponSelectionButtons(Weaver weaver) {
foreach (var weapon in weaver.GetWeaponsInInventory()) {
var weaponSelectUI = Instantiate(weaponSelectUIPrefab, transform).GetComponent<WeaponSelectUI>();
weaponSelectUI.SetWeapon(weapon);
}
SetSelectedWeaponByName(weaver.EquippedWeapon.name);
private void SetSelectedWeaponByName(string weaponName) {
foreach (Transform weaponButtonTransform in transform) {
var weaponSelectUI = weaponButtonTransform.GetComponent<WeaponSelectUI>();
if (weaponSelectUI.GetWeaponName() == weaponName) {
weaponSelectUI.SetSelected();
} else {
weaponSelectUI.SetNotSelected();
private void SetSelectedWeaponByName(string weaponName) {
foreach (Transform weaponButtonTransform in transform) {
var weaponSelectUI = weaponButtonTransform.GetComponent<WeaponSelectUI>();
if (weaponSelectUI.GetWeaponName() == weaponName) {
weaponSelectUI.SetSelected();
}
else {
weaponSelectUI.SetNotSelected();
}
PartyMemberPortrait.OnPartyMemberSelected -= PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped -= Weaver_OnWeaponEquipped;
PartyMemberPortrait.OnPartyMemberSelected -= PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped -= Weaver_OnWeaponEquipped;
}
[SerializeField] Button weaponButton;
[SerializeField] TextMeshProUGUI weaponName;
[SerializeField] Color selectedColor = Color.green;
[SerializeField] Color notSelectedColor = Color.grey;
Weapon _weapon;
public static event EventHandler<WeaponSelectedArgs> OnWeaponSelected;
public class WeaponSelectUI : MonoBehaviour
{
[SerializeField] Button weaponButton;
[SerializeField] TextMeshProUGUI weaponName;
[SerializeField] Color selectedColor = Color.green;
[SerializeField] Color notSelectedColor = Color.grey;
Weapon _weapon;
public static event EventHandler<WeaponSelectedArgs> OnWeaponSelected;
public void SetSelected() {
weaponButton.GetComponent<Outline>().effectColor = selectedColor;
}
public void SetNotSelected() {
weaponButton.GetComponent<Outline>().effectColor = notSelectedColor;
}
public void SetWeapon(Weapon weapon) {
_weapon = weapon;
SetWeaponName(_weapon.name);
weaponButton.onClick.AddListener(() => {
OnWeaponSelected?.Invoke(this, new WeaponSelectedArgs(_weapon));
});
}
public string GetWeaponName() => _weapon.name;
public void SetSelected() {
weaponButton.GetComponent<Outline>().effectColor = selectedColor;
}
public void SetNotSelected() {
weaponButton.GetComponent<Outline>().effectColor = notSelectedColor;
}
public void SetWeapon(Weapon weapon) {
_weapon = weapon;
SetWeaponName(_weapon.name);
weaponButton.onClick.AddListener(() => {
OnWeaponSelected?.Invoke(this, new WeaponSelectedArgs(_weapon));
});
}
public string GetWeaponName() => _weapon.name;
private void SetWeaponName(string weaponName) {
this.weaponName.text = weaponName;
}
private void OnDestroy() {
weaponButton.onClick.RemoveAllListeners();
private void SetWeaponName(string weaponName) {
this.weaponName.text = weaponName;
}
private void OnDestroy() {
weaponButton.onClick.RemoveAllListeners();
}
public Transform weaveSelectButtonTemplate;
public RuneWeavingBank watchedRuneWeavingBank;
public EventAggregator eventAggregator;
public class RuneWeaveView : MonoBehaviour
{
public Transform weaveSelectButtonTemplate;
public RuneWeavingBank watchedRuneWeavingBank;
public EventAggregator eventAggregator;
void CreateWeaveSelectionButtons(RuneWeavingBank bank) {
foreach (var weave in bank.GetWeaves()) {
var runeWeaveSelectUI = Instantiate(weaveSelectButtonTemplate, transform).GetComponent<RuneWeaveSelectUI>();
runeWeaveSelectUI.SetRuneWeave(weave);
private void EventAggregator_OnRuneWeavingBankChanged(object sender, RuneWeavingBankChangedArgs e) {
if (watchedRuneWeavingBank == e.Bank) {
Clear();
CreateWeaveSelectionButtons(watchedRuneWeavingBank);
}
}
void Clear() {
// Making sure to skip the template
foreach (Transform item in transform)
{
if (item.GetComponent<RuneWeaveSelectUI>() != null) {
Destroy(item.gameObject);
void CreateWeaveSelectionButtons(RuneWeavingBank bank) {
foreach (var weave in bank.GetWeaves()) {
var runeWeaveSelectUI = Instantiate(weaveSelectButtonTemplate, transform).GetComponent<RuneWeaveSelectUI>();
runeWeaveSelectUI.SetRuneWeave(weave);
}
}
void Clear() {
// Making sure to skip the template
foreach (Transform item in transform) {
if (item.GetComponent<RuneWeaveSelectUI>() != null) {
Destroy(item.gameObject);
}
public TextMeshProUGUI weaveName;
private RuneWeavingContainer _runeWeave;
public EventAggregator eventAggregator;
public class RuneWeaveSelectUI : MonoBehaviour, IPointerClickHandler
{
public TextMeshProUGUI weaveName;
private RuneWeavingContainer _runeWeave;
public EventAggregator eventAggregator;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleSelectWeave();
break;
case PointerEventData.InputButton.Right:
break;
public void OnPointerClick(PointerEventData eventData) {
switch (eventData.button) {
case PointerEventData.InputButton.Left:
HandleSelectWeave();
break;
case PointerEventData.InputButton.Right:
break;
}
void HandleSelectWeave() {
eventAggregator.InvokeOnSelectRuneWeavingCast(this, new WeaveCastArgs(_runeWeave.runeWeaving));
}
void HandleSelectWeave() {
eventAggregator.InvokeOnSelectRuneWeavingCast(this, new WeaveCastArgs(_runeWeave.runeWeaving));
}
[SerializeField] Transform partyMemberPortraitPrefab;
[SerializeField] Party partyToDisplay;
private void Start() {
partyToDisplay.OnCompositionChanged += Party_OnCompositionChanged;
PlayerKeyActions.OnUnitSelected += PlayerKeyActions_OnUnitSelected;
public class PartyView : MonoBehaviour
{
[SerializeField] Transform partyMemberPortraitPrefab;
[SerializeField] Party partyToDisplay;
foreach (var partyMember in partyCompositionArgs.partyMembers) {
Transform partyMemberPortraitTransform = Instantiate(partyMemberPortraitPrefab, transform);
PartyMemberPortrait partyMemberPortrait = partyMemberPortraitTransform.GetComponent<PartyMemberPortrait>();
partyMemberPortrait.SetPartyMember(partyMember);
private void Party_OnCompositionChanged(object sender, PartyCompositionArgs partyCompositionArgs) {
foreach (Transform partyMemberPortrait in transform) {
Destroy(partyMemberPortrait.gameObject);
}
foreach (var partyMember in partyCompositionArgs.partyMembers) {
Transform partyMemberPortraitTransform = Instantiate(partyMemberPortraitPrefab, transform);
PartyMemberPortrait partyMemberPortrait = partyMemberPortraitTransform.GetComponent<PartyMemberPortrait>();
partyMemberPortrait.SetPartyMember(partyMember);
}
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
PartyMember partyMember;
if (unitSelectedArgs.UnitTransform.TryGetComponent<PartyMember>(out partyMember)) {
SetSelectedPortraitByCharacterName(partyMember.name);
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
PartyMember partyMember;
if (unitSelectedArgs.UnitTransform.TryGetComponent<PartyMember>(out partyMember)) {
SetSelectedPortraitByCharacterName(partyMember.name);
}
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs)
{
SetSelectedPortraitByCharacterName(partyMemberSelectedArgs.PartyMember.name);
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs) {
SetSelectedPortraitByCharacterName(partyMemberSelectedArgs.PartyMember.name);
}
private void SetSelectedPortraitByCharacterName(string characterName) {
foreach (Transform partyMemberPortraitTransform in transform) {
PartyMemberPortrait partyMemberPortrait = partyMemberPortraitTransform.GetComponent<PartyMemberPortrait>();
partyMemberPortrait.SetSelected(partyMemberPortrait.GetPartyMemberName() == characterName);
private void SetSelectedPortraitByCharacterName(string characterName) {
foreach (Transform partyMemberPortraitTransform in transform) {
PartyMemberPortrait partyMemberPortrait = partyMemberPortraitTransform.GetComponent<PartyMemberPortrait>();
partyMemberPortrait.SetSelected(partyMemberPortrait.GetPartyMemberName() == characterName);
}
public void SetPartyMember(PartyMember partyMember) {
this.partyMember = partyMember;
SetPartyMemberName(partyMember.name);
portrait.onClick.AddListener(() => {
OnPartyMemberSelected?.Invoke(this, new PartyMemberSelectedArgs(this.partyMember));
});
}
private void SetPartyMemberName(string partyMemberName) {
characterName.text = partyMemberName;
}
public void SetPartyMember(PartyMember partyMember) {
this.partyMember = partyMember;
SetPartyMemberName(partyMember.name);
portrait.onClick.AddListener(() => {
OnPartyMemberSelected?.Invoke(this, new PartyMemberSelectedArgs(this.partyMember));
});
}
private void SetPartyMemberName(string partyMemberName) {
characterName.text = partyMemberName;
}
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped += Weaver_OnWeaponEquipped;
Weaver.OnCombatFormEquipped += Weaver_OnCombatFormEquipped;
}
void Start() {
Clear();
PlayerKeyActions.OnUnitSelected += PlayerKeyActions_OnUnitSelected;
private void Weaver_OnCombatFormEquipped(object sender, CombatFormEquippedArgs e)
{
string combatFormName = e.CombatForm == null ? "":e.CombatForm.name;
SetSelectedCombatFormByName(combatFormName);
}
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped += Weaver_OnWeaponEquipped;
Weaver.OnCombatFormEquipped += Weaver_OnCombatFormEquipped;
}
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
Clear();
if ((unitSelectedArgs.UnitTransform.GetComponent<PartyMember>() != null) && (unitSelectedArgs.UnitTransform.TryGetComponent<Weaver>(out var weaver))) {
selectedWeaver = weaver;
private void Weaver_OnWeaponEquipped(object sender, WeaponEquippedArgs e) {
Clear();
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs) {
Clear();
if (partyMemberSelectedArgs.PartyMember.TryGetComponent<Weaver>(out var weaver)) {
selectedWeaver = weaver;
CreateCombatFormSelectionButtons(selectedWeaver);
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs unitSelectedArgs) {
Clear();
if ((unitSelectedArgs.UnitTransform.GetComponent<PartyMember>() != null) && (unitSelectedArgs.UnitTransform.TryGetComponent<Weaver>(out var weaver))) {
selectedWeaver = weaver;
CreateCombatFormSelectionButtons(selectedWeaver);
}
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs partyMemberSelectedArgs) {
Clear();
if (partyMemberSelectedArgs.PartyMember.TryGetComponent<Weaver>(out var weaver)) {
selectedWeaver = weaver;
CreateCombatFormSelectionButtons(selectedWeaver);
}
private void CreateCombatFormSelectionButtons(Weaver weaver) {
foreach (var combatForm in weaver.GetAvailableCombatFormsForEquipedWeapon()) {
var combatFormSelectUI = Instantiate(combatFormSelectUIPrefab, transform).GetComponent<CombatFormSelectUI>();
combatFormSelectUI.SetForm(combatForm);
private void CreateCombatFormSelectionButtons(Weaver weaver) {
foreach (var combatForm in weaver.GetAvailableCombatFormsForEquipedWeapon()) {
var combatFormSelectUI = Instantiate(combatFormSelectUIPrefab, transform).GetComponent<CombatFormSelectUI>();
combatFormSelectUI.SetForm(combatForm);
}
if (weaver.EquippedForm != null) {
SetSelectedCombatFormByName(weaver.EquippedForm.name);
}
private void SetSelectedCombatFormByName(string combatFormName) {
foreach (Transform combatFormButtonTransform in transform) {
var combatFormSelectUI = combatFormButtonTransform.GetComponent<CombatFormSelectUI>();
if (combatFormSelectUI.GetCombatFormName() == combatFormName) {
combatFormSelectUI.SetSelected();
} else {
combatFormSelectUI.SetNotSelected();
private void SetSelectedCombatFormByName(string combatFormName) {
foreach (Transform combatFormButtonTransform in transform) {
var combatFormSelectUI = combatFormButtonTransform.GetComponent<CombatFormSelectUI>();
if (combatFormSelectUI.GetCombatFormName() == combatFormName) {
combatFormSelectUI.SetSelected();
}
else {
combatFormSelectUI.SetNotSelected();
}
PartyMemberPortrait.OnPartyMemberSelected -= PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped -= Weaver_OnWeaponEquipped;
Weaver.OnCombatFormEquipped -= Weaver_OnCombatFormEquipped;
PartyMemberPortrait.OnPartyMemberSelected -= PartyMemberPortrait_OnPartyMemberSelected;
Weaver.OnWeaponEquipped -= Weaver_OnWeaponEquipped;
Weaver.OnCombatFormEquipped -= Weaver_OnCombatFormEquipped;
}
[SerializeField] Button combatFormButton;
[SerializeField] TextMeshProUGUI combatFormName;
[SerializeField] Color selectedColor = Color.green;
[SerializeField] Color notSelectedColor = Color.grey;
CombatForm _combatForm;
public static event EventHandler<CombatFormSelectedArgs> OnCombatFormSelected;
public class CombatFormSelectUI : MonoBehaviour
{
[SerializeField] Button combatFormButton;
[SerializeField] TextMeshProUGUI combatFormName;
[SerializeField] Color selectedColor = Color.green;
[SerializeField] Color notSelectedColor = Color.grey;
CombatForm _combatForm;
public static event EventHandler<CombatFormSelectedArgs> OnCombatFormSelected;
public void SetSelected() {
combatFormButton.GetComponent<Outline>().effectColor = selectedColor;
}
public void SetNotSelected() {
combatFormButton.GetComponent<Outline>().effectColor = notSelectedColor;
}
public void SetForm(CombatForm combatForm) {
_combatForm = combatForm;
SetCombatFormName(combatForm.name);
combatFormButton.onClick.AddListener(() => {
OnCombatFormSelected?.Invoke(this, new CombatFormSelectedArgs(_combatForm));
});
}
public string GetCombatFormName() => this.combatFormName.text;
private void SetCombatFormName(string combatFormName) {
this.combatFormName.text = combatFormName;
}
private void OnDestroy() {
combatFormButton.onClick.RemoveAllListeners();
public void SetSelected() {
combatFormButton.GetComponent<Outline>().effectColor = selectedColor;
}
public void SetNotSelected() {
combatFormButton.GetComponent<Outline>().effectColor = notSelectedColor;
}
public void SetForm(CombatForm combatForm) {
_combatForm = combatForm;
SetCombatFormName(combatForm.name);
combatFormButton.onClick.AddListener(() => {
OnCombatFormSelected?.Invoke(this, new CombatFormSelectedArgs(_combatForm));
});
}
public string GetCombatFormName() => this.combatFormName.text;
private void SetCombatFormName(string combatFormName) {
this.combatFormName.text = combatFormName;
}
private void OnDestroy() {
combatFormButton.onClick.RemoveAllListeners();
}
var color = (TagColor)Random.Range(0,3);
tagSystem.ApplyTags(new TaggableUnit[] {tagged}, new TagSlot[] {new TagSlot() {color = color, amount = 1}});
}
var color = (TagColor)Random.Range(0, 3);
tagSystem.ApplyTags(new TaggableUnit[] { tagged }, new TagSlot[] { new TagSlot() { color = color, amount = 1 } });
}
TimeDialationTester timeDialationTester = new TimeDialationTester(eventAggregator);
timeDialationTester.TestTimeDialationSpeedUp();
timeDialationTester.TestTimeDialationSpeedDown();
timeDialationTester.TestTimeDialationSpeedPause();
timeDialationTester.TestTimeDialationSpeedReset();
TimeDialationTester timeDialationTester = new(eventAggregator);
timeDialationTester.TestAll();
LineTester lineTester = new();
lineTester.TestAll();
}
}
}
}
namespace Testing.Line
{
public class LineTester
{
public void TestAll() {
TestWaitInLine();
TestCutInLine();
TestTryRemoveAt();
TestCircularInsert();
}
public void TestWaitInLine() {
string testName = System.Reflection.MethodBase.GetCurrentMethod().Name;
bool anyFail = false;
int insert;
int[] insertArr = { 5, 4, 3, 2, 1 };
Line<int> l = new(insertArr.Length);
foreach (int item in insertArr) {
if (l.TryWaitInLine(item) == false) {
Debug.Log($"<color=red>FAILED: {testName} {item} </color>");
anyFail = true;
}
}
insert = 0;
if (l.TryWaitInLine(insert) == true) {
Debug.Log($"<color=red>FAILED: {testName} {insert} </color>");
anyFail = true;
}
if (!l.TryGetFirstOutOfLine(out int n) || (n != insertArr[0])) {
Debug.Log($"<color=red>FAILED: {testName} TryGetFirstOutOfLine {insertArr[0]} </color>");
anyFail = true;
}
int[] resultArr = { 4, 3, 2, 1 };
int count = 1;
foreach (var item in l) {
if (item != insertArr[count]) {
Debug.Log($"<color=red>FAILED: {testName} foreach {item} != {insertArr[count]} </color>");
anyFail = true;
}
count++;
}
if (count != insertArr.Length) {
Debug.Log($"<color=red>FAILED: {testName} incorrect number of items in Line {count != resultArr.Length}</color>");
anyFail = true;
}
if (anyFail == false) {
Debug.Log($"<color=green>PASSED: {testName} </color>");
}
}
public void TestCutInLine() {
string testName = System.Reflection.MethodBase.GetCurrentMethod().Name;
bool anyFail = false;
int[] insertArr = { 1, 2, 3, 4, 5 };
Line<int> l = new(insertArr.Length);
foreach (int item in insertArr) {
if (l.TryWaitInLine(item) == false) {
Debug.Log($"<color=red>FAILED: {testName} {item} </color>");
anyFail = true;
}
}
int insert = 6;
l.CutInLine(insert);
if (l.TryWaitInLine(insert) == true) {
}
if (!l.TryGetFirstOutOfLine(out int n) || (n != insert)) {
Debug.Log($"<color=red>FAILED: {testName} get out {insert} </color>");
anyFail = true;
}
int[] resultArr = { 1, 2, 3, 4 };
int count = 0;
foreach (var item in l) {
if (item != resultArr[count]) {
Debug.Log($"<color=red>FAILED: {testName} foreach {item} != {resultArr[count]} </color>");
anyFail = true;
}
count++;
}
if (count != resultArr.Length) {
Debug.Log($"<color=red>FAILED: {testName} incorrect number of items in Line {count != resultArr.Length}</color>");
anyFail = true;
public void TestTryRemoveAt() {
string testName = System.Reflection.MethodBase.GetCurrentMethod().Name;
bool anyFail = false;
int[] insertArr = { 1, 2, 3, 4, 5 };
Line<int> l = new(insertArr.Length);
foreach (int item in insertArr) {
if (l.TryWaitInLine(item) == false) {
Debug.Log($"<color=red>FAILED: TryWaitInLine foreach {testName} {item} </color>");
anyFail = true;
}
}
int position = 2;
if (!l.TryRemoveAt(position, out int n) || n != insertArr[position]) {
Debug.Log($"<color=red>FAILED: TryRemoveAt {testName} {insertArr[position]} </color>");
anyFail = true;
}
if (l.TryWaitInLine(insertArr[position]) == false) {
Debug.Log($"<color=red>FAILED: TryWaitInLine {testName} {insertArr[position]} </color>");
anyFail = true;
}
l.CutInLine(insertArr[position]);
int[] resultArr = { 3, 1, 2, 4, 5 };
position = 4;
if (!l.TryRemoveAt(position, out n) || n != resultArr[position]) {
Debug.Log($"<color=red>FAILED: TryRemoveAt {testName} {n} != {resultArr[position]} </color>");
anyFail = true;
}
if (l.TryWaitInLine(insertArr[position]) == false) {
Debug.Log($"<color=red>FAILED: TryWaitInLine {testName} {insertArr[position]} </color>");
anyFail = true;
}
resultArr = new int[]{ 3, 1, 2, 4, insertArr[position] };
if (!l.TryRemoveAt(position, out n) || n != resultArr[position]) {
Debug.Log($"<color=red>FAILED: TryRemoveAt {testName} {n} != {resultArr[position]} </color>");
anyFail = true;
}
resultArr = new int[]{ 3, 1, 2, 4 };
int count = 0;
foreach (var item in l) {
if (item != resultArr[count]) {
Debug.Log($"<color=red>FAILED: {testName} foreach {item} != {resultArr[count]} </color>");
anyFail = true;
}
count++;
}
if (count != resultArr.Length) {
Debug.Log($"<color=red>FAILED: {testName} incorrect number of items in Line {count != resultArr.Length}</color>");
anyFail = true;
}
if (anyFail == false) {
Debug.Log($"<color=green>PASSED: {testName} </color>");
}
}
public void TestCircularInsert() {
string testName = System.Reflection.MethodBase.GetCurrentMethod().Name;
bool anyFail = false;
int[] insertArr = { 1, 2, 3, 4, 5 };
Line<int> l = new(insertArr);
l.TryGetFirstOutOfLine(out int _);
l.TryGetFirstOutOfLine(out int _);
l.TryWaitInLine(6);
l.TryWaitInLine(7);
int[] resultArr = { 3, 4, 5, 6, 7 };
int count = 0;
foreach (var item in l) {
if (item != resultArr[count]) {
Debug.Log($"<color=red>FAILED: {testName} foreach {item} != {resultArr[count]} </color>");
anyFail = true;
}
count++;
}
if (count != resultArr.Length) {
Debug.Log($"<color=red>FAILED: {testName} incorrect number of items in Line {count != resultArr.Length} </color>");
anyFail = true;
}
if (anyFail == false) {
Debug.Log($"<color=green>PASSED: {testName} </color>");
}
}
if (Input.GetKeyDown(KeyCode.Mouse0) && !EventSystem.current.IsPointerOverGameObject()) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (!EventSystem.current.IsPointerOverGameObject()) {
if (Input.GetKeyDown(KeyCode.Mouse0)) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit)) {
Transform objectHit = hit.transform;
if (unitSelectionLayerMask.IsLayerInMask(objectHit.gameObject.layer)) {
OnUnitSelected?.Invoke(this, new UnitActionArgs(objectHit));
// eventAggregator.RaiseOnUnitSelected(this, new UnitActionArgs(objectHit));
}
else if (unitMovementLayerMask.IsLayerInMask(objectHit.gameObject.layer)) {
OnUnitMove?.Invoke(this, new UnitMoveArgs(hit.point));
}
}
}
else if (Input.GetKeyDown(KeyCode.Mouse1)) {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit)) {
Transform objectHit = hit.transform;
if (unitSelectionLayerMask.IsLayerInMask(objectHit.gameObject.layer)) {
OnUnitSelected?.Invoke(this, new UnitActionArgs(objectHit));
// eventAggregator.RaiseOnUnitSelected(this, new UnitActionArgs(objectHit));
} else if (unitMovementLayerMask.IsLayerInMask(objectHit.gameObject.layer)) {
OnUnitMove?.Invoke(this, new UnitMoveArgs(hit.point));
if (Physics.Raycast(ray, out RaycastHit hit)) {
Transform objectHit = hit.transform;
if (unitSelectionLayerMask.IsLayerInMask(objectHit.gameObject.layer)) {
eventAggregator.InvokeOnUnitTargeted(this, new UnitActionArgs(objectHit));
}
fileFormatVersion: 2
guid: 747f2ec20648a6547b0d35b49bee7508
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 6a4c17b7673c3ae439a5cedeaba6a40c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
namespace System.Collections
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
[Serializable]
public class Line<T> : IEnumerable<T>, ICollection
{
private T[] _array;
private int _head; // First valid element in the queue
private int _count; // Number of elements.
private int _version;
[NonSerialized]
private object _syncRoot = new();
public Line(int capacity) {
if (capacity < 1) {
throw new ArgumentOutOfRangeException("capacity", "must be > 0");
}
_array = new T[capacity];
_head = 0;
_count = 0;
}
public Line(IEnumerable<T> collection) {
if (collection == null) {
throw new ArgumentNullException("collection", "cannot be null");
}
_array = new T[collection.Count()];
using IEnumerator<T> en = collection.GetEnumerator();
while (en.MoveNext()) {
TryWaitInLine(en.Current);
}
}
private int PositionInLineToIndex(int position) => (_head + position) % Capacity;
internal T GetElement(int index) {
return _array[PositionInLineToIndex(index)];
}
private int Increment(ref int marker) {
marker++;
if (marker == Capacity) {
marker = 0;
}
return marker;
}
private int Decrement(ref int marker) {
if (marker == 0) {
marker = Capacity;
}
--marker;
return marker;
}
public bool TryWaitInLine(T item) {
bool success = false;
if (_count < Capacity) {
_array[PositionInLineToIndex(_count)] = item;
_count++;
_version++;
success = true;
}
return success;
}
public int Capacity => _array.Length;
public bool IsEmpty() => _count == 0;
public bool IsFull() => _count == Capacity;
public void CutInLine(T item) {
Decrement(ref _head);
_array[_head] = item;
if (_count < Capacity) {
_count++;
}
_version++;
}
public bool TryGetFirstOutOfLine(out T item) {
bool success = false;
if (_count == 0) {
item = default;
}
else {
item = _array[_head];
Increment(ref _head);
_count--;
_version++;
success = true;
}
return success;
}
private void Trim(int position) {
for (int currentPosition = position; currentPosition < _count - 1; currentPosition++) {
_array[PositionInLineToIndex(currentPosition)] = _array[PositionInLineToIndex(currentPosition + 1)];
}
_array[PositionInLineToIndex(_count - 1)] = default;
_count--;
}
public bool TryRemoveAt(int position, out T item) {
bool success = false;
if (_count == 0) {
item = default;
}
else {
if (position == 0) {
success = TryGetFirstOutOfLine(out item);
}
else {
item = _array[PositionInLineToIndex(position)];
Trim(position);
_version++;
success = true;
}
}
return success;
}
public T this[int position] {
get {
if (position >= _count) {
throw new IndexOutOfRangeException("Index out of Line bounds");
}
return _array[PositionInLineToIndex(position)];
}
}
int ICollection.Count => _count;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot {
get {
return _syncRoot;
}
}
public virtual void Clear() {
Array.Clear(_array, 0, Capacity);
_head = 0;
_count = 0;
_version++;
}
public virtual void CopyTo(Array array, int index) {
if (array == null) {
throw new ArgumentNullException("array", "cannot be null");
}
if (array.Rank != 1) {
throw new NotSupportedException("array multidimention not supported");
}
if (array.GetLowerBound(0) != 0) {
throw new NotSupportedException("array lower bound non zero");
}
if (index < 0 || index > array.Length) {
throw new ArgumentOutOfRangeException("index", "out of array range");
}
int numToCopy = Math.Clamp(_count, Capacity - index, _count);
if (numToCopy > 0) {
int firstPart = (Capacity - _head < numToCopy) ? Capacity - _head : numToCopy;
Array.Copy(_array, _head, array, index, firstPart);
numToCopy -= firstPart;
if (numToCopy > 0) {
Array.Copy(_array, 0, array, index + Capacity - _head, numToCopy);
}
}
}
public IEnumerator<T> GetEnumerator() {
return new Enumerator(this);
}
IEnumerator IEnumerable.GetEnumerator() {
return new Enumerator(this);
}
public struct Enumerator : IEnumerator<T>, IEnumerator
{
private readonly Line<T> _line;
private int _index; // -1 = not started, -2 = ended/disposed
private readonly int _version;
private T _currentElement;
internal Enumerator(Line<T> line) {
_line = line;
_version = _line._version;
_index = -1;
_currentElement = default;
}
public T Current {
get {
if (_index < 0) {
if (_index == -1)
throw new InvalidOperationException("enumeration not started");
else
throw new InvalidOperationException("enumeration ended");
}
return _currentElement;
}
}
object IEnumerator.Current {
get {
if (_index < 0) {
if (_index == -1)
throw new InvalidOperationException("enumeration not started");
else
throw new InvalidOperationException("enumeration ended");
}
return _currentElement;
}
}
void IDisposable.Dispose() {
_index = -2;
_currentElement = default;
}
public bool MoveNext() {
if (_version != _line._version) throw new InvalidOperationException("stale cursor, line chaged");
if (_index == -2)
return false;
_index++;
if (_index == _line._count) {
_index = -2;
_currentElement = default;
return false;
}
_currentElement = _line.GetElement(_index);
return true;
}
void IEnumerator.Reset() {
if (_version != _line._version) throw new InvalidOperationException("stale cursor, line chaged");
_index = -1;
_currentElement = default;
}
}
}
}
fileFormatVersion: 2
guid: fbbaab1b77441024c93a777761de08c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: b3c93317b2686664bb3e7d977b996d7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using TagFighter.UI;
using UnityEngine;
using UnityEngine.AI;
public class UnitController : MonoBehaviour
{
[SerializeField] Transform selectedUnit;
[SerializeField] NavMeshAgent selectedAgent;
[SerializeField] EventAggregator eventAggregator;
[SerializeField] Transform targetUnit;
private void Start() {
PlayerKeyActions.OnUnitSelected += PlayerKeyActions_OnUnitSelected;
PlayerKeyActions.OnUnitMove += PlayerKeyActions_OnUnitMove;
eventAggregator.OnUnitTargeted += EventAggregator_InvokeOnUnitTargeted;
PartyMemberPortrait.OnPartyMemberSelected += PartyMemberPortrait_OnPartyMemberSelected;
WeaponSelectUI.OnWeaponSelected += WeaponSelectUI_OnWeaponSelected;
CombatFormSelectUI.OnCombatFormSelected += CombatFormSelectUI_OnCombatFormSelected;
eventAggregator.OnSelectRuneWeavingCast += EventAggregator_OnSelectRuneWeavingCast;
}
private void OnDestroy() {
PlayerKeyActions.OnUnitSelected -= PlayerKeyActions_OnUnitSelected;
PlayerKeyActions.OnUnitMove -= PlayerKeyActions_OnUnitMove;
eventAggregator.OnUnitTargeted -= EventAggregator_InvokeOnUnitTargeted;
PartyMemberPortrait.OnPartyMemberSelected -= PartyMemberPortrait_OnPartyMemberSelected;
WeaponSelectUI.OnWeaponSelected -= WeaponSelectUI_OnWeaponSelected;
CombatFormSelectUI.OnCombatFormSelected -= CombatFormSelectUI_OnCombatFormSelected;
eventAggregator.OnSelectRuneWeavingCast -= EventAggregator_OnSelectRuneWeavingCast;
}
private void EventAggregator_OnSelectRuneWeavingCast(object sender, WeaveCastArgs e) {
if (selectedUnit != null && targetUnit != null && selectedUnit.TryGetComponent(out Weaver trySelectWeaver)) {
trySelectWeaver.TryQueueWeave(e.Weave, targetUnit);
}
}
private void CombatFormSelectUI_OnCombatFormSelected(object sender, CombatFormSelectedArgs e) {
if (selectedUnit.TryGetComponent(out Weaver trySelectWeaver)) {
trySelectWeaver.TryEquipCombatForm(e.CombatForm.name);
}
}
private void WeaponSelectUI_OnWeaponSelected(object sender, WeaponSelectedArgs e) {
if (selectedUnit.TryGetComponent(out Weaver trySelectWeaver)) {
trySelectWeaver.TryDrawWeapon(e.Weapon.name);
}
}
private void PartyMemberPortrait_OnPartyMemberSelected(object sender, PartyMemberSelectedArgs e) {
selectedUnit = e.PartyMember.transform;
if (e.PartyMember.TryGetComponent(out NavMeshAgent trySelectAgent)) {
selectedAgent = trySelectAgent;
}
}
private void EventAggregator_InvokeOnUnitTargeted(object sender, UnitActionArgs e) {
targetUnit = e.UnitTransform;
}
private void PlayerKeyActions_OnUnitMove(object sender, UnitMoveArgs e) {
if (selectedAgent) {
selectedAgent.destination = e.Point;
}
}
private void PlayerKeyActions_OnUnitSelected(object sender, UnitActionArgs e) {
selectedUnit = e.UnitTransform;
if (selectedUnit.TryGetComponent(out NavMeshAgent trySelectAgent)) {
selectedAgent = trySelectAgent;
}
else {
selectedAgent = null;
}
}
}
fileFormatVersion: 2
guid: 8858ba606ebfde6458f30a186c8ad28d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeDilationController : MonoBehaviour
{
public float dilationStep = 0.25f;
public const float MaxTimeDilation = 4f;
private const float MinTimeDilation = 0f;
private const int TimeDilationPercision = 2;
private float baseTimeScale;
[SerializeField] EventAggregator eventAggregator;
void Start() {
eventAggregator.OnTimeDilationSpeedUp += PlayerKeyActions_onTimeDilationSpeedUp;
eventAggregator.OnTimeDilationSpeedDown += PlayerKeyActions_onTimeDilationSpeedDown;
eventAggregator.OnTimeDilationSpeedReset += PlayerKeyActions_onTimeDilationSpeedReset;
eventAggregator.OnTimeDilationSpeedPause += PlayerKeyActions_onTimeDilationSpeedPause;
baseTimeScale = Time.timeScale;
}
void OnDestroy() {
eventAggregator.OnTimeDilationSpeedUp -= PlayerKeyActions_onTimeDilationSpeedUp;
eventAggregator.OnTimeDilationSpeedDown -= PlayerKeyActions_onTimeDilationSpeedDown;
eventAggregator.OnTimeDilationSpeedReset -= PlayerKeyActions_onTimeDilationSpeedReset;
eventAggregator.OnTimeDilationSpeedPause -= PlayerKeyActions_onTimeDilationSpeedPause;
}
private void PlayerKeyActions_onTimeDilationSpeedPause(object sender, EventArgs e) {
Time.timeScale = 0;
}
private void PlayerKeyActions_onTimeDilationSpeedReset(object sender, EventArgs e)
{
Time.timeScale = baseTimeScale;
}
private void PlayerKeyActions_onTimeDilationSpeedDown(object sender, EventArgs e)
{
Time.timeScale = MathF.Max(MinTimeDilation, MathF.Round(Time.timeScale - dilationStep, TimeDilationPercision));
}
private void PlayerKeyActions_onTimeDilationSpeedUp(object sender, EventArgs e)
{
Time.timeScale = MathF.Min(MaxTimeDilation, MathF.Round(Time.timeScale + dilationStep, TimeDilationPercision));
}
}
fileFormatVersion: 2
guid: db6f21e9b0b869942802f67cde95f529
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraController : MonoBehaviour
{
[SerializeField] float MoveSpeed = 10f;
[SerializeField] float rotateSpeed = 100f;
private void MoveTransform(Vector3 moveVector) {
transform.position += ((transform.forward * moveVector.z) + (transform.right * moveVector.x)) * Time.unscaledDeltaTime * MoveSpeed;
}
public void MoveForward() {
MoveTransform(Vector3.forward);
}
public void MoveBack() {
MoveTransform(Vector3.back);
}
public void MoveRight() {
MoveTransform(Vector3.right);
}
public void MoveLeft() {
MoveTransform(Vector3.left);
}
private void RotateTransform(Vector3 rotationVector) {
transform.eulerAngles += rotationVector * Time.deltaTime * rotateSpeed;
}
public void RotateLeft() {
RotateTransform(Vector3.up);
}
public void RotateRight() {
RotateTransform(Vector3.down);
}
}
Debug.Log($"Executing Martial move {combatMoves[currentMoveIdx].moveName} {currentMoveIdx + 1}/{combatMoves.Count} at {currentTime}");
Debug.Log($"Finished executing Martial move {combatMoves[currentMoveIdx].moveName} {currentMoveIdx + 1}/{combatMoves.Count} at {currentTime}");
--- !u!1 &319643048
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 319643050}
- component: {fileID: 319643049}
m_Layer: 0
m_Name: Target Indicator
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &319643049
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 319643048}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a699a146bf45e8041878140cecfdfebc, type: 3}
m_Name:
m_EditorClassIdentifier:
selectionUI: {fileID: 692053296}
eventAggregator: {fileID: 11400000, guid: 7674cb78dbff8d447b6c39984750a2da, type: 2}
--- !u!4 &319643050
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 319643048}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 692053296}
m_Father: {fileID: 0}
m_RootOrder: 16
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &692053295
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 692053296}
- component: {fileID: 692053299}
- component: {fileID: 692053298}
- component: {fileID: 692053297}
m_Layer: 0
m_Name: Quad
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &692053296
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692053295}
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0.01, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 319643050}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!64 &692053297
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692053295}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 0
serializedVersion: 4
m_Convex: 0
m_CookingOptions: 30
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &692053298
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692053295}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 4ff9b376ac12c1648ab1424799f980c2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &692053299
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 692053295}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
fileFormatVersion: 2
guid: 4ff9b376ac12c1648ab1424799f980c2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-4121941433394719604
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 5
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: TargetedIndicatorMaterial
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_ValidKeywords:
- _ENVIRONMENTREFLECTIONS_OFF
- _RECEIVE_SHADOWS_OFF
- _SPECULARHIGHLIGHTS_OFF
- _SPECULAR_SETUP
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 1
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _EnvironmentReflections: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0.5
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 0
- _Smoothness: 0.391
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 0
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 0
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 0.13725491, b: 0.13725491, a: 0.7019608}
- _Color: {r: 1, g: 0.13725486, b: 0.13725486, a: 0.7019608}
- _EmissionColor: {r: 0.37781495, g: 1, b: 0.33490568, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []