示例#1
0
 public void DwarfStucked(Dwarf2 dwarf)
 {
     if (dwarf == dwarf1)
     {
         moveDwarf1 = false;
     }
     else
     {
         moveDwarf2 = false;
     }
 }
示例#2
0
        public void Dwarf2Test()
        {
            var elf   = new Elf(File.ReadAllBytes(@"TestData\Sphere.o"));
            var dwarf = new Dwarf2(elf);

            Assert.AreEqual(1, dwarf.RootDies.Length);
            Assert.IsInstanceOfType(dwarf.RootDies[0], typeof(Dwarf2CompileUnit));
            var vecFx32Die = ((Dwarf2CompileUnit)dwarf.RootDies[0]).Children.Find(child =>
                                                                                  child is Dwarf2ClassType c && c.Name == "VecFx32");

            Assert.IsNotNull(vecFx32Die);
            Assert.AreEqual(3, vecFx32Die.Children.Count);
        }
示例#3
0
    public void DwarfStateChanged(Dwarf2 dwarf, FusionStates newState)
    {
        Debug.Log(newState.ToString());
        Debug.Log(fusionState);
        switch (fusionState)
        {
        case FusionStates.Nothing:
            if (newState != FusionStates.Trying)
            {
                return;
            }
            fusionState = FusionStates.Trying;
            break;

        case FusionStates.Trying:
            if (newState == FusionStates.Trying)
            {
                climber     = (dwarf == dwarf1) ? 1 : 2;
                fusionState = FusionStates.Fusionning;
                dwarf1.StartFusion();
                dwarf2.StartFusion();
            }
            else if (newState == FusionStates.Nothing)
            {
                fusionState = FusionStates.Nothing;
            }
            else
            {
                return;
            }
            break;

        case FusionStates.Fusionning:
            if (newState == FusionStates.Joined)
            {
                fusionState = FusionStates.Joined;
            }
            else if (newState == FusionStates.Nothing)
            {
                fusionState = FusionStates.Nothing;
            }
            else
            {
                return;
            }
            break;

        case FusionStates.Joined:
            if (newState == FusionStates.Nothing)
            {
                fusionState = FusionStates.Nothing;
                if (dwarf == dwarf1)
                {
                    dwarf2.UnJoin();
                }
                else
                {
                    dwarf1.UnJoin();
                }
            }
            else
            {
                return;
            }
            break;
        }
    }