/// <summary> /// Locks and unlocks the controls. /// </summary> /// <param name="isTurnAllowed">If set to <c>true</c> is turn allowed.</param> /// <param name="isMovementAllowed">If set to <c>true</c> is movement allowed.</param> /// <param name="isSprintAllowed">If set to <c>true</c> is sprint allowed.</param> protected void setControls(bool isTurnAllowed, bool isMovementAllowed, bool isSprintAllowed) { if (_combatHandler.GetComponent <PlayerMovementControl> () != null) { PlayerMovementControl pmc = _combatHandler.GetComponent <PlayerMovementControl> (); pmc.SetIsTurnAllowed(isTurnAllowed); pmc.SetIsMovementAllowed(isMovementAllowed); pmc.SetIsSprintAllowed(isSprintAllowed); } }
/// <summary> /// Locks player controls that was set in the editor /// </summary> protected virtual void lockControls() { if (_combatHandler.GetComponent <PlayerMovementControl> () != null) { PlayerMovementControl pmc = _combatHandler.GetComponent <PlayerMovementControl> (); if (!_isTurnAllowed) { pmc.SetIsTurnAllowed(false); } if (!_isMovmentAllowed) { pmc.SetIsMovementAllowed(false); } if (!_isSprintAllowed) { pmc.SetIsSprintAllowed(false); } } }
/// <summary> /// Unlock player controls that was locked /// </summary> /// <param name="seconds">Seconds.</param> protected virtual void unlockControls() { if (_combatHandler.GetComponent <PlayerMovementControl> () != null) { PlayerMovementControl pmc = _combatHandler.GetComponent <PlayerMovementControl> (); // if (!_isTurnAllowed) pmc.SetIsTurnAllowed(true); // if (!_isMovmentAllowed) pmc.SetIsMovementAllowed(true); // if (!_isSprintAllowed) pmc.SetIsSprintAllowed(true); } // if (_weapon.GetOwner ().GetComponent<PlayerMovementControl> () != null) { // PlayerMovementControl pmc = _weapon.GetOwner ().GetComponent<PlayerMovementControl> (); // if (!_isTurnAllowed) // pmc.SetIsTurnAllowed (true); // if (!_isMovmentAllowed) // pmc.SetIsMovementAllowed (true); // if (!_isSprintAllowed) // pmc.SetIsSprintAllowed (true); // } }
/// <summary> /// Activate / Use this instance. /// </summary> public override void Activate() { if (_status == ABILITY_STATUS.AVAILABLE) { // //Ability base code // //stop player from turning during attack if (_weapon.GetOwner().GetComponent <PlayerMovementControl> () != null) { PlayerMovementControl pmc = _weapon.GetOwner().GetComponent <PlayerMovementControl> (); if (!_isTurnAllowed) { pmc.SetIsTurnAllowed(false); } if (!_isMovmentAllowed) { pmc.SetIsMovementAllowed(false); } if (!_isSprintAllowed) { pmc.SetIsSprintAllowed(false); } } // //AbilityAnimationAttack base code with changes // _weapon.SetDamage(_damage); _animator.SetBool(_animHash, true); StartCoroutine(CoroutineHelper.IEChangeAnimBool(_animator, _animHash, false, _animTime1)); // Vector3 targetPos; // if (_aimAssist && _targetFound) { // targetPos = _animator.transform.position + ((_targetPos - _animator.transform.position).normalized * _movementForward); // } else { // targetPos = _animator.transform.position + (_animator.transform.forward * _movementForward); // } // StartCoroutine (MathHelper.IELerpPositionOverTime (_animator.transform, _animator.transform.position, targetPos, 0.5f)); // //AbilityUltimateWarrior code // // _combatHandler.ResetUltimateGuage (); _combatHandler.SetUltimatePoint(0); // StartCoroutine (IEPositionWeapon (_animTime1)); _combatHandler.PositionUltimateWeapon(_animTime1); // StartCoroutine (IEActivateDamagingPoint (_weapon, _animTime1, 0.25f)); ActivateDamagingPoint(_weapon, _animTime1, 0.25f); StartCoroutine(IECheckInUse(_animTime1)); StartCoroutine(IEUnlockControls(_coolDown)); StartCoroutine(IERotate(_animTime1, _rotationSpeed)); StartCoroutine(IESetRigidbodyRotYConstraint(_animTime1)); foreach (var dp in _weapon.GetDamagingPoints()) { StartCoroutine(DamagingPoint.IESetOneTimeDamage(dp, _animTime1, false)); } //particle // ParticleController.PC.InstantiateParticle(ParticleController.PARTICLE_TYPE.WARRIOR_ULT_TORNADO, _combatHandler.transform.position, 0f, _animTime1, _combatHandler.transform); } else { } }