IEnumerator DissolveInPentagon(Pentagon pentagon) { float dissolveRate = 5.0f; float dissolveTimer = dissolveRate; float height = pentagon.gameObject.GetComponent <MeshRenderer>().bounds.size.y; Material[] mats = pentagon.gameObject.GetComponent <MeshRenderer>().materials; while (mats[0].GetFloat("_Glow") != 1.0f) { dissolveTimer -= Time.deltaTime; foreach (Material m in mats) { m.SetFloat("_Glow", 1.0f - Mathf.Max(dissolveTimer, 0.0f) / dissolveRate); m.SetFloat("_Level", height - (height + 0.65f) * (Mathf.Max(dissolveTimer, 0.0f) / dissolveRate)); } yield return(null); } if (PhotonNetwork.IsMasterClient) { photonView.RPC("RPC_StartStructureEffect", RpcTarget.AllViaServer, pentagon.Q, pentagon.R); } }
IEnumerator Bombardment(Pentagon pentagon) { while (pentagon != null) { while (!pentagon.HasTarget() || !pentagon.CheckSpace()) { if (pentagon.IsGlowing()) { photonView.RPC("RPC_StopGlow", RpcTarget.AllViaServer, pentagon.Q, pentagon.R); } yield return(null); } if (!pentagon.IsGlowing()) { photonView.RPC("RPC_StartGlow", RpcTarget.AllViaServer, pentagon.Q, pentagon.R); } yield return(new WaitForSeconds(pentagon.GetBombRate())); Vector2Int target = pentagon.GetTarget(); pentagon.Reset(); photonView.RPC("RPC_Fire", RpcTarget.Others, target[0], target[1], pentagon.Q, pentagon.R); yield return(StartCoroutine(FireProjectile(target[0], target[1], pentagon))); } }
void RPC_Bombard(int q, int r, int pentagonQ, int pentagonR) { Pentagon pentagon = (Pentagon)(structureStore.GetStructure(pentagonQ, pentagonR)); Bombard(q, r, pentagon); }
void RPC_StopGlow(int pentagonQ, int pentagonR) { Pentagon pentagon = (Pentagon)(structureStore.GetStructure(pentagonQ, pentagonR)); pentagon.StopGlow(); }