void OnEntityEnter(TriggerBase triggerbase, BaseEntity entity) { if (!hasStarted) return; cachedBlock = triggerbase.GetComponentInParent<BuildingBlock>(); if (cachedBlock == null) return; if (cachedBlock.blockDefinition.fullName != "build/block.halfheight") return; cachedPlayer = entity.GetComponent<BasePlayer>(); if (cachedPlayer == null) return; cachedBlock.Kill(BaseNetworkable.DestroyMode.Gib); cachedPlayer.SendConsoleCommand("chat.add", new object[] { "0", string.Format("<color=orange>{0}:</color> {1}", "Warning", "You are not allowed to build blocks over you"), 1.0 }); }
void OnEntityEnter(TriggerBase triggerbase, BaseEntity entity) { if (!hasStarted) { return; } cachedBlock = triggerbase.GetComponentInParent <BuildingBlock>(); if (cachedBlock == null) { return; } if (cachedBlock.blockDefinition.fullName != "build/block.halfheight") { return; } cachedPlayer = entity.GetComponent <BasePlayer>(); if (cachedPlayer == null) { return; } cachedBlock.Kill(BaseNetworkable.DestroyMode.Gib); cachedPlayer.SendConsoleCommand("chat.add", new object[] { "0", string.Format("<color=orange>{0}:</color> {1}", "Warning", "You are not allowed to build blocks over you"), 1.0 }); }
void SendPlayerBack(BasePlayer player, TriggerBase triggerbase) { var ejectDirection = player.transform.position - triggerbase.transform.position; Vector3 newpos = triggerbase.transform.position + ((ejectDirection / ejectDirection.magnitude) * (triggerbase.GetComponentInParent<UnityEngine.SphereCollider>().radius - 1)); ForcePlayerPosition(player, newpos); }
void SendPlayerAway(BasePlayer player, TriggerBase triggerbase) { var ejectDirection = player.transform.position - triggerbase.transform.position; Vector3 newpos = triggerbase.transform.position + ((ejectDirection / ejectDirection.magnitude) * (triggerbase.GetComponentInParent <UnityEngine.SphereCollider>().radius + 1)); ForcePlayerPosition(player, newpos); }