コード例 #1
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemPlayers   = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemUpdate    = base.Project.FindSubsystem <SubsystemUpdate>(throwOnError: true);
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_sleepStartTime     = valuesDictionary.GetValue <double>("SleepStartTime");
     m_allowManualWakeUp  = valuesDictionary.GetValue <bool>("AllowManualWakeUp");
     if (m_sleepStartTime == 0.0)
     {
         m_sleepStartTime = null;
     }
     if (m_sleepStartTime.HasValue)
     {
         m_sleepFactor = 1f;
         m_minWetness  = float.MaxValue;
     }
     m_componentPlayer.ComponentHealth.Attacked += delegate
     {
         if (IsSleeping && m_componentPlayer.ComponentVitalStats.Sleep > 0.25f)
         {
             WakeUp();
         }
     };
 }
コード例 #2
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemTimeOfDay = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
            m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemPickables = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_componentCreature  = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
            m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>();
            m_componentOnFire    = base.Entity.FindComponent <ComponentOnFire>(throwOnError: true);
            AttackResilience     = valuesDictionary.GetValue <float>("AttackResilience");
            FallResilience       = valuesDictionary.GetValue <float>("FallResilience");
            FireResilience       = valuesDictionary.GetValue <float>("FireResilience");
            CorpseDuration       = valuesDictionary.GetValue <float>("CorpseDuration");
            BreathingMode        = valuesDictionary.GetValue <BreathingMode>("BreathingMode");
            CanStrand            = valuesDictionary.GetValue <bool>("CanStrand");
            Health      = valuesDictionary.GetValue <float>("Health");
            Air         = valuesDictionary.GetValue <float>("Air");
            AirCapacity = valuesDictionary.GetValue <float>("AirCapacity");
            double value = valuesDictionary.GetValue <double>("DeathTime");

            DeathTime    = ((value >= 0.0) ? new double?(value) : null);
            CauseOfDeath = valuesDictionary.GetValue <string>("CauseOfDeath");
            if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && base.Entity.FindComponent <ComponentPlayer>() != null)
            {
                IsInvulnerable = true;
            }
        }
コード例 #3
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemTimeOfDay      = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
            m_subsystemTerrain        = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemBlockBehaviors = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
            m_componentPlayer         = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
            ContainerWidget guiWidget = m_componentPlayer.GuiWidget;

            m_backButtonWidget        = guiWidget.Children.Find <ButtonWidget>("BackButton");
            m_inventoryButtonWidget   = guiWidget.Children.Find <ButtonWidget>("InventoryButton");
            m_clothingButtonWidget    = guiWidget.Children.Find <ButtonWidget>("ClothingButton");
            m_moreButtonWidget        = guiWidget.Children.Find <ButtonWidget>("MoreButton");
            m_moreContentsWidget      = guiWidget.Children.Find <Widget>("MoreContents");
            m_helpButtonWidget        = guiWidget.Children.Find <ButtonWidget>("HelpButton");
            m_photoButtonWidget       = guiWidget.Children.Find <ButtonWidget>("PhotoButton");
            m_lightningButtonWidget   = guiWidget.Children.Find <ButtonWidget>("LightningButton");
            m_timeOfDayButtonWidget   = guiWidget.Children.Find <ButtonWidget>("TimeOfDayButton");
            m_cameraButtonWidget      = guiWidget.Children.Find <ButtonWidget>("CameraButton");
            m_creativeFlyButtonWidget = guiWidget.Children.Find <ButtonWidget>("CreativeFlyButton");
            m_sneakButtonWidget       = guiWidget.Children.Find <ButtonWidget>("SneakButton");
            m_mountButtonWidget       = guiWidget.Children.Find <ButtonWidget>("MountButton");
            m_editItemButton          = guiWidget.Children.Find <ButtonWidget>("EditItemButton");
            MoveWidget                     = guiWidget.Children.Find <TouchInputWidget>("Move");
            MoveRoseWidget                 = guiWidget.Children.Find <MoveRoseWidget>("MoveRose");
            LookWidget                     = guiWidget.Children.Find <TouchInputWidget>("Look");
            ViewWidget                     = m_componentPlayer.ViewWidget;
            HealthBarWidget                = guiWidget.Children.Find <ValueBarWidget>("HealthBar");
            FoodBarWidget                  = guiWidget.Children.Find <ValueBarWidget>("FoodBar");
            TemperatureBarWidget           = guiWidget.Children.Find <ValueBarWidget>("TemperatureBar");
            LevelLabelWidget               = guiWidget.Children.Find <LabelWidget>("LevelLabel");
            m_modalPanelContainerWidget    = guiWidget.Children.Find <ContainerWidget>("ModalPanelContainer");
            ControlsContainerWidget        = guiWidget.Children.Find <ContainerWidget>("ControlsContainer");
            m_leftControlsContainerWidget  = guiWidget.Children.Find <ContainerWidget>("LeftControlsContainer");
            m_rightControlsContainerWidget = guiWidget.Children.Find <ContainerWidget>("RightControlsContainer");
            m_moveContainerWidget          = guiWidget.Children.Find <ContainerWidget>("MoveContainer");
            m_lookContainerWidget          = guiWidget.Children.Find <ContainerWidget>("LookContainer");
            m_moveRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("MoveRectangle");
            m_lookRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("LookRectangle");
            m_moveRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("MoveRectangleContainer");
            m_lookRectangleContainerWidget = guiWidget.Children.Find <ContainerWidget>("LookRectangleContainer");
            m_moveRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("MoveRectangle");
            m_lookRectangleWidget          = guiWidget.Children.Find <RectangleWidget>("LookRectangle");
            m_movePadContainerWidget       = guiWidget.Children.Find <ContainerWidget>("MovePadContainer");
            m_lookPadContainerWidget       = guiWidget.Children.Find <ContainerWidget>("LookPadContainer");
            m_moveButtonsContainerWidget   = guiWidget.Children.Find <ContainerWidget>("MoveButtonsContainer");
            ShortInventoryWidget           = guiWidget.Children.Find <ShortInventoryWidget>("ShortInventory");
            m_largeMessageWidget           = guiWidget.Children.Find <ContainerWidget>("LargeMessage");
            m_messageWidget                = guiWidget.Children.Find <MessageWidget>("Message");
            m_keyboardHelpMessageShown     = valuesDictionary.GetValue <bool>("KeyboardHelpMessageShown");
            m_gamepadHelpMessageShown      = valuesDictionary.GetValue <bool>("GamepadHelpMessageShown");
        }
コード例 #4
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTimeOfDay          = base.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemWeather            = base.Project.FindSubsystem <SubsystemWeather>(throwOnError: true);
     m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemBodies             = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     m_sunTexture    = ContentManager.Get <Texture2D>("Textures/Sun");
     m_glowTexture   = ContentManager.Get <Texture2D>("Textures/SkyGlow");
     m_cloudsTexture = ContentManager.Get <Texture2D>("Textures/Clouds");
     for (int i = 0; i < 8; i++)
     {
         m_moonTextures[i] = ContentManager.Get <Texture2D>("Textures/Moon" + (i + 1).ToString(CultureInfo.InvariantCulture));
     }
     UpdateLightAndViewParameters();
     Display.DeviceReset += Display_DeviceReset;
 }
コード例 #5
0
        protected override void Load(TemplatesDatabase.ValuesDictionary valuesDictionary)
        {
            base.Load(valuesDictionary);
            subsystemPlayers  = Project.FindSubsystem <SubsystemPlayers>();
            subsystemTerrain  = Project.FindSubsystem <SubsystemTerrain>();
            subsystemSky      = Project.FindSubsystem <SubsystemSky>();
            subsystemCreature = Project.FindSubsystem <SubsystemCreatureSpawn>();
            subsystemTime     = Project.FindSubsystem <SubsystemTimeOfDay>();

            LoadCreatureTemplateNames();
            LoadCreatureDatas();

            foreach (KeyValuePair <string, object> pair in valuesDictionary.GetValue <TemplatesDatabase.ValuesDictionary>("Points"))
            {
                var p = Engine.Serialization.HumanReadableConverter.ConvertFromString <Point3>(pair.Key);
                storedPoints[pair.Key] = p;
            }

            InitCommands();
        }
コード例 #6
0
 public RealTimeClockElectricElement(SubsystemElectricity subsystemElectricity, CellFace cellFace)
     : base(subsystemElectricity, cellFace)
 {
     m_subsystemTimeOfDay = base.SubsystemElectricity.Project.FindSubsystem <SubsystemTimeOfDay>(throwOnError: true);
 }