private void Cleanup() { currentData = null; currentBehaviour = new HotbarActionBehaviour();; currentDirection = Vector3.zero; builder = null; }
void IActionHandler.HandleActionStateChanged( IUser user, ActionState oldState, ActionState newState, BaseActionData actionData) { MixedRealityExtensionApp app; if (!_appRef.TryGetTarget(out app)) { return; } var actionPerformed = new ActionPerformed() { UserId = user.Id, TargetId = _attachedActorId, BehaviorType = _behaviorType, ActionName = _actionName, ActionState = newState, ActionData = actionData }; app.EventManager.QueueLateEvent(new BehaviorEvent(actionPerformed)); }
protected void UpdateAction(BaseActionData actionData) { foreach (var userActionState in _userActionStates) { if (userActionState.Value != ActionState.Stopped) { Handler?.HandleActionPerforming(userActionState.Key, actionData); } } }
public void StartAction(Entity parent, BindableActions selectedAction) { //skills should only be cast from here if (!CharacterActions[selectedAction].CanCast(parent.unitData.ValueContainer)) { return; } builder = CharacterActions[selectedAction].builder; currentData = builder.ReturnActionData(); currentBehaviour = builder.ReturnHotbarBehaviour(parent.unitData.ValueContainer); currentDirection = new Vector3(parent.facingDirection.x, parent.facingDirection.y, 0); //set direction }
protected void ChangeState(IUser user, ActionState newState, BaseActionData actionData) { if (user == null) { throw new ArgumentNullException("User cannot be null when performing an action"); } ActionState oldState = ActionState.Stopped; if (_userActionStates.TryGetValue(user, out oldState)) { _userActionStates[user] = newState; } else { _userActionStates.Add(user, newState); } ActionStateChanging?.Invoke(this, new ActionStateChangedArgs(user.Id, oldState, newState)); Handler?.HandleActionStateChanged(user, oldState, newState, actionData); ActionStateChanged?.Invoke(this, new ActionStateChangedArgs(user.Id, oldState, newState)); }
void IActionHandler.HandleActionPerforming(IUser user, BaseActionData actionData) { ((IActionHandler)this).HandleActionStateChanged(user, ActionState.Performing, ActionState.Performing, actionData); }
internal void HandleActionPerforming(IUser user, BaseActionData actionData) { HandleActionStateChanged(user, ActionState.Performing, ActionState.Performing, actionData); }