Ejemplo n.º 1
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemBodies = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemAudio  = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemNoise  = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
 }
Ejemplo n.º 2
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
            m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            m_subsystemPickables          = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_componentGui                = base.Entity.FindComponent <ComponentGui>(throwOnError: true);
            m_componentHumanModel         = base.Entity.FindComponent <ComponentHumanModel>(throwOnError: true);
            m_componentBody               = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
            m_componentOuterClothingModel = base.Entity.FindComponent <ComponentOuterClothingModel>(throwOnError: true);
            m_componentVitalStats         = base.Entity.FindComponent <ComponentVitalStats>(throwOnError: true);
            m_componentLocomotion         = base.Entity.FindComponent <ComponentLocomotion>(throwOnError: true);
            m_componentPlayer             = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
            SteedMovementSpeedFactor      = 1f;
            Insulation                    = 0f;
            LeastInsulatedSlot            = ClothingSlot.Feet;
            m_clothes[ClothingSlot.Head]  = new List <int>();
            m_clothes[ClothingSlot.Torso] = new List <int>();
            m_clothes[ClothingSlot.Legs]  = new List <int>();
            m_clothes[ClothingSlot.Feet]  = new List <int>();
            ValuesDictionary value = valuesDictionary.GetValue <ValuesDictionary>("Clothes");

            SetClothes(ClothingSlot.Head, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Head")));
            SetClothes(ClothingSlot.Torso, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Torso")));
            SetClothes(ClothingSlot.Legs, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Legs")));
            SetClothes(ClothingSlot.Feet, HumanReadableConverter.ValuesListFromString <int>(';', value.GetValue <string>("Feet")));
            Display.DeviceReset += Display_DeviceReset;
        }
Ejemplo n.º 3
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            base.Load(valuesDictionary, idToEntityMap);
            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_subsystemPickables        = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
            m_subsystemTerrain          = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
            ComponentGui                = base.Entity.FindComponent <ComponentGui>(throwOnError: true);
            ComponentInput              = base.Entity.FindComponent <ComponentInput>(throwOnError: true);
            ComponentScreenOverlays     = base.Entity.FindComponent <ComponentScreenOverlays>(throwOnError: true);
            ComponentBlockHighlight     = base.Entity.FindComponent <ComponentBlockHighlight>(throwOnError: true);
            ComponentAimingSights       = base.Entity.FindComponent <ComponentAimingSights>(throwOnError: true);
            ComponentMiner              = base.Entity.FindComponent <ComponentMiner>(throwOnError: true);
            ComponentRider              = base.Entity.FindComponent <ComponentRider>(throwOnError: true);
            ComponentSleep              = base.Entity.FindComponent <ComponentSleep>(throwOnError: true);
            ComponentVitalStats         = base.Entity.FindComponent <ComponentVitalStats>(throwOnError: true);
            ComponentSickness           = base.Entity.FindComponent <ComponentSickness>(throwOnError: true);
            ComponentFlu                = base.Entity.FindComponent <ComponentFlu>(throwOnError: true);
            ComponentLevel              = base.Entity.FindComponent <ComponentLevel>(throwOnError: true);
            ComponentClothing           = base.Entity.FindComponent <ComponentClothing>(throwOnError: true);
            ComponentOuterClothingModel = base.Entity.FindComponent <ComponentOuterClothingModel>(throwOnError: true);
            int playerIndex = valuesDictionary.GetValue <int>("PlayerIndex");

            PlayerData = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true).PlayersData.First((PlayerData d) => d.PlayerIndex == playerIndex);
        }
Ejemplo n.º 4
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     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_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemBlockBehaviors     = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     BoxSize                  = valuesDictionary.GetValue <Vector3>("BoxSize");
     Mass                     = valuesDictionary.GetValue <float>("Mass");
     Density                  = valuesDictionary.GetValue <float>("Density");
     AirDrag                  = valuesDictionary.GetValue <Vector2>("AirDrag");
     WaterDrag                = valuesDictionary.GetValue <Vector2>("WaterDrag");
     WaterSwayAngle           = valuesDictionary.GetValue <float>("WaterSwayAngle");
     WaterTurnSpeed           = valuesDictionary.GetValue <float>("WaterTurnSpeed");
     Velocity                 = valuesDictionary.GetValue <Vector3>("Velocity");
     MaxSmoothRiseHeight      = valuesDictionary.GetValue <float>("MaxSmoothRiseHeight");
     ParentBody               = valuesDictionary.GetValue <EntityReference>("ParentBody").GetComponent <ComponentBody>(base.Entity, idToEntityMap, throwIfNotFound: false);
     ParentBodyPositionOffset = valuesDictionary.GetValue <Vector3>("ParentBodyPositionOffset");
     ParentBodyRotationOffset = valuesDictionary.GetValue <Quaternion>("ParentBodyRotationOffset");
     IsSmoothRiseEnabled      = true;
     IsGravityEnabled         = true;
     IsGroundDragEnabled      = true;
     IsWaterDragEnabled       = true;
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemAudio     = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTerrain = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemAudio   = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_impactsSoundsValuesDictionary  = valuesDictionary.GetValue <ValuesDictionary>("ImpactSounds");
     m_footstepSoundsValuesDictionary = valuesDictionary.GetValue <ValuesDictionary>("FootstepSounds");
 }
Ejemplo n.º 7
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemPlayers            = base.Project.FindSubsystem <SubsystemPlayers>(throwOnError: true);
     m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemSky                = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemExplosions         = base.Project.FindSubsystem <SubsystemExplosions>(throwOnError: true);
     m_subsystemBlockBehaviors     = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFireBlockBehavior  = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     foreach (ValuesDictionary item in valuesDictionary.GetValue <ValuesDictionary>("Pickables").Values.Where((object v) => v is ValuesDictionary))
     {
         Pickable pickable = new Pickable();
         pickable.Value        = item.GetValue <int>("Value");
         pickable.Count        = item.GetValue <int>("Count");
         pickable.Position     = item.GetValue <Vector3>("Position");
         pickable.Velocity     = item.GetValue <Vector3>("Velocity");
         pickable.CreationTime = item.GetValue("CreationTime", 0.0);
         if (item.ContainsKey("StuckMatrix"))
         {
             pickable.StuckMatrix = item.GetValue <Matrix>("StuckMatrix");
         }
         m_pickables.Add(pickable);
     }
 }
Ejemplo n.º 8
0
        public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
        {
            m_subsystemGameInfo       = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
            m_subsystemSky            = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
            m_subsystemParticles      = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
            m_subsystemAudio          = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
            m_componentSpawn          = base.Entity.FindComponent <ComponentSpawn>(throwOnError: true);
            m_componentBody           = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
            m_componentHealth         = base.Entity.FindComponent <ComponentHealth>(throwOnError: true);
            m_dayEntityTemplateName   = valuesDictionary.GetValue <string>("DayEntityTemplateName");
            m_nightEntityTemplateName = valuesDictionary.GetValue <string>("NightEntityTemplateName");
            float value = valuesDictionary.GetValue <float>("Probability");

            if (!string.IsNullOrEmpty(m_dayEntityTemplateName))
            {
                DatabaseManager.FindEntityValuesDictionary(m_dayEntityTemplateName, throwIfNotFound: true);
            }
            if (!string.IsNullOrEmpty(m_nightEntityTemplateName))
            {
                DatabaseManager.FindEntityValuesDictionary(m_nightEntityTemplateName, throwIfNotFound: true);
            }
            m_timeToSwitch              = s_random.Float(3f, 15f);
            IsEnabled                   = (s_random.Float(0f, 1f) < value);
            m_componentSpawn.Despawned += ComponentSpawn_Despawned;
        }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemParticles   = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     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
     {
         m_importanceLevel = MathUtils.Lerp(0f, 400f, MathUtils.Saturate((0.75f - m_componentCreature.ComponentHealth.Air) / 0.75f));
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Surface");
         }
     }, null);
     m_stateMachine.AddState("Surface", delegate
     {
         m_componentPathfinding.Stop();
     }, delegate
     {
         _ = m_componentCreature.ComponentBody.Position;
         if (!m_componentPathfinding.Destination.HasValue)
         {
             Vector3?destination = FindSurfaceDestination();
             if (destination.HasValue)
             {
                 float speed = (m_componentCreature.ComponentHealth.Air < 0.25f) ? 1f : m_random.Float(0.4f, 0.6f);
                 m_componentPathfinding.SetDestination(destination, speed, 1f, 0, useRandomMovements: false, ignoreHeightDifference: false, raycastDestination: false, null);
             }
         }
         else if (m_componentPathfinding.IsStuck)
         {
             m_importanceLevel = 0f;
         }
         if (m_componentCreature.ComponentHealth.Air > 0.9f)
         {
             m_stateMachine.TransitionTo("Breathe");
         }
     }, null);
     m_stateMachine.AddState("Breathe", delegate
     {
         Vector3 forward = m_componentCreature.ComponentBody.Matrix.Forward;
         Vector3 value   = m_componentCreature.ComponentBody.Matrix.Translation + 10f * forward + new Vector3(0f, 2f, 0f);
         m_componentPathfinding.SetDestination(value, 0.6f, 1f, 0, useRandomMovements: false, ignoreHeightDifference: false, raycastDestination: false, null);
         m_particleSystem = new WhalePlumeParticleSystem(m_subsystemTerrain, m_random.Float(0.8f, 1.1f), m_random.Float(1f, 1.3f));
         m_subsystemParticles.AddParticleSystem(m_particleSystem);
         m_subsystemAudio.PlayRandomSound("Audio/Creatures/WhaleBlow", 1f, m_random.Float(-0.2f, 0.2f), m_componentCreature.ComponentBody.Position, 10f, autoDelay: true);
     }, delegate
     {
         m_particleSystem.Position = m_componentCreature.ComponentBody.Position + new Vector3(0f, 0.8f * m_componentCreature.ComponentBody.BoxSize.Y, 0f);
         if (!m_subsystemParticles.ContainsParticleSystem(m_particleSystem))
         {
             m_importanceLevel = 0f;
         }
     }, delegate
     {
         m_particleSystem.IsStopped = true;
         m_particleSystem           = null;
     });
 }
Ejemplo n.º 10
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     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_subsystemMetersBlockBehavior = base.Project.FindSubsystem <SubsystemMetersBlockBehavior>(throwOnError: true);
     m_subsystemWeather             = base.Project.FindSubsystem <SubsystemWeather>(throwOnError: true);
     m_componentPlayer              = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_pantingSound          = m_subsystemAudio.CreateSound("Audio/HumanPanting");
     m_pantingSound.IsLooped = true;
     Food                     = valuesDictionary.GetValue <float>("Food");
     Stamina                  = valuesDictionary.GetValue <float>("Stamina");
     Sleep                    = valuesDictionary.GetValue <float>("Sleep");
     Temperature              = valuesDictionary.GetValue <float>("Temperature");
     Wetness                  = valuesDictionary.GetValue <float>("Wetness");
     m_lastFood               = Food;
     m_lastStamina            = Stamina;
     m_lastSleep              = Sleep;
     m_lastTemperature        = Temperature;
     m_lastWetness            = Wetness;
     m_environmentTemperature = Temperature;
     foreach (KeyValuePair <string, object> item in valuesDictionary.GetValue <ValuesDictionary>("Satiation"))
     {
         m_satiation[int.Parse(item.Key, CultureInfo.InvariantCulture)] = (float)item.Value;
     }
     m_componentPlayer.ComponentHealth.Attacked += delegate
     {
         m_lastAttackedTime = m_subsystemTime.GameTime;
     };
 }
Ejemplo n.º 11
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemProjectiles = base.Project.FindSubsystem <SubsystemProjectiles>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     base.Load(valuesDictionary);
 }
Ejemplo n.º 12
0
        public static void OnHitByProjectile(CellFace cellFace, WorldItem worldItem)
        {
            if (worldItem.ToRemove)
            {
                return;
            }
            var blockEntity = GetBlockEntity(cellFace.Point);

            if (blockEntity == null)
            {
                return;
            }
            var inventory = blockEntity.Entity.FindComponent <ComponentInventoryBase>(true);
            var pickable  = worldItem as Pickable;
            int count     = (pickable == null) ? 1 : pickable.Count;
            int value     = worldItem.Value;
            int max       = ComponentInventoryBase.AcquireItems(inventory, value, count);

            if (max < count)
            {
                SubsystemAudio.PlaySound("Audio/PickableCollected", 1f, 0f, worldItem.Position, 3f, true);
            }
            if (max <= 0)
            {
                worldItem.ToRemove = true;
            }
            else if (pickable != null)
            {
                pickable.Count = max;
            }
        }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTime          = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemParticles     = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemViews         = base.Project.FindSubsystem <SubsystemGameWidgets>(throwOnError: true);
     m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemAmbientSounds = base.Project.FindSubsystem <SubsystemAmbientSounds>(throwOnError: true);
     for (int i = -2; i <= 2; i++)
     {
         for (int j = -1; j <= 2; j++)
         {
             for (int k = -2; k <= 2; k++)
             {
                 if (i != 0 || j != 0 || k != 0)
                 {
                     float num = (j < 0) ? 1.5f : 2.5f;
                     if (MathUtils.Sqrt(i * i + j * j + k * k) <= num)
                     {
                         float num2 = MathUtils.Sqrt(i * i + k * k);
                         float num3 = (j > 0) ? (0.5f * (float)j) : ((float)(-j));
                         m_expansionProbabilities[new Point3(i, j, k)] = 0.02f / (num2 + num3);
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 14
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemAudio              = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemSoundMaterials     = base.Project.FindSubsystem <SubsystemSoundMaterials>(throwOnError: true);
     m_subsystemParticles          = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemPickables          = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemBodies             = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemTerrain            = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemSky                = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemTime               = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemNoise              = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemExplosions         = base.Project.FindSubsystem <SubsystemExplosions>(throwOnError: true);
     m_subsystemGameInfo           = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemBlockBehaviors     = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFluidBlockBehavior = base.Project.FindSubsystem <SubsystemFluidBlockBehavior>(throwOnError: true);
     m_subsystemFireBlockBehavior  = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     foreach (ValuesDictionary item in valuesDictionary.GetValue <ValuesDictionary>("Projectiles").Values.Where((object v) => v is ValuesDictionary))
     {
         Projectile projectile = new Projectile();
         projectile.Value        = item.GetValue <int>("Value");
         projectile.Position     = item.GetValue <Vector3>("Position");
         projectile.Velocity     = item.GetValue <Vector3>("Velocity");
         projectile.CreationTime = item.GetValue <double>("CreationTime");
         m_projectiles.Add(projectile);
     }
 }
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemAudio                   = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemGameInfo                = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemFireBlockBehavior       = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_subsystemExplosivesBlockBehavior = base.Project.FindSubsystem <SubsystemExplosivesBlockBehavior>(throwOnError: true);
 }
Ejemplo n.º 16
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     m_subsystemTerrain       = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemBlockEntities = base.Project.FindSubsystem <SubsystemBlockEntities>(throwOnError: true);
     m_subsystemGameInfo      = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemAudio         = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
 }
Ejemplo n.º 17
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_componentMount  = base.Entity.FindComponent <ComponentMount>(throwOnError: true);
     m_componentBody   = base.Entity.FindComponent <ComponentBody>(throwOnError: true);
     m_componentDamage = base.Entity.FindComponent <ComponentDamage>(throwOnError: true);
 }
Ejemplo n.º 18
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     base.Load(valuesDictionary, idToEntityMap);
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemPickables   = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemProjectiles = base.Project.FindSubsystem <SubsystemProjectiles>(throwOnError: true);
     m_componentBlockEntity = base.Entity.FindComponent <ComponentBlockEntity>(throwOnError: true);
 }
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemBodies      = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemTerrain     = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemNoise       = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_componentCreature.ComponentBody.CollidedWithBody += delegate
     {
         if (m_stateMachine.CurrentState != "RunningAway")
         {
             m_stateMachine.TransitionTo("DangerDetected");
         }
     };
     m_stateMachine.AddState("LookingForDanger", null, delegate
     {
         if (ScanForDanger())
         {
             m_stateMachine.TransitionTo("DangerDetected");
         }
     }, null);
     m_stateMachine.AddState("DangerDetected", delegate
     {
         m_importanceLevel = ((m_componentCreature.ComponentHealth.Health < 0.33f) ? 300 : 100);
         m_nextUpdateTime  = 0.0;
     }, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("RunningAway");
             m_nextUpdateTime = 0.0;
         }
     }, null);
     m_stateMachine.AddState("RunningAway", delegate
     {
         m_componentPathfinding.SetDestination(FindSafePlace(), 1f, 1f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
         m_subsystemAudio.PlayRandomSound("Audio/Creatures/Wings", 0.8f, m_random.Float(-0.1f, 0.2f), m_componentCreature.ComponentBody.Position, 3f, autoDelay: true);
         m_componentCreature.ComponentCreatureSounds.PlayPainSound();
         m_subsystemNoise.MakeNoise(m_componentCreature.ComponentBody, 0.25f, 6f);
     }, delegate
     {
         if (!IsActive || !m_componentPathfinding.Destination.HasValue || m_componentPathfinding.IsStuck)
         {
             m_stateMachine.TransitionTo("LookingForDanger");
         }
         else if (ScoreSafePlace(m_componentCreature.ComponentBody.Position, m_componentPathfinding.Destination.Value, null) < 4f)
         {
             m_componentPathfinding.SetDestination(FindSafePlace(), 1f, 0.5f, 0, useRandomMovements: false, ignoreHeightDifference: true, raycastDestination: false, null);
         }
     }, delegate
     {
         m_importanceLevel = 0f;
     });
     m_stateMachine.TransitionTo("LookingForDanger");
 }
Ejemplo n.º 20
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     base.Load(valuesDictionary);
     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_subsystemMovingBlocks                      = base.Project.FindSubsystem <SubsystemMovingBlocks>(throwOnError: true);
     m_subsystemMovingBlocks.Stopped             += MovingBlocksStopped;
     m_subsystemMovingBlocks.CollidedWithTerrain += MovingBlocksCollidedWithTerrain;
 }
Ejemplo n.º 21
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemSky         = base.Project.FindSubsystem <SubsystemSky>(throwOnError: true);
     m_subsystemTime        = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio       = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_componentCreature    = base.Entity.FindComponent <ComponentCreature>(throwOnError: true);
     m_componentPathfinding = base.Entity.FindComponent <ComponentPathfinding>(throwOnError: true);
     m_howlSoundName        = valuesDictionary.GetValue <string>("HowlSoundName");
     m_stateMachine.AddState("Inactive", delegate
     {
         m_importanceLevel = 0f;
     }, delegate
     {
         if (IsActive)
         {
             m_stateMachine.TransitionTo("Howl");
         }
         if (m_subsystemSky.SkyLightIntensity < 0.1f)
         {
             if (m_random.Float(0f, 1f) < 0.015f * m_subsystemTime.GameTimeDelta)
             {
                 m_importanceLevel = m_random.Float(1f, 3f);
             }
         }
         else
         {
             m_importanceLevel = 0f;
         }
     }, null);
     m_stateMachine.AddState("Howl", delegate
     {
         m_howlTime     = 0f;
         m_howlDuration = m_random.Float(5f, 6f);
         m_componentPathfinding.Stop();
         m_importanceLevel = 10f;
     }, delegate
     {
         if (!IsActive)
         {
             m_stateMachine.TransitionTo("Inactive");
         }
         m_componentCreature.ComponentLocomotion.LookOrder = new Vector2(m_componentCreature.ComponentLocomotion.LookOrder.X, 2f);
         float num = m_howlTime + m_subsystemTime.GameTimeDelta;
         if (m_howlTime <= 0.5f && num > 0.5f)
         {
             m_subsystemAudio.PlayRandomSound(m_howlSoundName, 1f, m_random.Float(-0.1f, 0.1f), m_componentCreature.ComponentBody.Position, 10f, autoDelay: true);
         }
         m_howlTime = num;
         if (m_howlTime >= m_howlDuration)
         {
             m_importanceLevel = 0f;
         }
     }, null);
     m_stateMachine.TransitionTo("Inactive");
 }
Ejemplo n.º 22
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     m_subsystemGameInfo  = base.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);
     m_subsystemTerrain   = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemTime      = base.Project.FindSubsystem <SubsystemTime>(throwOnError: true);
     m_subsystemAudio     = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_componentPlayer    = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     m_fluDuration        = valuesDictionary.GetValue <float>("FluDuration");
     m_fluOnset           = valuesDictionary.GetValue <float>("FluOnset");
 }
Ejemplo n.º 23
0
 public override void Load(ValuesDictionary valuesDictionary, IdToEntityMap idToEntityMap)
 {
     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_componentPlayer   = base.Entity.FindComponent <ComponentPlayer>(throwOnError: true);
     StrengthFactor      = 1f;
     SpeedFactor         = 1f;
     HungerFactor        = 1f;
     ResilienceFactor    = 1f;
 }
Ejemplo n.º 24
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");
        }
Ejemplo n.º 25
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     SubsystemAudio        = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_fireSound           = SubsystemAudio.CreateSound("Audio/Fire");
     m_fireSound.IsLooped  = true;
     m_fireSound.Volume    = 0f;
     m_waterSound          = SubsystemAudio.CreateSound("Audio/Water");
     m_waterSound.IsLooped = true;
     m_waterSound.Volume   = 0f;
     m_magmaSound          = SubsystemAudio.CreateSound("Audio/Magma");
     m_magmaSound.IsLooped = true;
     m_magmaSound.Volume   = 0f;
 }
Ejemplo n.º 26
0
 public override void Load(ValuesDictionary valuesDictionary)
 {
     m_subsystemAudio             = base.Project.FindSubsystem <SubsystemAudio>(throwOnError: true);
     m_subsystemParticles         = base.Project.FindSubsystem <SubsystemParticles>(throwOnError: true);
     m_subsystemTerrain           = base.Project.FindSubsystem <SubsystemTerrain>(throwOnError: true);
     m_subsystemNoise             = base.Project.FindSubsystem <SubsystemNoise>(throwOnError: true);
     m_subsystemBodies            = base.Project.FindSubsystem <SubsystemBodies>(throwOnError: true);
     m_subsystemPickables         = base.Project.FindSubsystem <SubsystemPickables>(throwOnError: true);
     m_subsystemProjectiles       = base.Project.FindSubsystem <SubsystemProjectiles>(throwOnError: true);
     m_subsystemBlockBehaviors    = base.Project.FindSubsystem <SubsystemBlockBehaviors>(throwOnError: true);
     m_subsystemFireBlockBehavior = base.Project.FindSubsystem <SubsystemFireBlockBehavior>(throwOnError: true);
     m_explosionParticleSystem    = new ExplosionParticleSystem();
     m_subsystemParticles.AddParticleSystem(m_explosionParticleSystem);
 }
Ejemplo n.º 27
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);
            }
        }
 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");
 }
Ejemplo n.º 29
0
 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");
 }
Ejemplo n.º 30
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");
 }