void Update() { if (beginMovement && target != null) { if (photonView.isMine) { if (MoveTowardsTarget(target, 0.2f)) { if (impactParticle != null) { GameObject impact = PhotonNetwork.Instantiate(impactParticle.name, target.position, Quaternion.identity, 0) as GameObject; CardVFX impactVFX = impact.GetComponent <CardVFX>(); impactVFX.Initialize(targetCard, false, false); //impactVFX.photonView.RPC("RPCInitialize", PhotonTargets.Others, 0); RPCSendImpactEvent(PhotonTargets.Others); SendImpactEvent(); Invoke("NetworkCleanup", 0.3f); //Destroy(gameObject, 0.5f); } } } } if (!photonView.isMine) { if (active) { //transform.position = Vector3.Lerp(transform.position, position, Time.deltaTime * lerpSmoothing); transform.position = Vector3.MoveTowards(transform.position, position, moveSpeed); } } }//End of Update
public void LaunchVFX(CreatureCardVisual damageDealer, CreatureCardVisual damageTaker) { GameObject atkVFX; if (damageDealer.cardData.movingVFX) { atkVFX = PhotonNetwork.Instantiate(damageDealer.attackEffect, damageDealer.transform.position, Quaternion.identity, 0) as GameObject; } else { atkVFX = PhotonNetwork.Instantiate(damageDealer.attackEffect, damageTaker.transform.position, Quaternion.identity, 0) as GameObject; } CardVFX vfx = atkVFX.GetComponent <CardVFX>(); if (vfx.photonView.isMine) { vfx.Initialize(damageTaker, damageDealer.cardData.movingVFX); if (damageDealer.cardData.movingVFX) { atkVFX.transform.SetParent(damageDealer.transform, false); atkVFX.transform.localPosition = Vector3.zero; //vfx.target = damageTaker.battleToken.incomingEffectLocation; //vfx.beginMovement = true; } else { atkVFX.transform.SetParent(damageTaker.battleToken.incomingEffectLocation, false); atkVFX.transform.localPosition = Vector3.zero; } } vfx.RPCSetVFXAciveState(PhotonTargets.Others, true); }
protected override IEnumerator DisplayDeathEffect() { if (currentDeck.decktype != Constants.DeckType.Battlefield) { yield return(null); } yield return(new WaitForSeconds(0.7f)); GameObject deathVFX; bool hasDeathEffect = string.IsNullOrEmpty(deathEffect); if (!hasDeathEffect) { deathVFX = PhotonNetwork.Instantiate(deathEffect, battleToken.incomingEffectLocation.position, Quaternion.identity, 0) as GameObject; } else { deathVFX = PhotonNetwork.Instantiate("VFX_NecroticFlash", battleToken.incomingEffectLocation.position, Quaternion.identity, 0) as GameObject; } if (deathVFX != null) { CardVFX cardVFX = deathVFX.GetComponent <CardVFX>(); cardVFX.Initialize(this, false, false); } }
protected override void OnVFXLanded(EventData data) { base.OnVFXLanded(data); CardVisual card = data.GetMonoBehaviour("Card") as CardVisual; CardVFX vfx = data.GetMonoBehaviour("VFX") as CardVFX; if (card != this) { return; } switch (lastStatAdjustment.stat) { case Constants.CardStats.SupportValue: cardSupportValueText.text = supportValue.ToString(); supportToken.UpdateSupportText(lastStatAdjustment.stat, supportValue); TextTools.AlterTextColor(supportValue, _supportData.supportValue, cardSupportValueText); break; } Debug.Log(card.gameObject.name + " has been hit with a VFX: " + vfx.gameObject.name); Grid.EventManager.RemoveListener(Constants.GameEvent.VFXLanded, OnVFXLanded); }
protected override IEnumerator DisplayDeathEffect() { yield return(new WaitForSeconds(0.7f)); GameObject deathVFX; if (deathEffect != "") { deathVFX = PhotonNetwork.Instantiate(deathEffect, supportToken.incomingEffectLocation.position, Quaternion.identity, 0) as GameObject; } else { deathVFX = PhotonNetwork.Instantiate("VFX_NecroticFlash", supportToken.incomingEffectLocation.position, Quaternion.identity, 0) as GameObject; } if (deathVFX != null) { CardVFX cardVFX = deathVFX.GetComponent <CardVFX>(); cardVFX.Initialize(this, false, false); } }