void Update() { if (animTimestamp <= Time.time) { playerAnim.SetBool("Cast", false); } if (canCastSpells && !magicPeaceZone) { if (m_photonView.isMine) { if (anim.GetBool("Won")) { if (Time.time > winCastTimestamp) { winCastTimestamp = Time.time + winCastinterval; Vector3 randomPos = transform.position + Random.insideUnitSphere * Random.Range(1, 8); randomPos.y = 0; ShoutSpell((int)Random.Range(0, 15), GetProjectileSpawnPos(), randomPos); } } lastKeySelected(); positionReticles(); for (int i = 0; i < keyCodes.Length; i++) { if (currentKey == keyCodes[i] && mySpells.Count > i) { if (m_spellData[mySpells[i]].isUtility()) { if (Input.GetKeyDown(currentKey) && isSpellReady(i)) { CastAnim(false); ShoutSpell(mySpells[i], GetProjectileSpawnPos(), mousePos.getMouseWorldPoint()); Timing.RunCoroutine(_StartCooldown(i)); teleportControl.StopPlayerRecall(); } } else { if (Input.GetMouseButtonDown(0) && spellSelected) { if (isSpellReady(i)) { CastAnim(true); ShoutSpell(mySpells[i], GetProjectileSpawnPos(), mousePos.getMouseWorldPoint()); Timing.RunCoroutine(_StartCooldown(i)); teleportControl.StopPlayerRecall(); } } } } } } } }
private IEnumerator <float> _TakeDamageOverTime(int amountOfTicks, float damage, float timeBetweenTicks, CharacterManager_NET charMan, int playerID) { for (int i = 0; i < amountOfTicks; i++) { TakeDamage(damage, playerID, charMan); if (_teleportToShop.teleportingToShop) { _teleportToShop.StopPlayerRecall(); } yield return(Timing.WaitForSeconds(timeBetweenTicks)); } }
void FixedUpdate() { if (canPlayerMove) { currentSpeed = rb.velocity.sqrMagnitude; } else { currentSpeed = 0; } anim.SetFloat("m_MoveSpeed", currentSpeed); #region Key pressed action if (Input.GetKey(KeyCode.Mouse1)) { if (_teleportToShop.teleportingToShop) { _teleportToShop.StopPlayerRecall(); } targetPosition = mouseController.getMouseWorldPoint(); targetPosRotation = targetPosition; moving = true; anim.SetBool("Cast", false); //Update MoveIndicator moveIndicator.UpdateMoveIndicator(targetPosition); } #endregion if (canPlayerMove) { #region Movement if (moving) { moveDir = targetPosition - transform.position; distance = moveDir.sqrMagnitude; if (distance < distanceToStop * distanceToStop) { moving = false; } else { FollowTarget(targetPosition, movementSpeed); } RotateToPos(); } ; #endregion } if (Time.time >= timeStamp + slowDuration) { movementSpeed = originalSpeed; } }