示例#1
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");
        }
示例#2
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     ExplosionPressure = valuesDictionary.GetValue("ExplosionPressure", 60f);
     MineType          = valuesDictionary.GetValue <MineType>("Type", 0);
     Delay             = valuesDictionary.GetValue("Delay", .0);
     (ComponentBody = Entity.FindComponent <ComponentBody>(true)).CollidedWithBody += CollidedWithBody;
     if ((MineType & MineType.Torpedo) != 0)
     {
         ComponentBody.Density = .8f;
     }
 }
示例#3
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     //base.Load(valuesDictionary, idToEntityMap);
     m_matchedIngredients = new string[36];
     this.LoadItems(valuesDictionary);
     //m_subsystemExplosions = Project.FindSubsystem<SubsystemExplosions>(true);
     m_componentBlockEntity = Entity.FindComponent <ComponentBlockEntity>(true);
     m_fireTimeRemaining    = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     m_furnaceSize          = SlotsCount - 5;
     m_fireTimeRemaining    = valuesDictionary.GetValue("FireTimeRemaining", 0f);
     m_updateSmeltingRecipe = true;
 }
示例#4
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain  = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_alwaysEnabled     = valuesDictionary.GetValue <bool>("AlwaysEnabled");
     m_jumpStrength      = valuesDictionary.GetValue <float>("JumpStrength");
     m_componentCreature.ComponentBody.CollidedWithBody += delegate
     {
         m_collidedWithBody = true;
     };
 }
示例#5
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            ComponentFrame      = base.Entity.FindComponent <ComponentFrame>(throwOnError: true);
            ComponentCreature   = base.Entity.FindComponent <ComponentCreature>();
            AutoDespawn         = valuesDictionary.GetValue <bool>("AutoDespawn");
            double value  = valuesDictionary.GetValue <double>("SpawnTime");
            double value2 = valuesDictionary.GetValue <double>("DespawnTime");

            SpawnDuration   = 2f;
            DespawnDuration = 2f;
            SpawnTime       = ((value < 0.0) ? m_subsystemGameInfo.TotalElapsedGameTime : value);
            DespawnTime     = ((value2 >= 0.0) ? new double?(value2) : null);
        }
示例#6
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = m_random.Float(0f, 1f);
     }, delegate
     {
         if (m_random.Float(0f, 1f) < 0.05f * m_subsystemTime.GameTimeDelta)
         {
             m_importanceLevel = m_random.Float(1f, 2f);
         }
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Walk");
         }
     }, null);
     m_stateMachine.AddState("Walk", delegate
     {
         float speed = (m_componentCreature.ComponentBody.ImmersionFactor > 0.5f) ? 1f : m_random.Float(0.25f, 0.35f);
         m_componentPathfinding.SetDestination(FindDestination(), speed, 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
     }, delegate
     {
         if (m_componentPathfinding.IsStuck || !IsActive)
         {
             m_stateMachine.TransitionTo("Inactive");
         }
         if (!m_componentPathfinding.Destination.HasValue)
         {
             if (m_random.Float(0f, 1f) < 0.5f)
             {
                 m_stateMachine.TransitionTo("Inactive");
             }
             else
             {
                 m_stateMachine.TransitionTo(null);
                 m_stateMachine.TransitionTo("Walk");
             }
         }
         if (m_random.Float(0f, 1f) < 0.1f * m_subsystemTime.GameTimeDelta)
         {
             m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: false);
         }
         m_componentCreature.ComponentCreatureModel.LookRandomOrder = true;
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain      = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime         = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_componentCreature     = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding  = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_componentHerdBehavior = base.Entity.FindComponent <ComponentHerdBehavior>();
     m_componentCreature.ComponentHealth.Attacked += delegate(ComponentCreature attacker)
     {
         SwimAwayFrom(attacker.ComponentBody);
     };
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = 0f;
         m_attacker        = null;
     }, delegate
     {
         if (m_attacker != null)
         {
             m_timeToForgetAttacker -= m_subsystemTime.GameTimeDelta;
             if (m_timeToForgetAttacker <= 0f)
             {
                 m_attacker = null;
             }
         }
         if (m_componentCreature.ComponentHealth.HealthChange < 0f)
         {
             m_importanceLevel = ((m_componentCreature.ComponentHealth.Health < 0.33f) ? 300 : 100);
         }
         else if (m_attacker != null && Vector3.DistanceSquared(m_attacker.Position, m_componentCreature.ComponentBody.Position) < 25f)
         {
             m_importanceLevel = 100f;
         }
         if (IsActive)
         {
             m_stateMachine.TransitionTo("SwimmingAway");
         }
     }, null);
     m_stateMachine.AddState("SwimmingAway", delegate
     {
         m_componentPathfinding.SetDestination(FindSafePlace(), 1f, 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
     }, delegate
     {
         if (!IsActive || !m_componentPathfinding.Destination.HasValue || m_componentPathfinding.IsStuck)
         {
             m_stateMachine.TransitionTo("Inactive");
         }
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
示例#8
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemSky   = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
            m_componentFrame = base.Entity.FindComponent <ComponentFrame>(throwOnError: true);
            string value = valuesDictionary.GetValue <string>("ModelName");

            Model       = ContentManager.Get <Model>(value);
            CastsShadow = valuesDictionary.GetValue <bool>("CastsShadow");
            string value2 = valuesDictionary.GetValue <string>("TextureOverride");

            TextureOverride        = (string.IsNullOrEmpty(value2) ? null : ContentManager.Get <Texture2D>(value2));
            PrepareOrder           = valuesDictionary.GetValue <int>("PrepareOrder");
            m_boundingSphereRadius = valuesDictionary.GetValue <float>("BoundingSphereRadius");
        }
示例#9
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime          = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemCreatureSpawn = base.Project.FindSubsystem <SubsystemCreatureSpawn>(throwOnError: true);
     m_componentCreature      = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding   = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_componentHerdBehavior  = base.Entity.FindComponent <ComponentHerdBehavior>(throwOnError: true);
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = 0f;
         m_driveVector     = Vector3.Zero;
     }, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Drive");
         }
         if (m_driveVector.Length() > 3f)
         {
             m_importanceLevel = 7f;
         }
         FadeDriveVector();
     }, null);
     m_stateMachine.AddState("Drive", delegate
     {
     }, delegate
     {
         if (!IsActive)
         {
             m_stateMachine.TransitionTo("Inactive");
         }
         if (m_driveVector.LengthSquared() < 1f || m_componentPathfinding.IsStuck)
         {
             m_importanceLevel = 0f;
         }
         if (m_random.Float(0f, 1f) < 0.1f * m_subsystemTime.GameTimeDelta)
         {
             m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: true);
         }
         if (m_random.Float(0f, 1f) < 3f * m_subsystemTime.GameTimeDelta)
         {
             Vector3 v   = CalculateDriveDirectionAndSpeed();
             float speed = MathUtils.Saturate(0.2f * v.Length());
             m_componentPathfinding.SetDestination(m_componentCreature.ComponentBody.Position + 15f * Vector3.Normalize(v), speed, 5f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
         }
         FadeDriveVector();
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
示例#10
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_componentCreature  = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentFishModel = base.Entity.FindComponent <ComponentFishModel>(throwOnError: true);
     m_stateMachine.AddState("Inactive", null, delegate
     {
         if (IsOutOfWater())
         {
             m_outOfWaterTime += m_subsystemTime.GameTimeDelta;
         }
         else
         {
             m_outOfWaterTime = 0f;
         }
         if (m_outOfWaterTime > 3f)
         {
             m_importanceLevel = 1000f;
         }
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Jump");
         }
     }, null);
     m_stateMachine.AddState("Jump", null, delegate
     {
         m_componentFishModel.BendOrder = 2f * (2f * MathUtils.Saturate(SimplexNoise.OctavedNoise((float)MathUtils.Remainder(m_subsystemTime.GameTime, 1000.0), 1.2f * m_componentCreature.ComponentLocomotion.TurnSpeed, 1, 1f, 1f)) - 1f);
         if (!IsActive)
         {
             m_stateMachine.TransitionTo("Inactive");
         }
         if (!IsOutOfWater())
         {
             m_importanceLevel = 0f;
         }
         if (m_random.Float(0f, 1f) < 2.5f * m_subsystemTime.GameTimeDelta)
         {
             m_componentCreature.ComponentLocomotion.JumpOrder = m_random.Float(0.33f, 1f);
             m_direction = new Vector2(MathUtils.Sign(m_componentFishModel.BendOrder.Value), 0f);
         }
         if (!m_componentCreature.ComponentBody.StandingOnValue.HasValue)
         {
             m_componentCreature.ComponentLocomotion.TurnOrder = new Vector2(0f - m_componentFishModel.BendOrder.Value, 0f);
             m_componentCreature.ComponentLocomotion.WalkOrder = m_direction;
         }
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTerrain        = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemModelsRenderer = base.Project.FindSubsystem <SubsystemModelsRenderer>(throwOnError: true);
     m_subsystemNoise          = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_componentMiner          = base.Entity.FindComponent <ComponentMiner>();
     m_componentRider          = base.Entity.FindComponent <ComponentRider>();
     m_componentSleep          = base.Entity.FindComponent <ComponentSleep>();
     m_componentPlayer         = base.Entity.FindComponent <ComponentPlayer>();
     m_walkAnimationSpeed      = valuesDictionary.GetValue <float>("WalkAnimationSpeed");
     m_walkBobHeight           = valuesDictionary.GetValue <float>("WalkBobHeight");
     m_walkLegsAngle           = valuesDictionary.GetValue <float>("WalkLegsAngle");
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemSky      = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemGameInfo = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentCreature.ComponentHealth.Attacked += delegate(ComponentCreature attacker)
     {
         if (DeathPhase == 0f && m_componentCreature.ComponentHealth.Health == 0f)
         {
             DeathCauseOffset = attacker.ComponentBody.BoundingBox.Center() - m_componentCreature.ComponentBody.BoundingBox.Center();
         }
     };
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemSoundMaterials = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
     m_walkAnimationSpeed      = valuesDictionary.GetValue <float>("WalkAnimationSpeed");
     m_walkFrontLegsAngle      = valuesDictionary.GetValue <float>("WalkFrontLegsAngle");
     m_walkHindLegsAngle       = valuesDictionary.GetValue <float>("WalkHindLegsAngle");
     m_canterLegsAngleFactor   = valuesDictionary.GetValue <float>("CanterLegsAngleFactor");
     m_walkBobHeight           = valuesDictionary.GetValue <float>("WalkBobHeight");
     m_moveLegWhenFeeding      = valuesDictionary.GetValue <bool>("MoveLegWhenFeeding");
     m_canCanter      = valuesDictionary.GetValue <bool>("CanCanter");
     m_canTrot        = valuesDictionary.GetValue <bool>("CanTrot");
     m_useCanterSound = valuesDictionary.GetValue <bool>("UseCanterSound");
 }
示例#14
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemExplosions  = base.Project.FindSubsystem <SubsystemExplosions>(throwOnError: true);
     m_componentBlockEntity = base.Entity.FindComponent <ComponentBlockEntity>(throwOnError: true);
     m_furnaceSize          = SlotsCount - 3;
     if (m_furnaceSize < 1 || m_furnaceSize > 3)
     {
         throw new InvalidOperationException("Invalid furnace size.");
     }
     m_fireTimeRemaining    = valuesDictionary.GetValue <float>("FireTimeRemaining");
     m_heatLevel            = valuesDictionary.GetValue <float>("HeatLevel");
     m_updateSmeltingRecipe = true;
 }
示例#15
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemTime          = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemTerrain       = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemAmbientSounds = base.Project.FindSubsystem <SubsystemAmbientSounds>(throwOnError: true);
            m_subsystemParticles     = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            ComponentBody            = base.Entity.FindComponent <ComponentBody>();
            float value = valuesDictionary.GetValue <float>("FireDuration");

            if (value > 0f)
            {
                SetOnFire(null, value);
            }
        }
示例#16
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemAudio     = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_componentBody      = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
     m_componentOnFire    = base.Entity.FindComponent <ComponentOnFire>();
     Hitpoints            = valuesDictionary.GetValue <float>("Hitpoints");
     AttackResilience     = valuesDictionary.GetValue <float>("AttackResilience");
     m_fallResilience     = valuesDictionary.GetValue <float>("FallResilience");
     m_fireResilience     = valuesDictionary.GetValue <float>("FireResilience");
     m_debrisTextureSlot  = valuesDictionary.GetValue <int>("DebrisTextureSlot");
     m_debrisStrength     = valuesDictionary.GetValue <float>("DebrisStrength");
     m_debrisScale        = valuesDictionary.GetValue <float>("DebrisScale");
     DamageSoundName      = valuesDictionary.GetValue <string>("DestructionSoundName");
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_stateMachine.AddState("Inactive", null, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Fly");
         }
     }, null);
     m_stateMachine.AddState("Stuck", delegate
     {
         m_stateMachine.TransitionTo("Fly");
         if (m_random.Float(0f, 1f) < 0.5f)
         {
             m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: false);
             m_importanceLevel = 1f;
         }
     }, null, null);
     m_stateMachine.AddState("Fly", delegate
     {
         m_angle = m_random.Float(0f, (float)Math.PI * 2f);
         m_componentPathfinding.Stop();
     }, delegate
     {
         Vector3 position = m_componentCreature.ComponentBody.Position;
         if (!m_componentPathfinding.Destination.HasValue)
         {
             float num      = (m_random.Float(0f, 1f) < 0.2f) ? m_random.Float(0.4f, 0.6f) : (0f - m_random.Float(0.4f, 0.6f));
             m_angle        = MathUtils.NormalizeAngle(m_angle + num);
             Vector2 vector = Vector2.CreateFromAngle(m_angle);
             Vector3 value  = position + new Vector3(vector.X, 0f, vector.Y) * 10f;
             value.Y        = EstimateHeight(new Vector2(value.X, value.Z), 8) + m_random.Float(3f, 5f);
             m_componentPathfinding.SetDestination(value, m_random.Float(0.6f, 1.05f), 6f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
             if (m_random.Float(0f, 1f) < 0.15f)
             {
                 m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: false);
             }
         }
         else if (m_componentPathfinding.IsStuck)
         {
             m_stateMachine.TransitionTo("Stuck");
         }
     }, null);
 }
示例#18
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            base.Load(valuesDictionary, idToEntityMap);
            m_componentBody  = Entity.FindComponent <ComponentBody>(true);
            componentDamage  = Entity.FindComponent <ComponentDamage>();
            m_componentMount = Entity.FindComponent <ComponentMount>(true);
            if ((ComponentEngine = Entity.FindComponent <ComponentEngine>()) != null)
            {
                m_componentBody.CollidedWithBody += CollidedWithBody;
            }
            else
            {
                ParentBody = valuesDictionary.GetValue("ParentBody", default(EntityReference)).GetComponent <ComponentTrain>(Entity, idToEntityMap, false);
            }

            Direction = valuesDictionary.GetValue("Direction", 0);
        }
示例#19
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemBodies      = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_componentMount       = base.Entity.FindComponent <ComponentMount>(throwOnError: true);
     m_isEnabled            = base.Entity.ValuesDictionary.DatabaseObject.Name.EndsWith("_Saddled");
     m_stateMachine.AddState("Inactive", null, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Wait");
         }
     }, null);
     m_stateMachine.AddState("Wait", delegate
     {
         ComponentRider componentRider = FindNearbyRider(6f);
         if (componentRider != null)
         {
             m_componentPathfinding.SetDestination(componentRider.ComponentCreature.ComponentBody.Position, m_random.Float(0.2f, 0.3f), 3.25f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
             if (m_random.Float(0f, 1f) < 0.5f)
             {
                 m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: true);
             }
         }
     }, delegate
     {
         if (m_componentMount.Rider != null)
         {
             m_stateMachine.TransitionTo("Steed");
         }
         m_componentCreature.ComponentCreatureModel.LookRandomOrder = true;
     }, null);
     m_stateMachine.AddState("Steed", delegate
     {
         m_componentPathfinding.Stop();
         m_speed      = 0f;
         m_speedLevel = 1;
     }, delegate
     {
         ProcessRidingOrders();
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
示例#20
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime                  = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemSky                   = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_componentCreature              = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding           = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_subsystemCampfireBlockBehavior = base.Project.FindSubsystem <SubsystemCampfireBlockBehavior>(throwOnError: true);
     m_dayRange            = valuesDictionary.GetValue <float>("DayRange");
     m_nightRange          = valuesDictionary.GetValue <float>("NightRange");
     m_periodicEventOffset = m_random.Float(0f, 10f);
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = 0f;
         m_target          = null;
     }, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo((m_importanceLevel < 10f) ? "Circle" : "Move");
         }
         else if (m_subsystemTime.PeriodicGameTimeEvent(1.0, m_periodicEventOffset))
         {
             m_target = FindTarget(out float targetScore);
             if (m_target.HasValue)
             {
                 if (m_random.Float(0f, 1f) < 0.015f)
                 {
                     m_ignoreFireUntil = m_subsystemTime.GameTime + 20.0;
                 }
                 Vector3.Distance(m_target.Value, m_componentCreature.ComponentBody.Position);
                 if (m_subsystemTime.GameTime < m_ignoreFireUntil)
                 {
                     m_importanceLevel = 0f;
                 }
                 else
                 {
                     m_importanceLevel = ((targetScore > 0.5f) ? 250f : m_random.Float(1f, 5f));
                 }
             }
             else
             {
                 m_importanceLevel = 0f;
             }
         }
     }, null);
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_stateMachine.AddState("Inactive", null, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Swim");
         }
     }, null);
     m_stateMachine.AddState("Stuck", delegate
     {
         if (m_random.Float(0f, 1f) < 0.5f)
         {
             m_importanceLevel = 1f;
         }
         m_stateMachine.TransitionTo("Swim");
     }, null, null);
     m_stateMachine.AddState("Swim", delegate
     {
         m_componentPathfinding.Stop();
     }, delegate
     {
         _ = m_componentCreature.ComponentBody.Position;
         if (!m_componentPathfinding.Destination.HasValue)
         {
             Vector3?destination = FindDestination();
             if (destination.HasValue)
             {
                 m_componentPathfinding.SetDestination(destination, m_random.Float(0.3f, 0.4f), 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
             }
             else
             {
                 m_importanceLevel = 1f;
             }
         }
         else if (m_componentPathfinding.IsStuck)
         {
             m_stateMachine.TransitionTo("Stuck");
         }
     }, null);
 }
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            int value = valuesDictionary.GetValue <int>("SlotsCount");

            for (int i = 0; i < value; i++)
            {
                m_slots.Add(new Slot());
            }
            ValuesDictionary value2 = valuesDictionary.GetValue <ValuesDictionary>("Slots");

            for (int j = 0; j < m_slots.Count; j++)
            {
                ValuesDictionary value3 = value2.GetValue <ValuesDictionary>("Slot" + j.ToString(CultureInfo.InvariantCulture), null);
                if (value3 != null)
                {
                    Slot slot = m_slots[j];
                    slot.Value = value3.GetValue <int>("Contents");
                    slot.Count = value3.GetValue <int>("Count");
                }
            }
        }
示例#23
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            base.Load(valuesDictionary, idToEntityMap);
            Period   = valuesDictionary.GetValue("Period", 4000);
            LastTime = valuesDictionary.GetValue("LastTime", 900.0);
            float[] dGenes = new float[68], rGenes = new float[68];
            var     s      = valuesDictionary.GetValue("Genome", string.Empty).Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            if (s.Length == 0)
            {
                Genome = new Genome();
                return;
            }
            for (int i = 0; i < s.Length; i++)
            {
                int n = s[i].IndexOf(',');
                dGenes[i] = float.Parse(n > 0 ? s[i].Substring(0, n) : s[i], CultureInfo.InvariantCulture);
                rGenes[i] = n > 0 ? float.Parse(s[i].Substring(n + 1), CultureInfo.InvariantCulture) : dGenes[i];
            }
            Genome = new Genome(dGenes, rGenes);
        }
示例#24
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime           = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemSoundMaterials = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
     m_componentCreature       = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_idleSound              = valuesDictionary.GetValue <string>("IdleSound");
     m_painSound              = valuesDictionary.GetValue <string>("PainSound");
     m_moanSound              = valuesDictionary.GetValue <string>("MoanSound");
     m_sneezeSound            = valuesDictionary.GetValue <string>("SneezeSound");
     m_coughSound             = valuesDictionary.GetValue <string>("CoughSound");
     m_pukeSound              = valuesDictionary.GetValue <string>("PukeSound");
     m_attackSound            = valuesDictionary.GetValue <string>("AttackSound");
     m_idleSoundMinDistance   = valuesDictionary.GetValue <float>("IdleSoundMinDistance");
     m_painSoundMinDistance   = valuesDictionary.GetValue <float>("PainSoundMinDistance");
     m_moanSoundMinDistance   = valuesDictionary.GetValue <float>("MoanSoundMinDistance");
     m_sneezeSoundMinDistance = valuesDictionary.GetValue <float>("SneezeSoundMinDistance");
     m_coughSoundMinDistance  = valuesDictionary.GetValue <float>("CoughSoundMinDistance");
     m_pukeSoundMinDistance   = valuesDictionary.GetValue <float>("PukeSoundMinDistance");
     m_attackSoundMinDistance = valuesDictionary.GetValue <float>("AttackSoundMinDistance");
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTime     = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_componentCreature = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = m_random.Float(0f, 1f);
     }, delegate
     {
         if (m_componentCreature.ComponentBody.StandingOnValue.HasValue && m_random.Float(0f, 1f) < 0.05f * m_subsystemTime.GameTimeDelta)
         {
             m_importanceLevel = m_random.Float(1f, 5f);
         }
         if (IsActive)
         {
             m_stateMachine.TransitionTo("LookAround");
         }
     }, null);
     m_stateMachine.AddState("LookAround", delegate
     {
         m_lookAroundTime = m_random.Float(8f, 15f);
     }, delegate
     {
         if (!IsActive)
         {
             m_stateMachine.TransitionTo("Inactive");
         }
         else if (m_lookAroundTime <= 0f)
         {
             m_importanceLevel = 0f;
         }
         else if (m_random.Float(0f, 1f) < 0.1f * m_subsystemTime.GameTimeDelta)
         {
             m_componentCreature.ComponentCreatureSounds.PlayIdleSound(skipIfRecentlyPlayed: false);
         }
         m_componentCreature.ComponentCreatureModel.LookRandomOrder = true;
         m_lookAroundTime -= m_subsystemTime.GameTimeDelta;
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
        //private TerrainRaycastResult terrainRaycastResult;

        protected override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            base.Load(valuesDictionary, idToEntityMap);
            m_componentPlayer = Entity.FindComponent <ComponentPlayer>(true);
            //pilot = Entity.FindComponent<ComponentPilot>(true);
            m_subsystemTerrain  = Project.FindSubsystem <SubsystemTerrain>(true);
            m_subsystemGameInfo = Project.FindSubsystem <SubsystemGameInfo>(true);

            names.Add("Round");
            names.Add("Sphere");
            names.Add("Prism");
            names.Add("Square");
            names.Add("Frame or box");
            names.Add("Maze");
            names.Add("Mountain");
            names.Add("Line");
            names.Add("Coppy/Paste zone in file");
            names.Add("Fast Run");


            m_cameras.Add(new DebugCamera(m_componentPlayer.View));



            Directory.CreateDirectory(ZoneDialog.Path_mod);


            foreach (string category in names)
            {
                m_categories.Add(new Category()
                {
                    Name = category,
                });
            }



            this.LoadBTN();
        }
示例#27
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemTerrain        = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemBodies         = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemMovingBlocks   = base.Project.FindSubsystem <SubsystemMovingBlocks>(throwOnError: true);
     m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTime           = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemSoundMaterials = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
     m_subsystemBlockBehaviors = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     ComponentCreature         = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     ComponentPlayer           = base.Entity.FindComponent <ComponentPlayer>();
     if (m_subsystemGameInfo.WorldSettings.GameMode == GameMode.Creative && ComponentPlayer != null)
     {
         Inventory = base.Entity.FindComponent <ComponentCreativeInventory>();
     }
     else
     {
         Inventory = base.Entity.FindComponent <ComponentInventory>();
     }
     AttackPower = valuesDictionary.GetValue <float>("AttackPower");
 }
示例#28
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     this.LoadItems(valuesDictionary);
     m_componentBlockEntity = Entity.FindComponent <ComponentBlockEntity>(true);
 }
示例#29
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     Position = valuesDictionary.GetValue <Vector3>("Position");
     Rotation = valuesDictionary.GetValue <Quaternion>("Rotation");
 }
示例#30
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     per = valuesDictionary.GetValue <int>("Per");
 }