// Update is called once per frame override protected void UpdateUnit() { IAllyUnitState state; state = unitTargetingState.CheckChangeState(this, _playManager); if (state != null) { unitTargetingState = state; } unitTargetingState.Update(this, _playManager); state = unitState.CheckChangeState(this, _playManager); if (state != null) { unitState = state; } unitState.Update(this, _playManager); UpdateSelectionTarget(); if (_selectLine && (unitTarget || pointTarget.HasValue)) { _selectLine.positionCount = 2; _selectLine.SetPosition(0, transform.position); _selectLine.SetPosition(1, unitTarget ? unitTarget.transform.position : pointTarget.Value); } if (_pointTargetMarkInstance && pointTarget.HasValue) { _pointTargetMarkInstance.transform.position = pointTarget.Value; } base.UpdateUnit(); }
// Start is called before the first frame update override protected void StartUnit() { base.StartUnit(); _selectLine = GetComponent <LineRenderer>(); unitState = new IdleAllyUnitState(); unitTargetingState = new ClosestTargetingAllyUnitState(); }