private void FixedUpdate() { m_playerControl.Update(transform); }
void Update() { m_PlayerControl.Update(transform); m_PlayerCamera.Update(); }
private void Update() { playerControl.Update(); axe.transform.position = axeHolder.transform.position; axe.transform.rotation = axeHolder.transform.rotation; }
// Update is called once per frame void Update() { if (!Owner.IsAlive) { Debug.Log("Game Over"); ActionDeath actionDeath = ActionFactory.Create(ActionFactory.E_Type.E_DEATH) as ActionDeath; GetComponent <AnimComponent>().HandleAction(actionDeath); StartCoroutine(BackToMainMenu()); } #region 测试代码 // Debug.Log(currentGameZone.name); //if (Input.GetKeyDown(KeyCode.Alpha1)) //{ // // 受伤动作 // ActionInjury actionInjury=ActionFactory.Create(ActionFactory.E_Type.E_INJURY)as ActionInjury; // actionInjury.Attacker = null; // actionInjury.DamageType = E_DamageType.Back; // actionInjury.FromWeapon = E_WeaponType.Katana; // GetComponent<AnimComponent>().HandleAction(actionInjury); // // 死亡动作 // ActionDeath actionDeath = ActionFactory.Create(ActionFactory.E_Type.E_DEATH) as ActionDeath; // actionDeath.Attacker = null; // actionDeath.DamageType = E_DamageType.Back; // actionDeath.FromWeapon = E_WeaponType.Katana; // GetComponent<AnimComponent>().HandleAction(actionDeath); // isDeath = true; // Debug.Log("GameOver"); //} #endregion if (Owner.BlackBoard.Stop) { lastAttacketTarget = null; comboProgress.Clear(); ClearBufferedOrder(); CreateOrderStop(); control.Update(); return; } // 玩家操作更新 control.Update(); // 当玩家进行UI界面操作时,所有按键操作停止工作 if (!useMode) { comboProgress.Clear(); return; } // 方向控制不够灵活,后续再优化 if (control.buttons[(int)PlayerControl.E_ButtonName.Up].status == PlayerControl.E_ButtonStatus.Down) { // 首先需要判断当前是否可以进行该操作 // 玩家在进行闪避,攻击或者使用道具时,不能执行行走操作 if (CanAddNewAction()) { // Debug.Log("玩家向前移动"); CreateOrderMove(Vector3.forward); } } if (control.buttons[(int)PlayerControl.E_ButtonName.Down].status == PlayerControl.E_ButtonStatus.Down) { if (CanAddNewAction()) { // Debug.Log("玩家向后移动"); CreateOrderMove(Vector3.back); } } if (control.buttons[(int)PlayerControl.E_ButtonName.Left].status == PlayerControl.E_ButtonStatus.Down) { if (CanAddNewAction()) { // Debug.Log("向左移动"); CreateOrderMove(Vector3.left); } } if (control.buttons[(int)PlayerControl.E_ButtonName.Right].status == PlayerControl.E_ButtonStatus.Down) { if (CanAddNewAction()) { // Debug.Log("向右移动"); CreateOrderMove(Vector3.right); } } if (control.buttons[(int)PlayerControl.E_ButtonName.Roll].status == PlayerControl.E_ButtonStatus.Down) { // Debug.Log("闪避动作"); CreateOrderDodge(); } if (control.buttons[(int)PlayerControl.E_ButtonName.AttackX].status == PlayerControl.E_ButtonStatus.Down) { // Debug.Log("将X添加组合攻击链表"); CreateOrderAttack(E_AttackType.X); } if (control.buttons[(int)PlayerControl.E_ButtonName.AttackO].status == PlayerControl.E_ButtonStatus.Down) { // Debug.Log("将O添加组合攻击链表"); CreateOrderAttack(E_AttackType.O); } // 当没有任何按键操作时,切回idle状态 bool hasAnyKeyDown = false; for (int i = 0; i < control.buttons.Length; i++) { if (control.buttons[i].status == PlayerControl.E_ButtonStatus.Down) { hasAnyKeyDown = true; } } if (hasAnyKeyDown == false) { weaponStartTime += Time.deltaTime; if (weaponStartTime > weaponTime) { weaponStartTime = 0; ClearBufferedOrder(); comboProgress.Clear(); MainPanelCtrl.Instance.ComboProgressMessage(comboProgress); if (Owner.BlackBoard.WeaponState != E_WeaponState.NotInHands) { GetComponent <Animation>().CrossFade("hideSword", 0.1f); GetComponent <Animation>().CrossFadeQueued("idle", 0.1f); Owner.SoundPlayWeaponOff(); Owner.BlackBoard.WeaponState = E_WeaponState.NotInHands; } CreateOrderStop(); } else { CreateOrderStop(); } } }