// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (buffer == null) { buffer = animator.GetComponent <ActionBuffer> (); } }
void Awake() { unitPathFinding = GetComponent <UnitPathFinding> (); buffer = GetComponent <ActionBuffer> (); aManager = GetComponent <AbilityManager> (); rangeState = RangeFromPlayer.OUTOFRANGE; }
private void Start() { actionBuffer = new List <ManipulationAction>(); dataBuffer = new List <List <LabeledData> >(); positionBuffer = new List <Vector3>(); rotationBuffer = new List <Quaternion>(); colorBuffer = new List <int>(); actionBufferInstance = this; }
void Start() { animator = GetComponent <Animator> (); buffer = GetComponent <ActionBuffer> (); layerMask = LayerMask.GetMask("Input"); aManager = GetComponent <AbilityManager> (); gear = GetComponent <Gear> (); interactor = GetComponent <Interact> (); inventory = GetComponent <Inventory> (); }
/// <summary> /// Buffers a call to the underlying action. /// </summary> /// <param name="arguments">The arguments.</param> public void Run(params object[] arguments) { lock (_action) { if (_buffer == null) { _buffer = new ActionBuffer(this); } _buffer.Add(arguments); } }
/// <summary> /// Disposes the specified instance. /// </summary> /// <param name="disposing">Whether this is disposing or finalizing.</param> /// <remarks> /// <para><paramref name="disposing"/> indicates whether the method was invoked from the /// <see cref="IDisposable.Dispose"/> implementation or from the finalizer. The implementation should check the /// parameter before accessing other reference objects. Such objects should only be accessed when the method /// is called from the <see cref="IDisposable.Dispose"/> implementation (when the <paramref name="disposing"/> /// parameter is equal to <see langword="true"/>). If the method is invoked from the finalizer /// (disposing is false), other objects should not be accessed. The reason is that objects are finalized in an /// unpredictable order and so they, or any of their dependencies, might already have been finalized.</para> /// </remarks> protected void Dispose(bool disposing) { if (!disposing) { return; } lock (_action) { ActionBuffer buffer = Interlocked.Exchange(ref _buffer, null); buffer?.Dispose(); } }
public void TestPersistence() { var actions1 = new ActionBuffer(CreateParameters(), storage); actions1.Add(CreateParameters()); var actions2 = new ActionBuffer(CreateParameters(), storage); Assert.That(actions2.Count, Is.EqualTo(1)); Assert.That(actions1.CreateOutbox(), Does.Contain("requests")); Assert.That(actions2.CreateOutbox(), Does.Contain("requests")); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (buffer == null) { buffer = animator.GetComponent <ActionBuffer> (); } if (damaged == null) { damaged = new List <IDamageable> (); } if (aManager == null) { aManager = animator.GetComponent <AbilityManager> (); } if (stats == null) { stats = animator.GetComponent <CharacterStats> (); } damaged.Clear(); ability = null; }
public void TestOutbox() { var actions = new ActionBuffer(CreateParameters(), storage); actions.Add(CreateParameters()); Assert.That(actions.Count, Is.EqualTo(1)); var outbox = actions.CreateOutbox(); Assert.That(outbox, Does.Contain("requests")); Assert.That(actions.Count, Is.EqualTo(1)); actions.Add(CreateParameters()); Assert.That(actions.Count, Is.EqualTo(2)); actions.ClearOutbox(); Assert.That(actions.Count, Is.EqualTo(1)); outbox = actions.CreateOutbox(); actions.ClearOutbox(); Assert.That(actions.Count, Is.EqualTo(0)); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (aManager == null) { aManager = animator.GetComponent <AbilityManager>(); } if (buffer == null) { buffer = animator.GetComponent <ActionBuffer> (); } if (movement == null) { movement = animator.GetComponent <Movement> (); } if (rB == null) { rB = animator.GetComponent <Rigidbody> (); } aManager.SetCurrentlyCasting(buffer.Action); movement.StartCoroutine(movement.MoveRotation(buffer.RotationBuffer, rotationSpeed)); buffer.ConsumeAction(); animator.SetInteger("Action", 0); }
public void Awake() { player = ReInput.players.GetPlayer(playerId); actionBuffer = new ActionBuffer(); }
/// <summary> /// Buffers a call to the underlying action. /// </summary> /// <param name="arguments">The arguments.</param> public void Run(params object[] arguments) { lock (_action) { if (_buffer == null) _buffer = new ActionBuffer(this); _buffer.Add(arguments); } }