Beispiel #1
0
 public Reaction(ActionManager actionManager, Being parentBeing, string reactionName, ThoughtType outputThoughtType)
 {
     this.actionManager     = actionManager;
     this.parentBeing       = parentBeing;
     this.reactionName      = reactionName;
     this.outputThoughtType = outputThoughtType;
 }
Beispiel #2
0
 public Thought(string idea, ThoughtType type, DateTime worldDateTime, TimeSpan simulationTime)
 {
     Idea           = idea;
     Type           = type;
     WorldDateTime  = worldDateTime;
     SimulationTime = simulationTime;
 }
Beispiel #3
0
    /*
     * public void PrioritiseAbilities(List<Thought> thoughts)
     * {
     *
     *
     *  //Debug.Log(" looking for abilities that fit the bill... ");
     *  //Debug.Log(" in a list that's length " + abil.Count);
     *
     *
     *  for (int i = 0; i < selectionCriteria.Count; i++)
     *  {
     *      for (int ii = 0; ii < thoughts.Count; ii++)
     *      {
     *          selectionCriteria[i].Assess(thoughts[ii]);
     *      }
     *  }
     *
     * }
     */

    public Behaviour(ActionManager actionManager, Being parentBeing, string behaviourName, ThoughtType outputThoughtType)
    {
        this.actionManager     = actionManager;
        this.parentBeing       = parentBeing;
        this.behaviourName     = behaviourName;
        this.outputThoughtType = outputThoughtType;
    }
        private Thought GenerateThought(ThoughtType type)
        {
            ThoughtMetadata[] thoughtMatches = thoughtPool.Where(t => t.Type == type).ToArray();
            int             randomIndex      = random.Next(0, thoughtMatches.Count() - 1);
            ThoughtMetadata thought          = thoughtMatches[randomIndex];

            return(new Thought(thought.Idea, thought.Type, WorldDateTime, SimulationTime));
        }
 private void OnThought(ThoughtType type)
 {
     // only think about this if we are previously satisfied
     if (!unsatisfiedThoughts.Any(t => t.Key == type))
     {
         EventHelper.FireEvent(HadThought, this, new ThoughtEventArgs(type));
     }
 }
Beispiel #6
0
    public Action provoker; //if this is a reaction, this is the action it's reacting to. It's set in Being.React();


    public Thought(ThoughtType thoughtType, float reflex, Ability ability, List <Being> targets)
    {
        this.thoughtType = thoughtType;
        this.reflex      = reflex;
        this.ability     = ability;
        this.targets.AddRange(targets);
        this.actors = new List <Being>();
    }
Beispiel #7
0
 public Action(ThoughtType actionType, float toHit, float reflex, List <Being> actors, Ability ability, List <Being> targets)
 {
     this.actionType = actionType;
     this.toHit      = toHit;
     this.reflex     = reflex;
     this.ability    = ability;
     this.targets    = targets;
     this.actors     = actors;
 }
        private void SatisfyThought(ThoughtType type)
        {
            Thought satisfiedThought;
            bool    success = unsatisfiedThoughts.TryGetValue(type, out satisfiedThought);

            if (success)
            {
                thoughtLog.Add(satisfiedThought);
                unsatisfiedThoughts.Remove(type);
            }
        }
        private void AddThoughtToCollection(JToken thoughtData, ThoughtType type)
        {
            if (thoughtData == null)
            {
                throw new ArgumentNullException("thoughtData");
            }

            string          idea            = thoughtData["idea"].ToString();
            ThoughtMetadata thoughtMetadata = new ThoughtMetadata(type, idea);

            thoughtPool.Add(thoughtMetadata);
        }
    public void Initialize(ActionManager actionManager, Being being, ThoughtType thoughtType)
    {
        this.actionManager = actionManager;
        this.being         = being;
        this.thoughtType   = thoughtType;

        this.beingNameText.text      = being.beingName;
        this.playerSelectedAbilities = new List <Thought>();
        this.buttons = new List <GameObject>();
        this.content = transform.GetChild(0).GetChild(0);

        DisplayUseableAbilities();
    }
        public ThoughtType GetById(int id)
        {
            ThoughtType result = null;

            StringBuilder sqlStr = new StringBuilder();

            sqlStr.AppendLine("select *");
            sqlStr.AppendLine("from " + TableNameWithScheme);
            sqlStr.AppendLine(string.Format("where {0} = :p_codepol", tableFieldID));

            if (this.session != null && this.session.Connection != null && this.session.Connection.State == ConnectionState.Open)
            {
                SqlCommand command = new SqlCommand(sqlStr.ToString(), this.session.Connection);
                command.Parameters.AddWithValue("p_id", id);

                DataSet        dataSet     = new DataSet();
                SqlDataAdapter dataAdapter = new SqlDataAdapter(command);

                DataTable table;

                try
                {
                    dataAdapter.Fill(dataSet);

                    if (dataSet.Tables.Count > 0)
                    {
                        table = dataSet.Tables[0];

                        if (table.Rows.Count == 1)
                        {
                            DataRow row = table.Rows[0];

                            result = new ThoughtType();

                            ReadFields(result, row);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }

            return(result);
        }
Beispiel #12
0
    public void EnterThought(ThoughtType thoughtType)
    {
        if (thoughtType == CurrentThoughtType)
        {
            return;
        }

        IThought nextThought;

        switch (thoughtType)
        {
        case ThoughtType.Idle:
            nextThought = _idleThought;
            break;

        case ThoughtType.Walking:
            nextThought = _walkingThought;
            break;

        case ThoughtType.Attacking:
            nextThought = _attackingThought;
            break;

        default:
            throw new NotImplementedException("ThoughtType not implemented: " + thoughtType);
        }

        CurrentThoughtType = thoughtType;
        if (nextThought == null)
        {
            nextThought        = _idleThought;
            CurrentThoughtType = ThoughtType.Idle;
        }

        if (_currentThought != null)
        {
            _currentThought.Exit();
        }
        _currentThought = nextThought;
        _currentThought.Enter();
    }
        private void TakeActionBasedOnThought(Employee employee, ThoughtType thoughtType)
        {
            switch (thoughtType)
            {
            case ThoughtType.Hungry:
                WalkMobileAgentToClosest <SnackMachine>(employee);
                break;

            case ThoughtType.Thirsty:
                WalkMobileAgentToClosest <SodaMachine>(employee);
                break;

            case ThoughtType.NeedsDeskAssignment:
                WalkMobileAgentToClosest <OfficeDesk>(employee);
                break;

            case ThoughtType.IsIdle:
                WalkEmployeeToAssignedOfficeDesk(employee);
                break;
            }
        }
        private Collection <ThoughtType> GetAllFromBase()
        {
            Collection <ThoughtType> result = new Collection <ThoughtType>();

            DataTable table;
            string    message = string.Empty;

            if (GetAllByTable(out table, out message))
            {
                if (table != null)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        ThoughtType status = new ThoughtType();

                        ReadFields(status, row);

                        result.Add(status);
                    }
                }
            }

            return(result);
        }
 private void ReadFields(ThoughtType result, DataRow row)
 {
     result.Id   = Utilities.GetIntFromRow(row, tableFieldID).Value;
     result.Name = Utilities.GetStringFromRow(row, tableFieldNAME);
 }
Beispiel #16
0
 public ThoughtEventArgs(ThoughtType type)
 {
     Type = type;
 }
Beispiel #17
0
        // Todo: Data drive this.
        public static Thought CreateStandardThought(ThoughtType type, DateTime time)
        {
            string   description = "";
            float    happiness   = 0.0f;
            TimeSpan limit       = new TimeSpan(0, 1, 0, 0);

            switch (type)
            {
            case ThoughtType.Magic:
                description = "A strange giddiness overcomes me.";
                happiness   = 100.0f;
                limit       = new TimeSpan(1, 0, 0, 0);
                break;

            case ThoughtType.Slept:
                description = "I slept recently.";
                happiness   = 5.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.SleptOnGround:
                description = "I slept on the ground.";
                happiness   = -6.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.TookDamage:
                description = "I got hurt recently.";
                happiness   = -5.0f;
                limit       = new TimeSpan(2, 0, 0, 0);
                break;

            case ThoughtType.Talked:
                description = "I spoke to a friend recently.";
                happiness   = 5.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.FeltCold:
                description = "I felt very cold recently.";
                happiness   = -2.0f;
                limit       = new TimeSpan(0, 4, 0, 0);
                break;

            case ThoughtType.FeltHot:
                description = "I felt very hot recently.";
                happiness   = -2.0f;
                limit       = new TimeSpan(0, 4, 0, 0);
                break;

            case ThoughtType.FeltBored:
                description = "I have been overworked recently.";
                happiness   = -2.0f;
                limit       = new TimeSpan(0, 4, 0, 0);
                break;

            case ThoughtType.FriendDied:
                description = "A friend died recently.";
                happiness   = -25.0f;
                limit       = new TimeSpan(2, 0, 0, 0);
                break;

            case ThoughtType.Frightened:
                description = "I was frightened recently.";
                happiness   = -2.0f;
                limit       = new TimeSpan(0, 4, 0, 0);
                break;

            case ThoughtType.HadAle:
                description = "I had good ale recently.";
                happiness   = 10.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.AteFood:
                description = "I ate good food recently.";
                happiness   = 5.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.FeltHungry:
                description = "I was hungry recently.";
                happiness   = -3.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.FeltSleepy:
                description = "I was sleepy recently.";
                happiness   = -3.0f;
                limit       = new TimeSpan(0, 4, 0, 0);
                break;

            case ThoughtType.GotPaid:
                description = "I got paid recently.";
                happiness   = 10.0f;
                limit       = new TimeSpan(1, 0, 0, 0);
                break;

            case ThoughtType.NotPaid:
                description = "I have not been paid!";
                happiness   = -25.0f;
                limit       = new TimeSpan(1, 0, 0, 0);
                break;

            case ThoughtType.IsOverQualified:
                description = "I am overqualified for this job.";
                happiness   = -10.0f;
                limit       = new TimeSpan(1, 0, 0, 0);
                break;

            case ThoughtType.GotPromoted:
                description = "I got promoted recently.";
                happiness   = 20.0f;
                limit       = new TimeSpan(3, 0, 0, 0);
                break;

            case ThoughtType.WonGambling:
                description = "I won a game of dice!";
                happiness   = 10.0f;
                limit       = new TimeSpan(1, 0, 0, 0);
                break;

            case ThoughtType.JustArrived:
                description = "I just arrived to this new land.";
                happiness   = 20.0f;
                limit       = new TimeSpan(3, 0, 0, 0);
                break;

            case ThoughtType.KilledThing:
                description = "I killed somehing!";
                happiness   = 1.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.BuriedDead:
                description = "I laid a friend to rest.";
                happiness   = 10.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.Crafted:
                description = "I crafted something!";
                happiness   = 1.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.Farmed:
                description = "I farmed something!";
                happiness   = 1.0f;
                limit       = new TimeSpan(0, 4, 0, 0);
                break;

            case ThoughtType.Researched:
                description = "I researched something!";
                happiness   = 10.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.Other:
                return(new Thought()
                {
                    Type = type
                });

            case ThoughtType.CheatedHappy:
                description = "You used the god menu to make me happy.";
                happiness   = 100.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;

            case ThoughtType.CheatedPissed:
                description = "You used the god menu to piss me off.";
                happiness   = -100.0f;
                limit       = new TimeSpan(0, 8, 0, 0);
                break;
            }

            return(new Thought()
            {
                Description = description,
                HappinessModifier = happiness,
                TimeLimit = limit,
                TimeStamp = time,
                Type = type
            });
        }
 public void Initialize(ActionManager actionManager, Being being, ThoughtType thoughtType, float reflexSpeed)
 {
     this.reflexSpeed = reflexSpeed;
     Initialize(actionManager, being, thoughtType);
 }
Beispiel #19
0
 private void OnThoughtSatisfied(ThoughtType type)
 {
     SatisfyThought(type);
     EventHelper.FireEvent(ThoughtSatisfied, this, new ThoughtEventArgs(type));
 }
 public ThoughtMetadata(ThoughtType type, string idea)
 {
     Type = type;
     Idea = idea;
 }
Beispiel #21
0
        public static Thought CreateStandardThought(ThoughtType type, DateTime time)
        {
            string description = "";
            float happiness = 0.0f;
            TimeSpan limit = new TimeSpan(0, 1, 0, 0);
            switch (type)
            {
                case ThoughtType.Magic:
                    description = "A strange giddiness overcomes me.";
                    happiness = 100.0f;
                    limit = new TimeSpan(1, 0, 0, 0);
                    break;
                case ThoughtType.Slept:
                    description = "I slept recently.";
                    happiness = 5.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.SleptOnGround:
                    description = "I slept on the ground.";
                    happiness = -6.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.TookDamage:
                    description = "I got hurt recently.";
                    happiness = -5.0f;
                    limit = new TimeSpan(2, 0, 0, 0);
                    break;
                case ThoughtType.Talked:
                    description = "I spoke to a friend recently.";
                    happiness = 5.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.FeltCold:
                    description = "I felt very cold recently.";
                    happiness = -2.0f;
                    limit = new TimeSpan(0, 4, 0, 0);
                    break;
                case ThoughtType.FeltHot:
                    description = "I felt very hot recently.";
                    happiness = -2.0f;
                    limit = new TimeSpan(0, 4, 0, 0);
                    break;
                case ThoughtType.FriendDied:
                    description = "A friend died recently.";
                    happiness = -50.0f;
                    limit = new TimeSpan(2, 0, 0, 0);
                    break;
                case ThoughtType.Frightened:
                    description = "I was frightened recently.";
                    happiness = -2.0f;
                    limit = new TimeSpan(0, 4, 0, 0);
                    break;
                case ThoughtType.HadAle:
                    description = "I had good ale recently.";
                    happiness = 10.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.AteFood:
                    description = "I ate good food recently.";
                    happiness = 5.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.FeltHungry:
                    description = "I was hungry recently.";
                    happiness = -3.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.FeltSleepy:
                    description = "I was sleepy recently.";
                    happiness = -3.0f;
                    limit = new TimeSpan(0, 4, 0, 0);
                    break;
                case ThoughtType.GotPaid:
                    description = "I got paid recently.";
                    happiness = 10.0f;
                    limit = new TimeSpan(1, 0, 0, 0);
                    break;
                 case ThoughtType.NotPaid:
                    description = "I have not been paid!";
                    happiness = -25.0f;
                    limit = new TimeSpan(1, 0, 0, 0);
                    break;
                case ThoughtType.IsOverQualified:
                    description = "I am overqualified for this job.";
                    happiness = -10.0f;
                    limit = new TimeSpan(1, 0, 0, 0);
                    break;
                case ThoughtType.GotPromoted:
                    description = "I got promoted recently.";
                    happiness = 20.0f;
                    limit = new TimeSpan(3, 0, 0, 0);
                    break;
                case ThoughtType.JustArrived:
                    description = "I just arrived to this new land.";
                    happiness = 20.0f;
                    limit = new TimeSpan(3, 0, 0, 0);
                    break;
                case ThoughtType.KilledThing:
                    description = "I killed somehing!";
                    happiness = 10.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.Crafted:
                    description = "I crafted something!";
                    happiness = 10.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.Farmed:
                    description = "I farmed something!";
                    happiness = 10.0f;
                    limit = new TimeSpan(0, 4, 0, 0);
                    break;
                case ThoughtType.Researched:
                    description = "I researched something!";
                    happiness = 100.0f;
                    limit = new TimeSpan(0, 8, 0, 0);
                    break;
                case ThoughtType.Other:
                    return new Thought()
                    {
                        Type = type
                    };
                    break;
            }

            return new Thought()
            {
                Description = description,
                HappinessModifier = happiness,
                TimeLimit = limit,
                TimeStamp = time,
                Type = type
            };
        }
Beispiel #22
0
 public ActionType_ChassisCondition(ActionManager actionManager, ThoughtType actiontype) : base(actionManager)
 {
     this.actionManager = actionManager;
     this.actiontype    = actiontype;
 }