public override void MagicUpdate(Vector3 screenCoords) { Rigidbody body = MagicScript.GetComponent <Rigidbody>(); if (body != null) { body.AddForce(-Physics.gravity * 1.9f); } MagicScript.AddOverload(SpellIndex, SelfSpellOverloadPerSecond * Time.deltaTime); if (MagicScript.SpellOverloads[SpellIndex] > OverloadThreshold) { PhotonNetwork.Destroy(gameObject); } }
public override void MagicUpdate(Vector3 screenCoords) { Tuple <Vector3, Quaternion> newPos; if (IsSelfSpell) { newPos = GetSelfInstantiationPosition(MagicScript, screenCoords); if (newPos == null) { PhotonNetwork.Destroy(gameObject); return; } transform.position = Vector3.Lerp(transform.position, newPos.First, LerpSpeed); transform.rotation = Quaternion.Slerp(transform.rotation, newPos.Second, LerpSpeed); Ray ray = new Ray(transform.position, transform.forward); RaycastHit hit = new RaycastHit(); hit.point = ray.GetPoint(MaxRayDistance); if (Physics.Raycast(ray, out hit, MaxRayDistance, LayerMask.GetMask("Default", "Player"), QueryTriggerInteraction.Ignore)) { PlayerManager player = hit.collider.GetComponent <PlayerManager>(); if (player != null) { player.DealDamageFromAnyClient(SpellDamage * Time.deltaTime);///photonView.RPC("DamagePlayer", PhotonTargets.Others, p.owner); } } photonView.RPC("SetRay", PhotonTargets.All, hit.point); MagicScript.AddOverload(SpellIndex, SelfSpellOverloadPerSecond * Time.deltaTime); if (MagicScript.SpellOverloads[SpellIndex] > OverloadThreshold) { PhotonNetwork.Destroy(gameObject); } } }