コード例 #1
0
ファイル: MountPointTests.cs プロジェクト: wesleywh/Rucksack
        public void Setup()
        {
            UnityEngine.Assertions.Assert.raiseExceptions = true;

            _restoreToCollection = new Collection <IItemInstance>(10, new Logger("[RestoreCollection] "));
            _equipmentCollection = new EquipmentCollection <IEquippableItemInstance>(5, null, new Logger("[Equipment] "));

            _headEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Head"
            };
            _bodyEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Body"
            };
            _feetEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Feet"
            };
            _swordEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Sword"
            };
            _shieldEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Shield"
            };
            _twoHandedSwordEquipmentType = new EquipmentType(Guid.NewGuid(), _swordEquipmentType, _shieldEquipmentType, _arrowsEquipmentType)
            {
                name = "2 Handed sword"
            };
            _arrowsEquipmentType = new EquipmentType(Guid.NewGuid(), _swordEquipmentType, _shieldEquipmentType)
            {
                name = "Arrows"
            };

            _headItem           = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_headEquipmentType));
            _headItem2          = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_headEquipmentType));
            _bodyItem           = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_bodyEquipmentType));
            _feetItem           = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_feetEquipmentType));
            _swordItem          = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_swordEquipmentType));
            _shieldItem         = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_shieldEquipmentType));
            _twoHandedSwordItem = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_twoHandedSwordEquipmentType));
            _arrowsItem         = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_arrowsEquipmentType, 999));

            _mountPoint1 = new MockedMountPoint("1");
            _mountPoint2 = new MockedMountPoint("2");
            _mountPoint3 = new MockedMountPoint("3");
            _mountPoint4 = new MockedMountPoint("4");
            _mountPoint5 = new MockedMountPoint("5");

            _equipmentCollection.SetAllEquipmentTypes(new IEquipmentType[][]
            {
                new[] { _headEquipmentType },                                              // Head
                new[] { _bodyEquipmentType },                                              // Body
                new[] { _feetEquipmentType },                                              // Feet
                new[] { _swordEquipmentType, _twoHandedSwordEquipmentType },               // Right Hand
                new[] { _swordEquipmentType, _shieldEquipmentType, _arrowsEquipmentType }, // Left Hand
            });

//            _equipmentCollection.SetAllMountPoints(new IMountPoint<IEquippableItemInstance>[]
//            {
//                _mountPoint1,
//                _mountPoint2,
//                _mountPoint3,
//                _mountPoint4,
//                _mountPoint5,
//            });
        }
コード例 #2
0
        public void Setup()
        {
            UnityEngine.Assertions.Assert.raiseExceptions = true;

            _restoreToCollection = new Collection <IItemInstance>(10, new Logger("[RestoreCollection] "));
            _equipmentCollection = new EquipmentCollection <IEquippableItemInstance>(5, _equippableCharacter, new Logger("[Equipment] "));
            _equippableCharacter = new EquippableCharacter <IItemInstance, IEquippableItemInstance>(_equipmentCollection, new CollectionGroup <IItemInstance>(_restoreToCollection), new Logger("[EquippableCharacter] "));
            _equipmentCollection.characterOwner = _equippableCharacter;

            _headEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Head"
            };
            _bodyEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Body"
            };
            _feetEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Feet"
            };
            _swordEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Sword"
            };
            _shieldEquipmentType = new EquipmentType(Guid.NewGuid())
            {
                name = "Shield"
            };
            _twoHandedSwordEquipmentType = new EquipmentType(Guid.NewGuid(), _swordEquipmentType, _shieldEquipmentType, _arrowsEquipmentType)
            {
                name = "2 Handed sword"
            };
            _arrowsEquipmentType = new EquipmentType(Guid.NewGuid(), _swordEquipmentType, _shieldEquipmentType)
            {
                name = "Arrows"
            };

            _headItem           = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_headEquipmentType));
            _bodyItem           = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_bodyEquipmentType));
            _feetItem           = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_feetEquipmentType));
            _swordItem          = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_swordEquipmentType));
            _swordItem2         = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_swordEquipmentType));
            _shieldItem         = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_shieldEquipmentType));
            _twoHandedSwordItem = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_twoHandedSwordEquipmentType));
            _arrowsItem         = new MockedEquippableItemInstance(Guid.NewGuid(), CreateDemoItemDef(_arrowsEquipmentType, 999));

            _equipmentCollection.SetAllEquipmentTypes(new IEquipmentType[][]
            {
                new[] { _headEquipmentType },                                              // Head
                new[] { _bodyEquipmentType },                                              // Body
                new[] { _feetEquipmentType },                                              // Feet
                new[] { _swordEquipmentType, _twoHandedSwordEquipmentType },               // Right Hand
                new[] { _swordEquipmentType, _shieldEquipmentType, _arrowsEquipmentType }, // Left Hand
            });

            var mountPoints = new IMountPoint <IEquippableItemInstance>[]
            {
                new MockedMountPoint("1"),
                new MockedMountPoint("2"),
                new MockedMountPoint("3"),
                new MockedMountPoint("4"),
                new MockedMountPoint("5"),
            };

//            _equipmentCollection.SetAllMountPoints(mountPoints);
            _equippableCharacter.mountPoints = mountPoints;
        }