コード例 #1
0
 public void AddThought(Thought.ThoughtType type)
 {
     if (!HasThought(type))
     {
         AddThought(Thought.CreateStandardThought(type, PlayState.Time.CurrentDate), true);
     }
 }
コード例 #2
0
        public static Body GenerateTestSeketon(WorldManager world, Vector3 position)
        {
            CreatureDef dwarfDef = ContentPaths.LoadFromJson <CreatureDef>(ContentPaths.Entities.Skeleton.skeleton);
            Creature    toReturn = new Creature(world.ComponentManager, position, dwarfDef, "Skeleton", 0, "Undead");

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, world.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
コード例 #3
0
ファイル: EntityFactory.cs プロジェクト: Solsund/dwarfcorp
        public static Body GenerateTestMoleman(Vector3 position)
        {
            CreatureDef dwarfDef = ContentPaths.LoadFromJson <CreatureDef>(ContentPaths.Entities.Moleman.moleman);
            Creature    toReturn = new Creature(position, dwarfDef, "Moleman Miner", 0, "Molemen");

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, PlayState.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
コード例 #4
0
ファイル: EntityFactory.cs プロジェクト: Solsund/dwarfcorp
        public static GameComponent GenerateDwarf(Vector3 position,
                                                  ComponentManager componentManager,
                                                  ContentManager content,
                                                  GraphicsDevice graphics,
                                                  ChunkManager chunkManager, Camera camera,
                                                  Faction faction, PlanService planService, string allies, EmployeeClass dwarfClass, int level)
        {
            CreatureStats stats    = new CreatureStats(dwarfClass, level);
            Dwarf         toReturn = new Dwarf(stats, allies, planService, faction, "Dwarf", chunkManager, graphics, content, dwarfClass, position);

            toReturn.AI.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, PlayState.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
コード例 #5
0
        public Thought AddThought(String Description, TimeSpan TimeLimit, float HappinessModifier)
        {
            var r = new Thought
            {
                Description       = Description,
                TimeLimit         = TimeLimit,
                HappinessModifier = HappinessModifier,
                TimeStamp         = Manager.World.Time.CurrentDate
            };

            Physics.GetComponent <DwarfThoughts>()?.AddThought(r);

            return(r);
        }
コード例 #6
0
        public static GameComponent GenerateDwarf(
            Vector3 Position,
            ComponentManager Manager,
            string Allies,
            EmployeeClass DwarfClass,
            int Level, Gender gender, int seed)
        {
            Dwarf toReturn = new Dwarf(Manager, new CreatureStats(DwarfClass, Level)
            {
                Gender = gender, RandomSeed = seed, VoicePitch = CreatureStats.GetRandomVoicePitch(gender)
            }, Allies, Manager.World.PlanService, Manager.World.PlayerFaction, "Dwarf", DwarfClass, Position);

            toReturn.AddThought(Thought.CreateStandardThought(Thought.ThoughtType.JustArrived, Manager.World.Time.CurrentDate), false);
            return(toReturn.Physics);
        }
コード例 #7
0
        /// <summary> Add a custom thought to the creature </summary>
        public void AddThought(Thought thought)
        {
            if (HasThought(thought.Description))
            {
                return;
            }

            Thoughts.Add(thought);

            var good      = thought.HappinessModifier > 0;
            var textColor = good ? GameSettings.Default.Colors.GetColor("Positive", Color.Green) : GameSettings.Default.Colors.GetColor("Negative", Color.Red);
            var prefix    = good ? "+" : "";
            var postfix   = good ? ":)" : ":(";

            IndicatorManager.DrawIndicator(prefix + thought.HappinessModifier + " " + postfix, Creature.Physics.Position + Vector3.Up + MathFunctions.RandVector3Cube() * 0.5f, 1.0f, textColor);
        }
コード例 #8
0
        /// <summary> Add a standard thought to the creature. </summary>
        public void AddThought(Thought.ThoughtType type)
        {
            if (!HasThought(type))
            {
                var thought = Thought.CreateStandardThought(type, Manager.World.Time.CurrentDate);
                AddThought(thought, true);

                if (thought.HappinessModifier > 0.01)
                {
                    Creature.NoiseMaker.MakeNoise("Pleased", Position, true);
                }
                else
                {
                    Creature.NoiseMaker.MakeNoise("Tantrum", Position, true);
                }
            }
        }
コード例 #9
0
ファイル: CreatureAI.cs プロジェクト: KingMoo1213/dwarfcorp
        public void AddThought(Thought thought, bool allowDuplicates)
        {
            if (allowDuplicates)
            {
                Thoughts.Add(thought);
            }
            else
            {
                if (HasThought(thought.Type))
                {
                    return;
                }

                Thoughts.Add(thought);
            }
            bool good = thought.HappinessModifier > 0;
            Color textColor = good ? Color.Yellow : Color.Red;
            string prefix = good ? "+" : "";
            string postfix = good ? ":)" : ":(";
            IndicatorManager.DrawIndicator(prefix + thought.HappinessModifier + " " + postfix, Position + Vector3.Up + MathFunctions.RandVector3Cube() *0.5f, 1.0f, textColor);
        }
コード例 #10
0
 public override void OnApply(Creature creature)
 {
     SavedThought = creature.AddThought(Description, new TimeSpan(1, 0, 0, 0), HappinessModifier);
     base.OnApply(creature);
 }
コード例 #11
0
ファイル: Creature.cs プロジェクト: polytronicgr/dwarfcorp
 public void AddThought(Thought thought, bool allowDuplicates)
 {
     Physics.GetComponent <DwarfThoughts>()?.AddThought(thought, allowDuplicates);
 }
コード例 #12
0
ファイル: CreatureAI.cs プロジェクト: maroussil/dwarfcorp
        public void AddThought(Thought thought, bool allowDuplicates)
        {
            if (allowDuplicates)
            {
                Thoughts.Add(thought);
            }
            else
            {
                if (HasThought(thought.Type))
                {
                    return;
                }

                Thoughts.Add(thought);
            }
            bool good = thought.HappinessModifier > 0;
            Color textColor = good ? Color.Yellow : Color.Red;
            string prefix = good ? "+" : "";
            string postfix = good ? ":)" : ":(";
            IndicatorManager.DrawIndicator(prefix + thought.HappinessModifier + " " + postfix, Position + Vector3.Up + MathFunctions.RandVector3Cube() *0.5f, 1.0f, textColor);
        }
コード例 #13
0
 /// <summary> Remove a standard thought from the creature. </summary>
 public void RemoveThought(Thought Thought)
 {
     Thoughts.Remove(Thought);
 }
コード例 #14
0
ファイル: CreatureAI.cs プロジェクト: maroussil/dwarfcorp
 public void RemoveThought(Thought.ThoughtType thoughtType)
 {
     Thoughts.RemoveAll(thought => thought.Type == thoughtType);
 }
コード例 #15
0
ファイル: CreatureAI.cs プロジェクト: maroussil/dwarfcorp
 public bool HasThought(Thought.ThoughtType type)
 {
     return Thoughts.Any(existingThought => existingThought.Type == type);
 }
コード例 #16
0
ファイル: Creature.cs プロジェクト: maroussil/dwarfcorp
 public ThoughtBuff(float time, Thought.ThoughtType type)
     : base(time)
 {
     ThoughtType = type;
 }
コード例 #17
0
ファイル: CreatureAI.cs プロジェクト: maroussil/dwarfcorp
 public void AddThought(Thought.ThoughtType type)
 {
     if (!HasThought(type))
     {
         AddThought(Thought.CreateStandardThought(type, PlayState.Time.CurrentDate), true);
     }
 }