IEnumerator ProcessActionQueue(IActionObject actionObject) { bIsProcessingQueue = true; ActionData currentAction; while (ActionQueue.Count > 0) { while (bFreeze || bPaused) { yield return(null); } currentAction = ActionQueue.Dequeue(); switch (currentAction.type) { case ActionType.Move: yield return(actionObject.StartMove(currentAction.direction)); break; case ActionType.Attack: yield return(actionObject.StartAttack(currentAction.direction)); break; case ActionType.Defend: yield return(actionObject.StartDefend()); break; } } bIsProcessingQueue = false; }
public void StartProcessingQueue(IActionObject actionObject) { if (!bIsProcessingQueue) { StartCoroutine(ProcessActionQueue(actionObject)); } }
public virtual IActionObject PickActionObject() { for (Shapes.DiagramShape obj1 = base.View.PickObject(true, false, base.LastInput.DocPoint, false); obj1 != null; obj1 = obj1.Parent) { IActionObject obj2 = obj1 as IActionObject; if ((obj2 != null) && obj2.ActionEnabled) { base.CurrentObject = obj1; return(obj2); } } return(null); }
/// <summary> /// 액션을 추가 /// </summary> /// <param name="Act"></param> public void EnqueueAction(IActionObject Act) { ActionBuffer.Enqueue(Act); }
// Update is called once per frame void Update() { if (!MyBasicBehaviour.FPView) { currentCam = cam; } else { currentCam = camFP; } //Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); //Ray fpsRay = new Ray(FirstViewCamera.gameObject.position, FirstViewCamera.gameObject.transform.forward); //(Camera.main.transform.position, Camera.main.transform.forward); //Ray ray = new Ray(Camera.main.transform.position, Camera.main.transform.forward); Ray ray = currentCam.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; int layerMask = NPCLayer.value; if (!GameControl.isPaused) { // Just an alternative CM enter if (Input.GetButtonDown("CM enter")) { GameControl.CombatMode = !GameControl.CombatMode; AlternativeToggleCombatModeOn(); } if (!GameControl.CombatMode) { // IF WE EVER NEED TO ENTER COMBAT MODE WITH INPUT /* * if (Input.GetButtonDown("Attack") || Input.GetButtonDown("Use Cunning") || Input.GetButtonDown("Use Magic")) * { * ToggleCombatModeOn(); * } */ if (Physics.Raycast(ray, out hitInfo, MaxDistance, layerMask)) { ToTarget = hitInfo.distance; DistanceFromTarget = ToTarget; iaObject = hitInfo.collider.gameObject.GetComponent <IActionObject>(); if (iaObject != null) { iaObject.showInfo(); if (Input.GetButtonDown("Action")) { iaObject.action(); } } } else if (iaObject != null) { iaObject.hideInfo(); } } else // IF BATTLE MODE ON { //Target selecting if (Physics.Raycast(ray, out hitInfo, Mathf.Infinity, layerMask)) { ToTarget = hitInfo.distance; DistanceFromTarget = ToTarget; if (hitInfo.rigidbody != null) { if (DistanceFromTarget < AreaDetection.CurrentAbilityDistance) // Ability Distance { NPCTarget = hitInfo.rigidbody.gameObject.GetComponent <Character>(); if (CurrentStatBar.CurrentValue >= 1 && CurrentActionBar.CurrentValue >= 1 && !performingActionRed && !performingActionRed && !performingActionRed) { actionEnabled = true; } if (Input.GetButton("Attack") && actionEnabled == true && actionSpended <= 2f) { PerformAttack(AreaDetection.ActionType); } if (performingActionRed || performingActionGreen || performingActionBlue) { if (Input.GetButtonUp("Attack") || actionSpended > 2f || CurrentActionBar.CurrentValue == 0f) { if (actionSpended < 1f) { CurrentActionBar.CurrentValue -= (1f - actionSpended); CurrentActionBar.CurrentValue = Mathf.Clamp(CurrentActionBar.CurrentValue, 0f, CurrentActionBar.MaxValue); ReleaseAttack(AreaDetection.ActionType, 1); } else if (actionSpended >= 1f && actionSpended < 2f) { CurrentActionBar.CurrentValue -= (2f - actionSpended); CurrentActionBar.CurrentValue = Mathf.Clamp(CurrentActionBar.CurrentValue, 0f, CurrentActionBar.MaxValue); ReleaseAttack(AreaDetection.ActionType, 2); } else { CurrentActionBar.CurrentValue -= (3f - actionSpended); CurrentActionBar.CurrentValue = Mathf.Clamp(CurrentActionBar.CurrentValue, 0f, CurrentActionBar.MaxValue); ReleaseAttack(AreaDetection.ActionType, 3); } } } } } } //Block can be performed from 0 dist if (Input.GetButton("Block")) { PerformBlock(AreaDetection.ActionType); } if (Input.GetButtonUp("Block")) { ReleaseBlock(AreaDetection.ActionType); } } } }
/// <summary> /// Binds the Action model to the controller/view /// </summary> public void SetAction(IActionObject actionObject) { _actionModel = actionObject; }
/// <summary> /// 액션을 추가 /// </summary> /// <param name="Act"></param> public void EnqueueAction(IActionObject Act) { ActionBuffer.Enqueue(Act); }
public ImageColumnObject(string imageUrl, IActionObject action) { ImageUrl = imageUrl; Action = action; }