예제 #1
0
 public void OnTakeDamage( )
 {
     //add the structure's interior to load in case we break through
     if (dynamic.ParentStructure != null)
     {
         Structures.AddInteriorToLoad(dynamic.ParentStructure);
     }
 }
예제 #2
0
파일: Window.cs 프로젝트: yazici/FRONTIERS
 public void OnDie( )
 {
     //force the interior to load since we're now missing a window forever
     if (dynamic.ParentStructure != null)
     {
         dynamic.ParentStructure.State.ForceBuildInterior = true;
         Structures.AddInteriorToLoad(dynamic.ParentStructure);
     }
 }
예제 #3
0
 public void OnDie( )
 {
     //force the interior to load since we're now missing a door
     if (State.TriggerStructureLoad)
     {
         if (dynamic.ParentStructure != null)
         {
             dynamic.ParentStructure.State.ForceBuildInterior = true;
             Structures.AddInteriorToLoad(dynamic.ParentStructure);
         }
     }
 }
예제 #4
0
        public bool WaitForStructure( )
        {
            if (TargetStructure == null)
            {
                WorldItem childItem = null;
                if (WIGroups.FindChildItem(TargetStructureReference.GroupPath, TargetStructureReference.FileName, out childItem))
                {
                    TargetStructure = childItem.Get <Structure> ();
                    if (TargetStructure != null)
                    {
                        TargetStructure.worlditem.ActiveState = WIActiveState.Active;
                        //TODO remove this lock, could be dangerous
                        TargetStructure.worlditem.ActiveStateLocked = true;
                        Structures.AddInteriorToLoad(TargetStructure);
                    }
                    else
                    {
                        Debug.LogError("Target structure " + TargetStructureReference.FullPath + " had no structure wiscript");
                        return(true);
                    }
                }
                else
                {
                    Debug.LogError("Couldn't find structure " + TargetStructureReference.FullPath);
                    return(true);
                }
            }

            if (TargetStructure.Is(TargetLoadState))
            {
                if (mPaddedStartTime < 0)
                {
                    mPaddedStartTime = WorldClock.AdjustedRealTime + 1.5;
                    return(true);
                }
                else if (WorldClock.AdjustedRealTime > mPaddedStartTime)
                {
                    return(false);
                }
            }
            else
            {
                mPaddedStartTime = -1;
            }
            return(true);
        }
예제 #5
0
        public IEnumerator SendPlayerToHealingBed()
        {
            worlditem.ActiveState = WIActiveState.Active;
            Structure structure = worlditem.Get <Structure>();

            while (!structure.Is(StructureLoadState.ExteriorLoaded))
            {
                yield return(null);
            }
            Structures.AddInteriorToLoad(structure);
            while (!structure.Is(StructureLoadState.InteriorLoaded))
            {
                yield return(null);
            }
            Player.Local.Spawn();
            //find the first bed
            List <WorldItem> bedWorldItems = structure.StructureGroup.GetChildrenOfType(new List <string>()
            {
                "Bed"
            });

            while (bedWorldItems.Count == 0)
            {
                double waitUntil = Frontiers.WorldClock.AdjustedRealTime + 0.1f;
                while (Frontiers.WorldClock.AdjustedRealTime < waitUntil)
                {
                    yield return(null);
                }
                bedWorldItems = structure.StructureGroup.GetChildrenOfType(new List <string>()
                {
                    "Bed"
                });
            }
            WorldItem bedWorldItem = bedWorldItems[UnityEngine.Random.Range(0, bedWorldItems.Count)];
            Bed       bed          = bedWorldItem.Get <Bed>();

            Player.Local.transform.position = bed.BedsidePosition;
            bed.TryToSleep(WorldClock.Get.TimeOfDayAfter(WorldClock.TimeOfDayCurrent));
            yield break;
        }