public void rpcContactProcess(Vector3 position, int otherId) { if (oneImpactVictim == null) { transform.position = position; GameObject other = null; CombatFlow otherFlow = null; if (otherId != -1) { other = PhotonNetwork.GetPhotonView(otherId).gameObject; otherFlow = other.gameObject.GetComponent <CombatFlow>(); } if (other != null) { oneImpactVictim = other.transform.root.gameObject; } Debug.Log("Bomb collided"); // die immediately on collision myCombatFlow.dealLocalDamage(myCombatFlow.getHP()); if (otherFlow != null && myCombatFlow.localOwned) { otherFlow.dealDamage(impactDamage); } } }
private void FixedUpdate() { if (launched) { if (myCombatFlow.localOwned) { if (myTarget != null && !hasPassed && myTarget.GetComponent <CreepControl>() == null && Vector3.Distance(myTarget.transform.position, transform.position) < PASS_OWNERSHIP_DISTANCE) { // target's instance will own this missile and show accurate position myCombatFlow.giveOwnership(targetID); Debug.LogWarning("Giving missile ownership"); } if (armed && rbRef.velocity.magnitude < selfDestructSpeed) { myCombatFlow.dealLocalDamage(myCombatFlow.getHP()); } if (myTarget != null) { updateTargetPosition(); } if (checkProximityFuse()) { // make this rpc if (effectsObj != null) { //effectsObj.GetComponent<Light>().enabled = false; photonView.RPC("rpcDisableLight", RpcTarget.All); } if (myCombatFlow != null && myCombatFlow.localOwned) { // blow up local instance. Death itself should be networked fine myCombatFlow.dealLocalDamage(myCombatFlow.getHP()); } } } } }
public void impactLocal(Vector3 position, GameObject other) { GameObject otherRoot = other; CombatFlow otherFlow = other.GetComponent <CombatFlow>(); transform.position = position; if (otherRoot != null) // do not do anything against effects { bool doExplode = !otherRoot.CompareTag("Effects"); //Debug.LogWarning("NOTE: ROCKET FOUND OTHER ROOT GAMEOBJECT"); if (otherFlow != null) { if (otherFlow.team != myTeam || friendlyImpact) { if (myFlow.localOwned) { //otherFlow.currentHP -= impactDamage; otherFlow.dealDamage(impactDamage); } } else { doExplode = false; } } if (doExplode) { // myFlow.currentHP -= myFlow.currentHP; myFlow.dealLocalDamage(myFlow.getHP()); if (effectsObj != null) { effectsObj.GetComponent <Light>().enabled = false; } //Debug.Log("Rocket HP after impact: " + myFlow.currentHP); } } }
public void killIfLifetimeOver() { if (launched) { if (projectileLifetime > 0f) { projectileLifetime -= Time.deltaTime; } else // timer ran out { // Not bothering to check if null because all Weapons should contain a CombatFlow object CombatFlow myFlow = GetComponent <CombatFlow>(); //myFlow.currentHP -= myFlow.currentHP; myFlow.dealLocalDamage(myFlow.getHP()); } } }