예제 #1
0
        public void DetectNonOverlappedCubes(string core, int expectedCubes)
        {
            var sut = new ReactorCore(core);

            Assert.Equal(expectedCubes, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
예제 #2
0
    IEnumerator ManageReactors()
    {
        Managing = true;
        yield return(new WaitForSeconds(Random.Range(1.6f, 2.3f)));

        int         tries     = 3;
        ReactorCore NewUpCore = SelectCore(ReactorCores);

        if (null != NewUpCore)
        {
            if (NewUpCore.ControlState == ReactorCore.RodStatus.Down)
            {
                NewUpCore.ControlState = ReactorCore.RodStatus.Selected;
            }
            else
            {
                while ((tries > 0) && (NewUpCore.ControlState != ReactorCore.RodStatus.Down))
                {
                    tries    -= 1;
                    NewUpCore = SelectCore(ReactorCores);
                }

                NewUpCore.ControlState = ReactorCore.RodStatus.Selected;
            }
        }
        Managing = false;
    }
예제 #3
0
        public void Test10()
        {
            var sut = new ReactorCore(@"on x=-49..-1,y=-11..42,z=-10..38
on x=-20..34,y=-40..6,z=-44..1");

            Assert.Equal(244244, sut.GetTurnedOnCubesCount());
            Assert.True(sut.HasOverlaps);
        }
예제 #4
0
        public void Test7()
        {
            var sut = new ReactorCore(@"on x=-44..5,y=-27..21,z=-14..35
on x=-49..-1,y=-11..42,z=-10..38");

            Assert.Equal(185362, sut.GetTurnedOnCubesCount());
            Assert.True(sut.HasOverlaps);
        }
예제 #5
0
        public void Test1()
        {
            var sut = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-44..5,y=-27..21,z=-14..35");

            Assert.Equal(248314, sut.GetTurnedOnCubesCount());
            Assert.True(sut.HasOverlaps);
        }
예제 #6
0
        public void DetectNoOverlaps()
        {
            var sut = new ReactorCore(@"on x=-49..-45,y=-11..42,z=-10..38
on x=-44..-1,y=-27..-12,z=-14..35
on x=-44..-1,y=-11..21,z=-14..-11
on x=-44..-1,y=-11..21,z=-10..35
on x=-44..-1,y=-11..21,z=36..38
on x=-44..-1,y=22..42,z=-10..38
on x=0..5,y=-27..21,z=-14..35");

            Assert.Equal(185362, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
예제 #7
0
        public void Test15()
        {
            var sut = new ReactorCore(@"on x=-43..-34,y=-45..-28,z=7..25
on x=-33..-33,y=-45..-33,z=7..25
on x=-33..-33,y=-32..-28,z=-34..6
on x=-33..-33,y=-32..-28,z=7..11
on x=-33..-33,y=-32..-28,z=12..25
on x=-33..-33,y=-27..19,z=-34..11
on x=-32..15,y=-32..19,z=-34..11");

            Assert.Equal(120945, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
예제 #8
0
        public void Test14()
        {
            var sut = new ReactorCore(@"on x=-43..-42,y=-45..-28,z=7..25
on x=-41..-33,y=-45..-42,z=7..25
on x=-41..-33,y=-41..-28,z=-36..6
on x=-41..-33,y=-41..-28,z=7..8
on x=-41..-33,y=-41..-28,z=9..25
on x=-41..-33,y=-27..6,z=-36..8
on x=-32..5,y=-41..6,z=-36..8");

            Assert.Equal(105030, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
예제 #9
0
        public void Test5()
        {
            var sut = new ReactorCore(
                @"on x=-44..-6,y=-27..21,z=-14..35
on x=-5..5,y=-31..-28,z=-19..33
on x=-5..5,y=-27..21,z=-19..-15
on x=-5..5,y=-27..21,z=-14..33
on x=-5..5,y=-27..21,z=34..35
on x=-5..5,y=22..22,z=-19..33
on x=6..47,y=-31..22,z=-19..33");

            Assert.Equal(248314, sut.GetTurnedOnCubesCount());
            Assert.False(sut.HasOverlaps);
        }
예제 #10
0
        public DeathStar()
        {
            ExteriorQuadaniumsteelouterhull exteriorQuandaniumsteelouterhull = new ExteriorQuadaniumsteelouterhull(100, 100, 100);
            Console.WriteLine("Outer Shell Hardness is {0}, Health is {1}, Nanites are at {2}", exteriorQuandaniumsteelouterhull.Hardness, exteriorQuandaniumsteelouterhull.Health, exteriorQuandaniumsteelouterhull.Nanites);
            exteriorQuandaniumsteelouterhull.TakeDamage();
            exteriorQuandaniumsteelouterhull.NaniteRepair();

            Reactor reactor = new Reactor(100);
            Console.WriteLine("Power is {0} %", reactor);
            reactor.GeneratePower();

            ReactorCore reactorCore = new ReactorCore(50, 100, 50, 100, 100, 100, 100);
            Console.WriteLine("Fuel rod level {1}, control rod level {3}, water reactor level {4}, uranium level {5}, boron level {6}", reactorCore.fuelRodLevel, reactorCore.controlRodLevel, reactorCore.waterReactorLevel, reactorCore.uraniumAmount, reactorCore.boronAmount);


        }
예제 #11
0
        public void Test18()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-41..5,y=-41..6,z=-36..8");
            var sut      = new ReactorCore(@"on x=-41..-6,y=-41..6,z=-36..8
on x=-5..5,y=-41..-32,z=-36..8
on x=-5..5,y=-31..6,z=-36..-20
on x=-5..5,y=-31..6,z=-19..8
on x=-5..5,y=-31..6,z=9..33
on x=-5..5,y=7..22,z=-19..33
on x=6..47,y=-31..22,z=-19..33");

            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
예제 #12
0
        public void Test17()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-20..34,y=-40..6,z=-44..1");
            var sut      = new ReactorCore(@"on x=-20..-6,y=-40..6,z=-44..1
on x=-5..34,y=-40..-32,z=-44..1
on x=-5..34,y=-31..6,z=-44..-20
on x=-5..34,y=-31..6,z=-19..1
on x=-5..34,y=-31..6,z=2..33
on x=-5..34,y=7..22,z=-19..33
on x=35..47,y=-31..22,z=-19..33");

            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
예제 #13
0
        public void Test16()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-49..-1,y=-11..42,z=-10..38");
            var sut      = new ReactorCore(@"on x=-49..-6,y=-11..42,z=-10..38
on x=-5..-1,y=-31..-12,z=-19..33
on x=-5..-1,y=-11..22,z=-19..-11
on x=-5..-1,y=-11..22,z=-10..33
on x=-5..-1,y=-11..22,z=34..38
on x=-5..-1,y=23..42,z=-10..38
on x=0..47,y=-31..22,z=-19..33");

            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
예제 #14
0
        public void Test19()
        {
            var original = new ReactorCore(@"on x=-5..47,y=-31..22,z=-19..33
on x=-33..15,y=-32..19,z=-34..11");
            var sut      = new ReactorCore(@"on x=-33..-6,y=-32..19,z=-34..11
on x=-5..15,y=-32..-32,z=-34..11
on x=-5..15,y=-31..19,z=-34..-20
on x=-5..15,y=-31..19,z=-19..11
on x=-5..15,y=-31..19,z=12..33
on x=-5..15,y=20..22,z=-19..33
on x=16..47,y=-31..22,z=-19..33");

            Assert.Equal(235693, original.GetTurnedOnCubesCount());
            Assert.Equal(original.GetTurnedOnCubesCount(), sut.GetTurnedOnCubesCount());
            Assert.True(original.HasOverlaps);
            Assert.False(sut.HasOverlaps);
        }
예제 #15
0
    public ReactorCore SelectCore(List <ReactorCore> Cores)
    {
        ReactorCore SelectedCore = null;

        if (null != Cores)
        {
            int ChosenCore = Random.Range(0, Cores.Count);

            SelectedCore = Cores[ChosenCore];
        }

        if (null != SelectedCore)
        {
            return(SelectedCore);
        }
        else
        {
            return(null);
        }
    }
예제 #16
0
    // Update is called once per frame
    void Update()
    {
        if (!Managing)
        {
            StartCoroutine(ManageReactors());
        }

        if ((Input.touchCount > 0) && (Input.GetTouch(0).phase == TouchPhase.Ended))
        {
            RaycastHit hit = new RaycastHit();
            foreach (Touch touch in Input.touches)
            {
                Ray ray = Camera.main.ScreenPointToRay(touch.position);
                if (Physics.Raycast(ray, out hit, Mathf.Infinity))
                {
                    if (null != hit.collider)
                    {
                        GameObject  Core = hit.transform.gameObject;
                        ReactorCore core = Core.GetComponent <ReactorCore>();
                        if (null == core)
                        {
                            core = Core.transform.parent.gameObject.GetComponent <ReactorCore>();
                        }
                        if (null != core)
                        {
                            Debug.Log("Touch processed.");
                            core.OnMouseUp();
                        }
                        break;
                    }
                }
            }
        }

        ProcessKeyInput();
    }
예제 #17
0
 public override int ExpendExhaust(ReactorCore core)
 {
     core.Temperature = 0;
     return base.ExpendExhaust(core);
 }
예제 #18
0
 public virtual int ExpendExhaust(ReactorCore core)
 {
     return 0;
 }
예제 #19
0
        public void BeInitializedCorrectly(string steps, int expectedCount)
        {
            var sut = new ReactorCore(steps);

            Assert.Equal(expectedCount, sut.GetTurnedOnCubesCount());
        }