public static bool IsInArea( Vector3 position, Quaternion rotation, Bounds bounds, LayerMask layerMask) { return(GamePhysics.CheckOBB(new OBB(position, rotation, bounds), ((LayerMask) ref layerMask).get_value(), (QueryTriggerInteraction)0)); }
public override bool CanConnect(Vector3 position, Quaternion rotation, Socket_Base socket, Vector3 socketPosition, Quaternion socketRotation) { if (!base.CanConnect(position, rotation, socket, socketPosition, socketRotation)) { return(false); } Vector3 vector = Matrix4x4.TRS(position, rotation, Vector3.one).MultiplyPoint3x4(worldPosition); return(!GamePhysics.CheckOBB(new OBB(vector, new Vector3(2f, 0.5f, 2f), rotation), 2097152)); }
public static bool CheckOBB(OBB obb, int layerMask, ColliderInfo.Flags ignore) { if ((int)ignore == 0) { return(GamePhysics.CheckOBB(obb, layerMask, QueryTriggerInteraction.UseGlobal)); } List <Collider> list = Pool.GetList <Collider>(); GamePhysics.OverlapOBB(obb, list, layerMask, QueryTriggerInteraction.Ignore); bool flag = DeployVolume.CheckFlags(list, ignore); Pool.FreeList <Collider>(ref list); return(flag); }
public static bool CheckOBB(OBB obb, int layerMask, ColliderInfo.Flags ignore) { if (ignore == (ColliderInfo.Flags) 0) { return(GamePhysics.CheckOBB(obb, layerMask, (QueryTriggerInteraction)0)); } List <Collider> list = (List <Collider>)Pool.GetList <Collider>(); GamePhysics.OverlapOBB(obb, list, layerMask, (QueryTriggerInteraction)1); int num = DeployVolume.CheckFlags(list, ignore) ? 1 : 0; // ISSUE: cast to a reference type Pool.FreeList <Collider>((List <M0>&) ref list); return(num != 0); }
public bool DidCollide() { Transform[] array = collisionTestingPoints; foreach (Transform transform in array) { if (transform.gameObject.activeSelf) { Vector3 position = transform.position; Quaternion rotation = transform.rotation; if (GamePhysics.CheckOBB(new OBB(position, new Vector3(transform.localScale.x, transform.localScale.y, transform.localScale.z), rotation), 1084293121, QueryTriggerInteraction.Ignore)) { return(true); } } } return(false); }
protected override bool CanConnectToEntity(Construction.Target target) { Elevator elevator; if ((object)(elevator = target.entity as Elevator) != null && elevator.Floor >= MaxFloor) { return(false); } Vector3 vector = target.GetWorldPosition(); Quaternion quaternion = target.GetWorldRotation(true); if (GamePhysics.CheckOBB(new OBB(vector, new Vector3(2f, 0.5f, 2f), quaternion), 2097152)) { return(false); } return(base.CanConnectToEntity(target)); }
public static bool IsInArea(Vector3 position, Quaternion rotation, Bounds bounds, LayerMask layerMask) { return(GamePhysics.CheckOBB(new OBB(position, rotation, bounds), layerMask.@value, QueryTriggerInteraction.UseGlobal)); }
protected override void VehicleFixedUpdate() { base.VehicleFixedUpdate(); bool flag = EngineOn(); if (EngineOn()) { fuelSystem.TryUseFuel(UnityEngine.Time.fixedDeltaTime, fuelPerSec); } SetFlag(Flags.On, HasDriver() && GetFuelSystem().HasFuel()); if (IsOn() != flag) { GameObject[] onTriggers = OnTriggers; for (int i = 0; i < onTriggers.Length; i++) { onTriggers[i].SetActive(IsOn()); } } if (Vector3.Dot(base.transform.up, Vector3.down) >= 0.4f) { Kill(DestroyMode.Gib); return; } if (UnityEngine.Time.realtimeSinceStartup > lastDrivenTime + 14400f) { Kill(DestroyMode.Gib); return; } if (spawnOrigin != Vector3.zero && maxDistanceFromOrigin != 0f) { if (Vector3Ex.Distance2D(base.transform.position, spawnOrigin) > maxDistanceFromOrigin) { if (Vector3Ex.Distance2D(base.transform.position, lastDamagePos) > 6f) { if (GetDriver() != null) { GetDriver().ShowToast(1, ReturnMessage); } Hurt(MaxHealth() * 0.15f, DamageType.Generic, this, false); lastDamagePos = base.transform.position; nextSelfHealTime = UnityEngine.Time.realtimeSinceStartup + 3600f; Effect.server.Run(selfDamageEffect.resourcePath, base.transform.position + Vector3.up * 2f, Vector3.up); return; } } else if (base.healthFraction < 1f && UnityEngine.Time.realtimeSinceStartup > nextSelfHealTime && base.SecondsSinceAttacked > 600f) { Heal(1000f); } } if (!HasDriver() || !EngineOn()) { handbrakeOn = true; throttle = 0f; turnAmount = 0f; SetFlag(Flags.Reserved10, false); SetFlag(Flags.Reserved5, false); SetMagnetEnabled(false); } else { lastDrivenTime = UnityEngine.Time.realtimeSinceStartup; if (Magnet.IsMagnetOn() && Magnet.HasConnectedObject() && GamePhysics.CheckOBB(Magnet.GetConnectedOBB(0.75f), 1084293121, QueryTriggerInteraction.Ignore)) { SetMagnetEnabled(false); nextToggleTime = UnityEngine.Time.realtimeSinceStartup + 2f; Effect.server.Run(selfDamageEffect.resourcePath, Magnet.transform.position, Vector3.up); } } extensionDirection = Mathf.MoveTowards(extensionDirection, 0f, UnityEngine.Time.fixedDeltaTime * 3f); yawDirection = Mathf.MoveTowards(yawDirection, 0f, UnityEngine.Time.fixedDeltaTime * 3f); raiseArmDirection = Mathf.MoveTowards(raiseArmDirection, 0f, UnityEngine.Time.fixedDeltaTime * 3f); bool flag2 = extensionDirection != 0f || raiseArmDirection != 0f || yawDirection != 0f; SetFlag(Flags.Reserved7, flag2); magnetDamage.damageEnabled = IsOn() && flag2; extensionArmState += extensionDirection * arm1Speed * UnityEngine.Time.fixedDeltaTime; raiseArmState += raiseArmDirection * arm2Speed * UnityEngine.Time.fixedDeltaTime; yawState += yawDirection * turnYawSpeed * UnityEngine.Time.fixedDeltaTime; extensionArmState = Mathf.Clamp(extensionArmState, -1f, 1f); raiseArmState = Mathf.Clamp(raiseArmState, -1f, 1f); UpdateAnimator(false); Magnet.MagnetThink(UnityEngine.Time.fixedDeltaTime); float num = throttle; float num2 = throttle; if (turnAmount == 1f) { num = -1f; num2 = 1f; } else if (turnAmount == -1f) { num = 1f; num2 = -1f; } UpdateMotorSpeed(num * engineStrength, num2 * engineStrength, handbrakeOn ? brakeStrength : 0f); }