void OnTriggerEnter(Collider other) { if (!isServer || triggered) { return; } var otherCharacter = other.GetComponent <NetworkCharacter>(); if (otherCharacter && otherCharacter.Team == GameEnum.TeamType.Hunter) { triggered = true; var args = new StunArgument(); args.time = trapStunTime; otherCharacter.Perform("StopMovement", other.gameObject, null); otherCharacter.Perform("Stun", other.gameObject, args); ActivateTrap(otherCharacter.gameObject); RpcActivateTrap(otherCharacter.netId); Invoke("Byebye", trapStunTime); } }
void OnTriggerEnter(Collider other) { if (!isServer) { return; } if (other.gameObject.tag == "PowerSource") { return; } if (other.gameObject.tag == "AreaVolume") { return; } if (other.gameObject.tag == "Smoke") { return; } var otherCharacter = other.GetComponent <NetworkCharacter>(); var duration = 0.3f; if (otherCharacter && otherCharacter.Team == GameEnum.TeamType.Survivor) { var dir = (transform.position - origin).normalized; var offset = dir * HookedObjectDestinationOffsetRatio; duration = Mathf.Min(Vector3.Distance(transform.position, origin) / hookSpeed, duration); var args = new StunArgument(); args.time = duration + additionalStunTime; otherCharacter.Perform("Stun", gameObject, args); otherCharacter.MoveTo(hunter.transform.position + offset, MoveMethod.Tween, duration); if (hitSheepAudio) { hitSheepAudio.Play(); } RpcPlayHitSheepAudio(); GetComponent <Rigidbody>().velocity = -GetComponent <Rigidbody>().velocity; } else { if (hitObjectAudio) { hitObjectAudio.Play(); } RpcPlayHitObjectAudio(); GetComponent <Rigidbody>().velocity = Vector3.zero; } hunter.GetComponent <HunterSkills>().ReturnHook(); GetComponent <Collider>().enabled = false; LevelManager.Singleton.DestoryNetworkObject(gameObject, duration); //NetworkServer.Destroy(gameObject); //Destroy(gameObject); }