// Update is called once per frame void Update() { // Remember Update runes on EVERYONE's computer, whether or not they own this // particular player object. if (!isLocalPlayer) { return; } if (Input.GetKeyDown(KeyCode.S)) { CmdDisableMyUnit(mySlinger.GetComponent <NetworkIdentity>().netId); } if (Input.GetKeyDown(KeyCode.D)) { CmdEnableMyUnit(mySlinger.GetComponent <NetworkIdentity>().netId); Debug.Log("SetHealth and EnableMe"); } if (Input.GetKeyDown(KeyCode.Q)) { string n = "Zant" + Random.Range(1, 100); Debug.Log("Sending the server a request to change our name to: " + n); CmdChangePlayerName(n); } }
void OnTriggerEnter(Collider collider) { if (isServer == false) { return; } // Is this our Spellslinger? Don't hit it please if (sourceSlinger.GetComponent <Rigidbody>() == collider.attachedRigidbody) { return; } Collider[] spellCols = Physics.OverlapSphere(this.transform.position, radius, spellMask); foreach (Collider col in spellCols) { if (col.attachedRigidbody == null) { continue; } Debug.Log("Wazzaaah"); NetworkInstanceId objectsNetworkId = col.attachedRigidbody.GetComponent <NetworkIdentity>().netId; CmdRemoveSpellObject(objectsNetworkId); } Collider[] cols = Physics.OverlapSphere(this.transform.position, radius, slingerMask); //.OverlapCircleAll(this.transform.position, radius); foreach (Collider col in cols) { if (col.attachedRigidbody == null) { continue; } NetworkInstanceId objectsNetworkId = col.attachedRigidbody.GetComponent <NetworkIdentity>().netId; CmdAddForce(objectsNetworkId); Health h = col.attachedRigidbody.GetComponent <Health>(); if (h != null) { h.CmdChangeHealthAndCheckKill(damage, sourceSlinger.GetComponent <NetworkIdentity>().netId); } } }