/// <summary>Prepares the base character.</summary> /// <param name="session">The session.</param> /// <returns>Filled out base character.</returns> public static Thing PrepareBaseCharacter(Session session) { var movableBehavior = new MovableBehavior(); var livingBehavior = new LivingBehavior(); var sensesBehavior = new SensesBehavior(); var userControlledBehavior = new UserControlledBehavior() { Controller = session, }; var playerBehavior = new PlayerBehavior(sensesBehavior, userControlledBehavior) { SessionId = session.ID, }; var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior); var game = GameSystemController.Instance; // Load the default stats for the current gaming system foreach (var gameStat in game.GameStats) { var currStat = new GameStat(session, gameStat.Name, gameStat.Abbreviation, gameStat.Formula, gameStat.Value, gameStat.MinValue, gameStat.MaxValue, gameStat.Visible); player.Stats.Add(currStat.Abbreviation, currStat); } // Load the secondary stats\attributes for the current gaming system foreach (var attribute in game.GameAttributes) { var newAttribute = new GameAttribute(session, attribute.Name, attribute.Abbreviation, attribute.Formula, attribute.Value, attribute.MinValue, attribute.MaxValue, attribute.Visible); player.Attributes.Add(newAttribute.Abbreviation, newAttribute); } return(player); }
/// <summary>Adds the given attribute to this <see cref="Thing"/>.</summary> /// <param name="gameAttribute">The attribute to be added.</param> public void AddAttribute(GameAttribute gameAttribute) { gameAttribute.Parent = this; this.Attributes.Add(gameAttribute.Name, gameAttribute); gameAttribute.OnAdd(); }
/// <summary>Removes the given attribute from this <see cref="Thing"/>.</summary> /// <param name="gameAttribute">The attribute to be removed.</param> public void RemoveAttribute(GameAttribute gameAttribute) { gameAttribute.Parent = null; if (Attributes.ContainsKey(gameAttribute.Name)) { Attributes.Remove(gameAttribute.Name); } gameAttribute.OnRemove(); }
/// <summary>Prepares the base character.</summary> /// <param name="session">The session.</param> /// <returns>Filled out base character.</returns> public static Thing PrepareBaseCharacter(Session session) { var movableBehavior = new MovableBehavior(); var livingBehavior = new LivingBehavior(); var sensesBehavior = new SensesBehavior(); var userControlledBehavior = new UserControlledBehavior() { Controller = session, }; var playerBehavior = new PlayerBehavior(sensesBehavior, userControlledBehavior) { SessionId = session.ID, }; var player = new Thing(livingBehavior, sensesBehavior, userControlledBehavior, playerBehavior, movableBehavior); var game = GameSystemController.Instance; // Load the default stats for the current gaming system foreach (var gameStat in game.GameStats) { var currStat = new GameStat(session, gameStat.Name, gameStat.Abbreviation, gameStat.Formula, gameStat.Value, gameStat.MinValue, gameStat.MaxValue, gameStat.Visible); player.Stats.Add(currStat.Abbreviation, currStat); } // Load the secondary stats\attributes for the current gaming system foreach (var attribute in game.GameAttributes) { var newAttribute = new GameAttribute(session, attribute.Name, attribute.Abbreviation, attribute.Formula, attribute.Value, attribute.MinValue, attribute.MaxValue, attribute.Visible); player.Attributes.Add(newAttribute.Abbreviation, newAttribute); } return player; }