public static Sector Make(GameObject body, float sectorSize) { GameObject sectorBase = new GameObject(); sectorBase.SetActive(false); sectorBase.transform.parent = body.transform; SphereShape sphereshape = sectorBase.AddComponent <SphereShape>(); sphereshape.SetCollisionMode(Shape.CollisionMode.Volume); sphereshape.SetLayer(Shape.Layer.Sector); sphereshape.layerMask = -1; sphereshape.pointChecksOnly = true; sphereshape.radius = 700f; sphereshape.center = Vector3.zero; OWTriggerVolume trigVol = sectorBase.AddComponent <OWTriggerVolume>(); Sector sector = sectorBase.AddComponent <Sector>(); sector.SetValue("_name", Sector.Name.InvisiblePlanet); sector.SetValue("__attachedOWRigidbody", MainClass.OWRB); sector.SetValue("_subsectors", new List <Sector>()); sectorBase.SetActive(true); return(sector); }
public static void Make(GameObject body, float groundSize, float topCloudSize) { GameObject volumes = new GameObject(); volumes.SetActive(false); volumes.transform.parent = body.transform; GameObject ruleset = new GameObject(); ruleset.transform.parent = volumes.transform; SphereShape ss = ruleset.AddComponent <SphereShape>(); ss.SetCollisionMode(Shape.CollisionMode.Volume); ss.SetLayer(Shape.Layer.Sector); ss.layerMask = -1; ss.pointChecksOnly = true; ss.radius = topCloudSize; OWTriggerVolume trigvol = ruleset.AddComponent <OWTriggerVolume>(); PlanetoidRuleset prule = ruleset.AddComponent <PlanetoidRuleset>(); prule.SetValue("_altitudeFloor", groundSize); prule.SetValue("_altitudeCeiling", topCloudSize); EffectRuleset er = ruleset.AddComponent <EffectRuleset>(); er.SetValue("_type", EffectRuleset.BubbleType.Underwater); er.SetValue("_material", GameObject.Find("RulesetVolumes_GD").GetComponent <RulesetVolume>().GetValue <Material>("_material")); er.SetValue("_cloudMaterial", GameObject.Find("RulesetVolumes_GD").GetComponent <RulesetVolume>().GetValue <Material>("_cloudMaterial")); volumes.SetActive(true); }
public override async UniTask Init(CancellationToken ct) { // BUG : This won't work for the log lift! need to make a different trigger for that var boxShape = AttachedObject.gameObject.GetAddComponent <BoxShape>(); boxShape.center = new Vector3(0, 1.75f, 0.25f); boxShape.size = new Vector3(3, 3.5f, 3); _elevatorTrigger = AttachedObject.gameObject.GetAddComponent <OWTriggerVolume>(); }