コード例 #1
0
        override protected void CreateWheel()
        {
            wheel = Wheel.Create(name: "Wheel of Fate");

            WheelBase weapons = Wheel.Create(name: "Weapons");

            weapons.AddSlot(Wheel.Create(1, "Sword"));
            weapons.AddSubslot("Sword", Wheel.Create(1, "Epic Sword"));
            weapons.AddSubslot("Sword", Wheel.Create(5, "Rare Sword"));
            weapons.AddSubslot("Sword", Wheel.Create(15, "Common Sword"));

            weapons.AddSlot(Wheel.Create(1, "Halberd"));
            weapons.AddSubslot("Halberd", Wheel.Create(1, "Epic Halberd"));
            weapons.AddSubslot("Halberd", Wheel.Create(5, "Rare Halberd"));
            weapons.AddSubslot("Halberd", Wheel.Create(15, "Common Halberd"));

            weapons.AddSlot(Wheel.Create(1, "Bow"));
            weapons.AddSubslot("Bow", Wheel.Create(1, "Epic Bow"));
            weapons.AddSubslot("Bow", Wheel.Create(5, "Rare Bow"));
            weapons.AddSubslot("Bow", Wheel.Create(15, "Common Bow"));

            weapons.AddSlot(Wheel.Create(1, "Mace"));
            weapons.AddSubslot("Mace", Wheel.Create(1, "Epic Mace"));
            weapons.AddSubslot("Mace", Wheel.Create(5, "Rare Mace"));
            weapons.AddSubslot("Mace", Wheel.Create(15, "Common Mace"));

            WheelBase armors = Wheel.Create(name: "Armors");

            armors.AddSlot(Wheel.Create(2, "Leggings"));
            armors.AddSlot(Wheel.Create(4, "Chestplate"));
            armors.AddSlot(Wheel.Create(1, "Shield"));
            armors.AddSlot(Wheel.Create(10, "Boots"));

            WheelBase powerups = Wheel.Create(name: "Powerups");

            powerups.AddSlot(Wheel.Create(1, "Increased HP"));
            powerups.AddSubslot(0, Wheel.Create(1, "HP +100"));
            powerups.AddSubslot(0, Wheel.Create(9, "HP +25"));
            powerups.AddSubslot(0, Wheel.Create(40, "HP +10"));
            powerups.AddSlot(Wheel.Create(1, "Increased ATK"));
            powerups.AddSubslot(1, Wheel.Create(1, "ATK +1000"));
            powerups.AddSubslot(1, Wheel.Create(9, "ATK +400"));
            powerups.AddSubslot(1, Wheel.Create(40, "ATK +100"));
            powerups.AddSlot(Wheel.Create(1, "Increased DEX"));
            powerups.AddSubslot(2, Wheel.Create(1, "DEX +20"));
            powerups.AddSubslot(2, Wheel.Create(9, "DEX +6"));
            powerups.AddSubslot(2, Wheel.Create(40, "DEX +2"));

            wheel.AddSlot(weapons);
            wheel.AddSlot(armors);
            wheel.AddSlot(powerups);

            foreach (WheelRenderer renderer in wheelRenderers)
            {
                if (renderer)
                {
                    renderer.SetWheel(wheel);
                }
            }
        }
コード例 #2
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
        public void AddSlot_NewSubslotOnMaxedOutWheelRoot_ShouldWorkFine()
        {
            WheelBase parentWheel = CreateDummyWheelWithDepth((int)Wheel.DEPTH_MAX);
            WheelBase childWheel  = Wheel.Create();

            Assert.IsTrue(parentWheel.AddSlot(childWheel));
        }
コード例 #3
0
        private void Awake()
        {
            ForeachWheel((_, position, __) =>
            {
                Transform wheelTransform     = Instantiate(_wheelPrefab, transform).transform;
                wheelTransform.localPosition = GetLocalPositionXZ(position).ReProjectedXZ();

                ParticleSystem particles = wheelTransform.GetChild(0).GetComponent <ParticleSystem>();
                return(Wheel.Create(wheelTransform, particles, _groundMask, _wheelRadius, _suspension));
            });
        }
コード例 #4
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
        public void AddSubslot_AddToSameTree_ShouldThrowException()
        {
            WheelBase wheel     = Wheel.Create();
            WheelBase subwheel1 = Wheel.Create();
            WheelBase subwheel2 = Wheel.Create();

            wheel.AddSlot(subwheel1);
            subwheel1.AddSlot(subwheel2);

            Assert.Throws <Exceptions.SameWheelException>(() => subwheel1.AddSubslot(0, wheel));
        }
コード例 #5
0
        override protected void CreateWheel()
        {
            wheel = Wheel.Create(name: "Lab Upgrade");

            WheelBase telepod = Wheel.Create(name: "Telepod");

            telepod.AddSlot(Wheel.Create(5, "Safety Locks"));
            telepod.AddSlot(Wheel.Create(3, "+1 Atomic Decimator"));
            telepod.AddSlot(Wheel.Create(3, "+1 Atomic Regenerator"));
            telepod.AddSlot(Wheel.Create(1, "+1 Telepod"));

            telepod.AddSlot(Wheel.Create(10, "Cabling"));
            telepod.AddSubslot("Cabling", Wheel.Create(50, "+1 Copper Cable"));
            telepod.AddSubslot("Cabling", Wheel.Create(10, "+1 Gold Cable"));
            telepod.AddSubslot("Cabling", Wheel.Create(1, "+1 Carbon Cable"));

            telepod.AddSlot(Wheel.Create(20, "Upgrades"));
            telepod.AddSubslot("Upgrades", Wheel.Create(1, "+10% UV Blocking"));
            telepod.AddSubslot("Upgrades", Wheel.Create(1, "+10% Insulation"));
            telepod.AddSubslot("Upgrades", Wheel.Create(1, "+10% Regen Speed"));

            WheelBase computer = Wheel.Create(name: "Computer");

            computer.AddSlot(Wheel.Create(1, "Turbo CPU Add-on"));
            computer.AddSlot(Wheel.Create(5, "+64K Memory"));
            computer.AddSlot(Wheel.Create(3, "DNA Validator"));
            computer.AddSlot(Wheel.Create(10, "Insectoid DNA Filter"));
            computer.AddSlot(Wheel.Create(10, "Tissue Translator"));
            computer.AddSlot(Wheel.Create(10, "+1 Teleport Subject"));
            computer.AddSlot(Wheel.Create(10, "Voice Activation"));

            wheel.AddSlot(telepod);
            wheel.AddSlot(computer);

            foreach (WheelRenderer renderer in wheelRenderers)
            {
                if (renderer)
                {
                    renderer.SetWheel(wheel);
                }
            }
        }
コード例 #6
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
        private WheelBase CreateDummyWheelWithDepth(int depth, bool getLeaf = false)
        {
            WheelBase wheel     = Wheel.Create();
            WheelBase lastChild = wheel;

            for (int i = 0; i < depth; i++)
            {
                WheelBase newChild = Wheel.Create();
                lastChild.AddSlot(newChild);
                lastChild = newChild;
            }

            if (getLeaf)
            {
                return(lastChild);
            }
            else
            {
                return(wheel);
            }
        }
コード例 #7
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
        public void LeafSlots_ShouldOnlyContainLeafSlots()
        {
            WheelBase wheel = Wheel.Create();

            wheel.AddSlot(Wheel.Create(name: "A"));
            wheel.AddSlot(Wheel.Create(name: "B"));
            wheel.AddSlot(Wheel.Create(name: "C"));

            wheel.AddSubslot("B", Wheel.Create(name: "D"));

            WheelBase eWheel = Wheel.Create(name: "E");

            eWheel.AddSlot(Wheel.Create(name: "F"));
            eWheel.AddSlot(Wheel.Create(name: "G"));

            eWheel.AddSubslot("F", Wheel.Create(name: "H"));
            eWheel.AddSubslot("F", Wheel.Create(name: "I"));

            wheel.AddSlot(eWheel);

            string[] givenLeaves = { "A", "C", "D", "G", "H", "I" };

            CollectionAssert.AreEquivalent(wheel.LeafNames, givenLeaves);
        }
コード例 #8
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
 public void Create_CannotCreateZeroChanceWheel_ShouldThrowException()
 {
     Assert.Throws <Exceptions.ZeroChanceException>(() => Wheel.Create(chance: 0));
 }
コード例 #9
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
        public void AddSubslot_ShouldNotAcceptItselfAsSubslot_ShouldThrowException()
        {
            WheelBase wheel = Wheel.Create();

            Assert.Throws <Exceptions.SameWheelException>(() => wheel.AddSlot(wheel));
        }
コード例 #10
0
ファイル: WheelTests.cs プロジェクト: rectdev/wheel
        public void Create_ChanceCanBe1MillonMax_ShouldCapAt1M()
        {
            WheelBase wheel = Wheel.Create(chance: 2000000);

            Assert.LessOrEqual(wheel.chance, Wheel.CHANCE_MAX);
        }