public override void OnInitialized() { worlditem.OnVisible += OnVisible; worlditem.OnInvisible += OnInvisible; worlditem.OnActive += OnActive; Visitable visitable = null; if (worlditem.Is <Visitable>(out visitable)) { visitable.OnPlayerVisit += OnPlayerVisit; visitable.OnPlayerLeave += OnPlayerLeave; } Revealable revealable = null; if (worlditem.Is <Revealable>(out revealable)) { revealable.OnReveal += OnReveal; } State.IsCivilized = false; if (worlditem.Is <City>()) { State.IsCivilized = true; } }
public void CreatePathMarkerProps() { if (HasPathMarkerProps) { return; } mProps = new PathMarkerInstanceTemplate(); switch (worlditem.State) { case "PathMarker": default: mProps.Type = PathMarkerType.PathMarker; break; case "CrossMarker": mProps.Type = PathMarkerType.CrossMarker; break; } mProps.Position = worlditem.tr.position; mProps.Rotation = worlditem.tr.rotation.eulerAngles; mProps.Owner = this; Visitable visitable = worlditem.Get <Visitable>(); mProps.Visitable = visitable.State; Revealable revealable = worlditem.Get <Revealable>(); mProps.Revealable = revealable.State; }
public override void OnInitialized() { visitable = worlditem.Get <Visitable>(); visitable.OnPlayerVisit += OnPlayerVisit; visitable.OnPlayerLeave += OnPlayerLeave; worlditem.OnVisible += OnVisible; worlditem.OnInvisible += OnInvisible; }
public void RefreshPathMarkerProps(bool setPosition) { if (!mInitialized) { return; } if (HasPathMarkerProps) { if (setPosition) { worlditem.ActiveState = WIActiveState.Active; mHit.feetPosition = mProps.Position; mHit.overhangHeight = 4.0f; mHit.groundedHeight = 5.0f; mHit.ignoreWorldItems = true; //we want path markers to appear below people / signs / etc mHit.feetPosition.y = GameWorld.Get.TerrainHeightAtInGamePosition(ref mHit); worlditem.tr.position = mHit.feetPosition; worlditem.tr.rotation = Quaternion.Euler(0f, mProps.Rotation.y, 0f); //update the props position based on the new in-game height Props.Position = mHit.feetPosition; } Visitable visitable = worlditem.Get <Visitable>(); visitable.State = Props.Visitable; Revealable revealable = worlditem.Get <Revealable>(); revealable.State = Props.Revealable; //we only care about other items if we're a path origin //OR if we're the terminal of an active path if (Flags.Check((uint)PathMarkerType.PathOrigin, (uint)mProps.Type, Flags.CheckType.MatchAny) || (IsActive && IsTerminal)) { visitable.Trigger.enabled = true; if (visitable.Trigger.VisitableCollider != null) { SphereCollider sc = visitable.Trigger.VisitableCollider as SphereCollider; sc.radius = Globals.PathOriginTriggerRadius; } else { SphereCollider sc = visitable.Trigger.gameObject.AddComponent <SphereCollider>(); sc.radius = Globals.PathOriginTriggerRadius; visitable.Trigger.VisitableCollider = sc; } worlditem.State = "CrossMarker"; } else { visitable.Trigger.enabled = false; worlditem.State = "PathMarker"; } } }
public override void OnInitialized() { Visitable visitable = null; if (worlditem.Is <Visitable>(out visitable)) { visitable.OnPlayerVisitFirstTime += OnPlayerVisitFirstTime; } worlditem.OnPlayerEncounter += OnPlayerVisitFirstTime; worlditem.OnActive += OnPlayerVisitFirstTime; }
public override void OnInitialized() { Visitable visitable = null; Structure structure = null; if (worlditem.Is <Visitable>(out visitable)) { visitable.OnPlayerLeave += OnPlayerLeave; } else if (worlditem.Is <Structure>(out structure)) { structure.OnPlayerExit += OnPlayerLeave; } }
public override void OnInitialized() { worlditem.OnVisible += OnVisible; worlditem.OnInvisible += OnInvisible; Visitable visitable = worlditem.Get <Visitable> (); visitable.OnPlayerVisit += OnPlayerVisit; visitable.OnPlayerLeave += OnPlayerLeave; State.SpeechWarning = string.IsNullOrEmpty(State.SpeechWarning) ? Globals.BanditCampDefaultWarningSpeech : State.SpeechWarning; State.SpeechAttack = string.IsNullOrEmpty(State.SpeechAttack) ? Globals.BanditCampDefaultAttackSpeech : State.SpeechAttack; State.SpeechTaunt = string.IsNullOrEmpty(State.SpeechTaunt) ? Globals.BanditCampDefaultTauntSpeech : State.SpeechTaunt; State.SpeechFlee = string.IsNullOrEmpty(State.SpeechFlee) ? Globals.BanditCampDefaultFleeSpeech : State.SpeechFlee; }
public void OnItemOfInterestLeave() { Visitable visitable = null; if (worlditem.Is <Visitable> (out visitable)) { Creature creature = null; WorldItem lastItemOfInterest = visitable.LastItemOfInterestToLeave; WaterTrap waterTrap = null; if (lastItemOfInterest.Is <WaterTrap> (out waterTrap)) { waterTrap.IntersectingDens.Remove(this); } } }
public void OnItemOfInterestVisit() { Visitable visitable = null; if (worlditem.Is <Visitable> (out visitable)) { Creature creature = null; ITrap trap = null; WorldItem lastItemOfInterest = visitable.LastItemOfInterestToVisit; WaterTrap waterTrap = null; if (lastItemOfInterest.Is <WaterTrap> (out waterTrap) && !waterTrap.Exceptions.Contains(State.NameOfFish)) { Debug.Log("Found a water trap"); waterTrap.IntersectingDens.SafeAdd(this); } } }
public override void OnInitialized() { worlditem.OnPlayerPlace += OnPlayerPlace; Visitable visitable = null; if (worlditem.Is <Visitable>(out visitable)) { visitable.OnItemOfInterestVisit += OnItemOfInterestVisit; visitable.OnItemOfInterestVisit += OnItemOfInterestLeave; //visitable.ItemsOfInterest.Add ("Character"); visitable.ItemsOfInterest.SafeAdd("PathMarker"); } if (!worlditem.Is <Receptacle>()) { worlditem.OnPlayerUse += OnPlayerUse; } }
public void OnItemOfInterestLeave() { if (!mInitialized) { return; } if (!HasPathMarkerProps) { return; } Visitable visitable = worlditem.Get <Visitable>(); PathMarker pm = null; if (visitable.LastItemOfInterestToLeave != null && visitable.LastItemOfInterestToLeave.Is <PathMarker>(out pm)) { //not sure what to do here } }
public void OnItemOfInterestVisit() { if (!mInitialized) { return; } if (!HasPathMarkerProps) { return; } Visitable visitable = worlditem.Get <Visitable>(); PathMarker pm = null; if (visitable.LastItemOfInterestToVisit != null && visitable.LastItemOfInterestToVisit.Is <PathMarker>(out pm)) { CheckPathConnections(pm); } }
public override void OnInitialized() { Location location = null; if (worlditem.Is <Location> (out location)) { location.UnloadOnInvisible = false; } worlditem.OnActive += OnVisible; worlditem.OnVisible += OnVisible; worlditem.OnInvisible += OnInvisible; worlditem.OnAddedToGroup += OnAddedToGroup; mSpawningFish = false; mDespawningFish = false; Visitable visitable = null; if (worlditem.Is <Visitable> (out visitable)) { visitable.PlayerOnly = false; visitable.OnPlayerVisit += OnPlayerVisit; visitable.OnPlayerLeave += OnPlayerLeave; visitable.OnItemOfInterestVisit += OnItemOfInterestVisit; visitable.OnItemOfInterestLeave += OnItemOfInterestLeave; visitable.ItemsOfInterest.Add("Creature"); visitable.ItemsOfInterest.Add("WaterTrap"); } Revealable revealable = null; if (worlditem.Is <Revealable> (out revealable)) { revealable.State.CustomMapSettings = true; revealable.State.IconStyle = MapIconStyle.Small; revealable.State.LabelStyle = MapLabelStyle.None; revealable.State.IconName = "MapIconFishDen"; } }
public override void OnInitialized() { Spawner spawner = null; /*if (worlditem.Is <Spawner>(out spawner)) { * //get the hostile template for creatures to draw from * Creatures.GetTemplate (State.NameOfCreature, out StateTemplate); * }*/ Location location = null; if (worlditem.Is <Location>(out location)) { location.UnloadOnInvisible = false; } WorldClock.Get.TimeActions.Subscribe(TimeActionType.DaytimeStart, new ActionListener(DaytimeStart)); WorldClock.Get.TimeActions.Subscribe(TimeActionType.NightTimeStart, new ActionListener(NightTimeStart)); WorldClock.Get.TimeActions.Subscribe(TimeActionType.HourStart, new ActionListener(HourStart)); //worlditem.OnActive += OnActive; //worlditem.OnInactive += OnInactive; worlditem.OnVisible += OnVisible; Visitable visitable = null; if (worlditem.Is <Visitable>(out visitable)) { visitable.PlayerOnly = false; visitable.OnPlayerVisit += OnPlayerVisit; visitable.OnPlayerLeave += OnPlayerLeave; visitable.OnItemOfInterestVisit += OnItemOfInterestVisit; visitable.OnItemOfInterestLeave += OnItemOfInterestLeave; visitable.ItemsOfInterest.Add("Creature"); visitable.ItemsOfInterest.Add("LandTrap"); visitable.ItemsOfInterest.Add("WaterTrap"); } }
public override void OnInitialized() { Location location = worlditem.Get <Location>(); location.State.UnloadOnInvisible = false; Collider.radius = State.Radius; Collider.height = State.Height; Collider.center = new Vector3(0f, State.Offset, 0f); Collider.direction = 1; //turn it on and keep it on worlditem.ActiveState = WIActiveState.Active; worlditem.ActiveStateLocked = true; visitable = worlditem.Get <Visitable>(); ThermalFX = FXManager.Get.GetOrSpawnFx(ThermalFX, Pivot.gameObject, State.ThermalFXName); if (State.PivotPoints.Count > 0) { IsMobile = true; PivotPoints.Clear(); for (int i = 0; i < State.PivotPoints.Count; i++) { Transform pivotPointTranform = gameObject.FindOrCreateChild("PivotPoint-" + i.ToString()); pivotPointTranform.localPosition = State.PivotPoints[i]; PivotPoints.Add(pivotPointTranform); } } else { IsMobile = false; } GetNextTarget(); }
public void OnItemOfInterestVisit() { //Debug.Log("On item of interest visit"); Visitable visitable = null; if (worlditem.Is <Visitable>(out visitable)) { Creature creature = null; ITrap trap = null; WorldItem lastItemOfInterest = visitable.LastItemOfInterestToVisit; LandTrap landTrap = null; WaterTrap waterTrap = null; if (lastItemOfInterest.Is <LandTrap>(out landTrap) && !landTrap.Exceptions.Contains(NameOfCreature)) { //Debug.Log("Found a land trap"); landTrap.IntersectingDens.SafeAdd(this); } else if (lastItemOfInterest.Is <WaterTrap>(out waterTrap) && !waterTrap.Exceptions.Contains(NameOfCreature)) { //Debug.Log("Found a water trap"); waterTrap.IntersectingDens.SafeAdd(this); } } }