private void Awake() { th = gameObject.GetComponent <Treehouse>(); if (PlateType == null) { PlateType = Resources.Load("Prefabs/Plate") as GameObject; // If no plate loaded, do a 2x4. } if (BeamType == null) { BeamType = Resources.Load("Prefabs/Beam") as GameObject; } if (RailType == null) { RailType = Resources.Load("Prefabs/Rail") as GameObject; } PlateWidth = PlateType.GetComponent <Renderer>().bounds.size.x; // Set the size, bounds of the Plate. PlateBounds = PlateType.GetComponent <Renderer>().bounds; BeamBounds = CalculateBounds(BeamType); /* * Debug.Log("X: " + BeamBounds.size.x); * Debug.Log("Y: " + BeamBounds.size.y); * Debug.Log("Z: " + BeamBounds.size.z); */ // testsphere = GameObject.CreatePrimitive(PrimitiveType.Sphere); // testsphere.name = "Projected Origin"; /// DEBUGGING }
private void TryFindTreehouse() { if (house == null) { house = GameObject.FindGameObjectWithTag("Treehouse").GetComponent <Treehouse>(); } }
protected override bool Satisfies(Sim actor, Sim target, Treehouse obj, bool isAutonomous, ref GreyedOutTooltipCallback callback) { if (!base.Satisfies(actor, target, obj, isAutonomous, ref callback)) { return(false); } return(CommonPregnancy.SatisfiesTryForBaby(actor, target, "TreehouseTryForBaby", isAutonomous, true, ref callback)); }
protected override bool Satisfies(Sim actor, Sim target, Treehouse obj, bool isAutonomous, ref GreyedOutTooltipCallback callback) { if (!base.Satisfies(actor, target, obj, isAutonomous, ref callback)) { return(false); } return(CommonWoohoo.SatisfiesWoohoo(actor, target, "TreehouseWoohoo", isAutonomous, true, true, ref callback)); }
private void GenDelaunayTreeDecks(List <Vector3> points) { GameObject DeckNode = new GameObject("Deck Node"); // Magic and beautiful Delaunay triangulation List <Triangle> triangulation = Delaunay.TriangulateByFlippingEdges(points); // Area filter setup double[] check_range = MathFilter.AreaSpan(triangulation, MaxLength, MinAngle, RelativeArea); foreach (Triangle tri in triangulation) { // Length constraint. if 0, no constraint if (MathFilter.LengthFilter(tri, MaxLength)) { List <double> TriAngles = MathFilter.AngleDegrees(tri); // Angle constraint if (TriAngles.TrueForAll(angle => angle >= MinAngle)) { double area = MathFilter.TriangleArea(tri); // Area constraint if (check_range[0] <= area && area <= check_range[1]) { Vector3 P1 = tri.v1.position; Vector3 P2 = tri.v2.position; Vector3 P3 = tri.v3.position; // Brett deck GameObject TreeDeck = Instantiate(DeckObject); Treehouse TreehouseComp = TreeDeck.AddComponent <Treehouse>(); TreeDeck.AddComponent <Deck>(); // Deck component needs 3 GameObjects. In the future this // may become 3 Vector3s. GameObject newTreeNode1 = Instantiate(DeckNode, P1, rot); GameObject newTreeNode2 = Instantiate(DeckNode, P2, rot); GameObject newTreeNode3 = Instantiate(DeckNode, P3, rot); List <GameObject> TreesTri = new List <GameObject>(); TreesTri.Add(newTreeNode1); TreesTri.Add(newTreeNode2); TreesTri.Add(newTreeNode3); TreehouseComp.Trees = TreesTri; } } } } }
public void StageLost() { if (!Playing) { return; } state = GameState.Lost; Treehouse house = GameObject.FindGameObjectWithTag("Treehouse").GetComponent <Treehouse>(); cameraControl.Focus(house.transform.position); CustomCoroutine.WaitThenExecute(END_GAME_DELAY, () => { gameOverScreen.transform.SetAsLastSibling(); gameOverScreen.SetActive(true); }); }
public override bool Run() { try { mLinkedActor = LinkedInteractionInstance.InstanceActor; if (!StartSync(mIsMaster)) { Treehouse.PushGetOutAsContinuation(Actor); return(false); } StandardEntry(false); BeginCommodityUpdates(); if (mIsMaster) { RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.MoreWoohoo); mCurrentStateMachine = Actor.Posture.CurrentStateMachine; SetActor("y", mLinkedActor); AnimateSim("WooHoo"); AnimateSim("Idle"); RemoveActor("y"); IWooHooDefinition definition = InteractionDefinition as IWooHooDefinition; CommonWoohoo.RunPostWoohoo(Actor, mLinkedActor, Target, definition.GetStyle(this), definition.GetLocation(Target), true); if (CommonPregnancy.IsSuccess(Actor, mLinkedActor, Autonomous, definition.GetStyle(this))) { Pregnancy pregnancy = CommonPregnancy.Impregnate(Actor, mLinkedActor, Autonomous, definition.GetStyle(this)); if (pregnancy != null) { pregnancy.SetForcedBabyTrait(RandomUtil.GetRandomObjectFromList(Target.RandomPregnancyTraits)); } } RockGemMetalBase.HandleNearbyWoohoo(Target, RockGemMetalBase.HowMuchWooHoo.LessWoohoo); } else { DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); } float splinterChance = Treehouse.WooHoo.kSplinterChance; if (Actor.TraitManager.HasAnyElement(kSplinterChanceTraitsIncrease)) { splinterChance *= kSplinterChanceMultiplierIncrease; } if (Actor.TraitManager.HasAnyElement(kSplinterChanceTraitsDecrease) || Actor.BuffManager.HasElement(BuffNames.LuckyLime)) { splinterChance *= kSplinterChanceMultiplierDecrease; } if (RandomUtil.RandomChance01(splinterChance)) { Actor.BuffManager.AddElement(BuffNames.Splinter, Origin.None); } EndCommodityUpdates(true); StandardExit(false, false); FinishLinkedInteraction(mIsMaster); WaitForSyncComplete(); Treehouse.PushGetOutAsContinuation(Actor); return(true); } catch (ResetException) { throw; } catch (Exception exception) { Common.Exception(Actor, Target, exception); return(false); } }
public override string GetInteractionName(Sim actor, Treehouse target, InteractionObjectPair iop) { return(Common.LocalizeEAString(actor.IsFemale, "Gameplay/Excel/Socializing/Action:NRaasTryForBaby", new object[0])); }
public override string GetInteractionName(Sim actor, Treehouse target, InteractionObjectPair iop) { return(Common.LocalizeEAString(actor.IsFemale, "Gameplay/Excel/Socializing/Action:NRaasRiskyWooHoo", new object[0]) + Common.LocalizeEAString(false, "NRaas.Woohooer:RiskyChance", new object[] { Woohooer.Settings.GetRiskyBabyMadeChance(actor) })); }