コード例 #1
0
        public ActorModel(string imageID, string name, string pluralName, int scoreValue, DollBody body, Abilities abilities, ActorSheet startingSheet, Type defaultController)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (body == null)
            {
                throw new ArgumentNullException("body");
            }
            if (abilities == null)
            {
                throw new ArgumentNullException("abilities");
            }
            if (startingSheet == null)
            {
                throw new ArgumentNullException("startingSheet");
            }
            if (defaultController != null && !defaultController.IsSubclassOf(typeof(ActorController)))
            {
                throw new ArgumentException("defaultController is not a subclass of ActorController");
            }

            m_ImageID           = imageID;
            m_DollBody          = body;
            m_Name              = name;
            m_PluralName        = pluralName;
            m_StartingSheet     = startingSheet;
            m_Abilities         = abilities;
            m_DefaultController = defaultController;
            m_ScoreValue        = scoreValue;

            m_CreatedCount = 0;
        }
コード例 #2
0
ファイル: Doll.cs プロジェクト: zaimoni/RSRevived
 public Doll(ActorModel model)
 {
     Body          = model.DollBody;
     m_Decorations = (string.IsNullOrEmpty(model.ImageID) ? new List <string> [(int)DollPart._COUNT] : null);
 }
コード例 #3
0
ファイル: ActorModel.cs プロジェクト: zaimoni/RSRevived
        public ActorModel(Gameplay.GameActors.IDs id, string?imageID, string name, string pluralName, int scoreValue, string flavor, DollBody body, Abilities abilities, ActorSheet startingSheet, Type defaultController)
        {
#if DEBUG
            // using logical XOR to restate IFF, logical AND to restate logical implication
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (string.IsNullOrEmpty(flavor))
            {
                throw new ArgumentNullException(nameof(flavor));
            }
            if (!defaultController.IsSubclassOf(typeof(ActorController)))
            {
                throw new InvalidOperationException("!defaultController.IsSubclassOf(typeof(ActorController))");
            }
            if (abilities.HasInventory ^ (0 < startingSheet.BaseInventoryCapacity))
            {
                throw new InvalidOperationException("abilities.HasInventory ^ (0 < startingSheet.BaseInventoryCapacity)");
            }
            if ((abilities.HasToEat || abilities.IsRotting) ^ (0 < startingSheet.BaseFoodPoints))
            {
                throw new InvalidOperationException("(abilities.HasToEat || abilities.IsRotting) ^ (0 < startingSheet.BaseFoodPoints)");
            }
            if (abilities.HasToSleep ^ (0 < startingSheet.BaseSleepPoints))
            {
                throw new InvalidOperationException("abilities.HasToSleep ^ (0 < startingSheet.BaseSleepPoints)");
            }
            if (abilities.HasSanity ^ (0 < startingSheet.BaseSanity))
            {
                throw new InvalidOperationException("abilities.HasSanity ^ (0 < startingSheet.BaseSanity)");
            }
            // OrderableAI should implement all of STD_LIVING, STD_HUMAN, and STD_SANE flags
            // InsaneHumanAI currently implements all of STD_LIVING and STD_HUMAN flags, but not STD_SANE flags
            if (abilities.CanTrade && !defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI)))
            {
                throw new InvalidOperationException("abilities.CanTrade && !defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI))");
            }
            if (!abilities.CanBarricade && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI)))
            {
                throw new InvalidOperationException("!abilities.CanBarricade && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI))");
            }
            if (!abilities.CanUseItems && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI)))
            {
                throw new InvalidOperationException("!abilities.CanUseItems && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI))");
            }
            if (!abilities.HasInventory && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI)))
            {
                throw new InvalidOperationException("!abilities.HasInventory && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI))");
            }
            if (!abilities.CanTalk && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI)))
            {
                throw new InvalidOperationException("!abilities.CanTalk && defaultController.IsSubclassOf(typeof(Gameplay.AI.OrderableAI))");
            }
#endif
            ID                = id;
            ImageID           = imageID;
            DollBody          = body;
            Name              = name;
            PluralName        = pluralName;
            StartingSheet     = startingSheet;
            Abilities         = abilities;
            DefaultController = defaultController;
            ScoreValue        = scoreValue;
            FlavorDescription = flavor;
        }
コード例 #4
0
 public Doll(DollBody body)
 {
     m_Body        = body;
     m_Decorations = new List <string> [(int)DollPart._COUNT];
 }