Exemplo n.º 1
0
 void Awake()
 {
     if (StepSound.instance == null)
     {// 인스턴스가 비어있으면
         StepSound.instance = this;   //이것의 인스턴스를 집어넣는다.
     }
 }
Exemplo n.º 2
0
    public void PlayStepSound(StepSound sound)
    {
        switch (sound)
        {
        case StepSound.Snow:
        {
            int index = Random.Range(0, SnowStepSounds.Count - 1);
            audioSource.clip = SnowStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is SNOW");
            break;
        }

        case StepSound.Wood:
        {
            int index = Random.Range(0, WoodStepSounds.Count - 1);
            audioSource.clip = WoodStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is WOOD");
            break;
        }

        case StepSound.Metal:
        {
            int index = Random.Range(0, MetalStepSounds.Count - 1);
            audioSource.clip = MetalStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is METAL");
            break;
        }

        case StepSound.Grass:
        {
            int index = Random.Range(0, GrassStepSounds.Count - 1);
            audioSource.clip = GrassStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is GRASS");
            break;
        }

        case StepSound.Water:
        {
            int index = Random.Range(0, WaterStepSounds.Count - 1);
            audioSource.clip = WaterStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is WATER");
            break;
        }

        case StepSound.Dirt:
        {
            int index = Random.Range(0, DirtStepSounds.Count - 1);
            audioSource.clip = DirtStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is DIRT");
            break;
        }

        case StepSound.Mud:
        {
            int index = Random.Range(0, MudStepSounds.Count - 1);
            audioSource.clip = MudStepSounds[index];
            audioSource.Play();
            //Debug.Log("This is MUD");
            break;
        }

        default:
        {
            int index = Random.Range(0, stepSounds.Count - 1);
            audioSource.clip = stepSounds[index];
            audioSource.Play();
            break;
        }
        }
    }
Exemplo n.º 3
0
        public Block setStepSound(StepSound stepsound)
        {
            stepSound = stepsound;

            return this;
        }
Exemplo n.º 4
0
 public Block(int i, Material material)
 {
     stepSound = soundPowderFootstep;
     blockParticleGravity = 1.0F;
     slipperiness = 0.6F;
     if (blocksList[i] != null)
     {
         throw new IllegalArgumentException(
             (new StringBuilder()).append("Slot ").append(i).append(" is already occupied by ").append(
                 blocksList[i]).append(" when adding ").append(this).toString());
     }
     else
     {
         blockMaterial = material;
         blocksList[i] = this;
         blockID = i;
         setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
         opaqueCubeLookup[i] = isOpaqueCube();
         lightOpacity[i] = isOpaqueCube() ? 255 : 0;
         field_537_s[i] = !material.getCanBlockGrass();
         isBlockContainer[i] = false;
         return;
     }
 }
Exemplo n.º 5
0
        static Block()
        {
            {
                soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F);
                soundWoodFootstep = new StepSound("wood", 1.0F, 1.0F);
                soundGravelFootstep = new StepSound("gravel", 1.0F, 1.0F);
                soundGrassFootstep = new StepSound("grass", 1.0F, 1.0F);
                soundStoneFootstep = new StepSound("stone", 1.0F, 1.0F);
                soundMetalFootstep = new StepSound("stone", 1.0F, 1.5F);
                soundGlassFootstep = new StepSoundStone("stone", 1.0F, 1.0F);
                soundClothFootstep = new StepSound("cloth", 1.0F, 1.0F);
                soundSandFootstep = new StepSoundSand("sand", 1.0F, 1.0F);
                blocksList = new Block[256];
                field_537_s = new bool[256];
                stone =
                    (new BlockStone(1, 1)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep).
                        setBlockName("stone");
                grass =
                    (BlockGrass)
                    (new BlockGrass(2)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("grass");
                dirt = (new BlockDirt(3, 2)).setHardness(0.5F).setStepSound(soundGravelFootstep).setBlockName("dirt");
                cobblestone =
                    (new Block(4, 16, Material.rock)).setHardness(2.0F).setResistance(10F).setStepSound(
                        soundStoneFootstep).setBlockName("stonebrick");
                planks =
                    (new Block(5, 4, Material.wood)).setHardness(2.0F).setResistance(5F).setStepSound(soundWoodFootstep)
                        .setBlockName("wood");
                sapling =
                    (new BlockSapling(6, 15)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("sapling");
                bedrock =
                    (new Block(7, 17, Material.rock)).setHardness(-1F).setResistance(6000000F).setStepSound(
                        soundStoneFootstep).setBlockName("bedrock");
                waterStill =
                    (new BlockFlowing(8, Material.water)).setHardness(100F).setLightOpacity(3).setBlockName("water");
                waterMoving =
                    (new BlockStationary(9, Material.water)).setHardness(100F).setLightOpacity(3).setBlockName("water");
                lavaStill =
                    (new BlockFlowing(10, Material.lava)).setHardness(0.0F).setLightValue(1.0F).setLightOpacity(255).
                        setBlockName("lava");
                lavaMoving =
                    (new BlockStationary(11, Material.lava)).setHardness(100F).setLightValue(1.0F).setLightOpacity(255).
                        setBlockName("lava");
                sand = (new BlockSand(12, 18)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("sand");
                gravel =
                    (new BlockGravel(13, 19)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("gravel");
                oreGold =
                    (new BlockOre(14, 32)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).
                        setBlockName("oreGold");
                oreIron =
                    (new BlockOre(15, 33)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).
                        setBlockName("oreIron");
                oreCoal =
                    (new BlockOre(16, 34)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).
                        setBlockName("oreCoal");
                wood = (new BlockLog(17)).setHardness(2.0F).setStepSound(soundWoodFootstep).setBlockName("log");
                leaves =
                    (BlockLeaves)
                    (new BlockLeaves(18, 52)).setHardness(0.2F).setLightOpacity(1).setStepSound(soundGrassFootstep).
                        setBlockName("leaves");
                sponge = (new BlockSponge(19)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("sponge");
                glass =
                    (new BlockGlass(20, 49, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).
                        setBlockName("glass");
                oreLapis =
                    (new BlockOre(21, 160)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).
                        setBlockName("oreLapis");
                blockLapis =
                    (new Block(22, 144, Material.rock)).setHardness(3F).setResistance(5F).setStepSound(
                        soundStoneFootstep).setBlockName("blockLapis");
                dispenser =
                    (new BlockDispenser(23)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("dispenser");
                sandStone =
                    (new BlockSandStone(24)).setStepSound(soundStoneFootstep).setHardness(0.8F).setBlockName("sandStone");
                cloth = (new BlockCloth()).setHardness(0.8F).setStepSound(soundClothFootstep).setBlockName("cloth");
                plantYellow =
                    (BlockFlower)
                    (new BlockFlower(37, 13)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("flower");
                plantRed =
                    (BlockFlower)
                    (new BlockFlower(38, 12)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("rose");
                mushroomBrown =
                    (BlockFlower)
                    (new BlockMushroom(39, 29)).setHardness(0.0F).setStepSound(soundGrassFootstep).setLightValue(0.125F)
                        .setBlockName("mushroom");
                mushroomRed =
                    (BlockFlower)
                    (new BlockMushroom(40, 28)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName(
                        "mushroom");
                blockGold =
                    (new BlockOreBlock(41, 23)).setHardness(3F).setResistance(10F).setStepSound(soundMetalFootstep).
                        setBlockName("blockGold");
                blockSteel =
                    (new BlockOreBlock(42, 22)).setHardness(5F).setResistance(10F).setStepSound(soundMetalFootstep).
                        setBlockName("blockIron");
                stairDouble =
                    (new BlockStep(43, true)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).
                        setBlockName("stoneSlab");
                stairSingle =
                    (new BlockStep(44, false)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).
                        setBlockName("stoneSlab");
                brick =
                    (new Block(45, 7, Material.rock)).setHardness(2.0F).setResistance(10F).setStepSound(
                        soundStoneFootstep).setBlockName("brick");
                tnt = (new BlockTNT(46, 8)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tnt");
                bookShelf =
                    (new BlockBookshelf(47, 35)).setHardness(1.5F).setStepSound(soundWoodFootstep).setBlockName(
                        "bookshelf");
                cobblestoneMossy =
                    (new Block(48, 36, Material.rock)).setHardness(2.0F).setResistance(10F).setStepSound(
                        soundStoneFootstep).setBlockName("stoneMoss");
                obsidian =
                    (new BlockObsidian(49, 37)).setHardness(10F).setResistance(2000F).setStepSound(soundStoneFootstep).
                        setBlockName("obsidian");
                torchWood =
                    (new BlockTorch(50, 80)).setHardness(0.0F).setLightValue(0.9375F).setStepSound(soundWoodFootstep).
                        setBlockName("torch");
                fire =
                    (BlockFire)
                    (new BlockFire(51, 31)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).
                        setBlockName("fire");
                mobSpawner =
                    (new BlockMobSpawner(52, 65)).setHardness(5F).setStepSound(soundMetalFootstep).setBlockName(
                        "mobSpawner");
                stairCompactPlanks = (new BlockStairs(53, planks)).setBlockName("stairsWood");
                crate = (new BlockChest(54)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("chest");
                redstoneWire =
                    (new BlockRedstoneWire(55, 164)).setHardness(0.0F).setStepSound(soundPowderFootstep).setBlockName(
                        "redstoneDust");
                oreDiamond =
                    (new BlockOre(56, 50)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).
                        setBlockName("oreDiamond");
                blockDiamond =
                    (new BlockOreBlock(57, 24)).setHardness(5F).setResistance(10F).setStepSound(soundMetalFootstep).
                        setBlockName("blockDiamond");
                workbench =
                    (new BlockWorkbench(58)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("workbench");
                crops = (new BlockCrops(59, 88)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("crops");
                tilledField =
                    (new BlockSoil(60)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("farmland");
                stoneOvenIdle =
                    (new BlockFurnace(61, false)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName(
                        "furnace");
                stoneOvenActive =
                    (new BlockFurnace(62, true)).setHardness(3.5F).setStepSound(soundStoneFootstep).setLightValue(0.875F)
                        .setBlockName("furnace");
                signPost =
                    (new BlockSign(63, typeof (TileEntitySign), true)).setHardness(1.0F).setStepSound(soundWoodFootstep)
                        .setBlockName("sign");
                doorWood =
                    (new BlockDoor(64, Material.wood)).setHardness(3F).setStepSound(soundWoodFootstep).setBlockName(
                        "doorWood");
                ladder =
                    (new BlockLadder(65, 83)).setHardness(0.4F).setStepSound(soundWoodFootstep).setBlockName("ladder");
                minecartTrack =
                    (new BlockMinecartTrack(66, 128)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName(
                        "rail");
                stairCompactCobblestone = (new BlockStairs(67, cobblestone)).setBlockName("stairsStone");
                signWall =
                    (new BlockSign(68, typeof (TileEntitySign), false)).setHardness(1.0F).setStepSound(soundWoodFootstep)
                        .setBlockName("sign");
                lever = (new BlockLever(69, 96)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("lever");
                pressurePlateStone =
                    (new BlockPressurePlate(70, stone.blockIndexInTexture, EnumMobType.mobs)).setHardness(0.5F).
                        setStepSound(soundStoneFootstep).setBlockName("pressurePlate");
                doorSteel =
                    (new BlockDoor(71, Material.iron)).setHardness(5F).setStepSound(soundMetalFootstep).setBlockName(
                        "doorIron");
                pressurePlatePlanks =
                    (new BlockPressurePlate(72, planks.blockIndexInTexture, EnumMobType.everything)).setHardness(0.5F).
                        setStepSound(soundWoodFootstep).setBlockName("pressurePlate");
                oreRedstone =
                    (new BlockRedstoneOre(73, 51, false)).setHardness(3F).setResistance(5F).setStepSound(
                        soundStoneFootstep).setBlockName("oreRedstone");
                oreRedstoneGlowing =
                    (new BlockRedstoneOre(74, 51, true)).setLightValue(0.625F).setHardness(3F).setResistance(5F).
                        setStepSound(soundStoneFootstep).setBlockName("oreRedstone");
                torchRedstoneIdle =
                    (new BlockRedstoneTorch(75, 115, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).
                        setBlockName("notGate");
                torchRedstoneActive =
                    (new BlockRedstoneTorch(76, 99, true)).setHardness(0.0F).setLightValue(0.5F).setStepSound(
                        soundWoodFootstep).setBlockName("notGate");
                button =
                    (new BlockButton(77, stone.blockIndexInTexture)).setHardness(0.5F).setStepSound(soundStoneFootstep).
                        setBlockName("button");
                snow = (new BlockSnow(78, 66)).setHardness(0.1F).setStepSound(soundClothFootstep).setBlockName("snow");
                ice =
                    (new BlockIce(79, 67)).setHardness(0.5F).setLightOpacity(3).setStepSound(soundGlassFootstep).
                        setBlockName("ice");
                blockSnow =
                    (new BlockSnowBlock(80, 66)).setHardness(0.2F).setStepSound(soundClothFootstep).setBlockName("snow");
                cactus =
                    (new BlockCactus(81, 70)).setHardness(0.4F).setStepSound(soundClothFootstep).setBlockName("cactus");
                blockClay =
                    (new BlockClay(82, 72)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("clay");
                reed = (new BlockReed(83, 73)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("reeds");
                jukebox =
                    (new BlockJukeBox(84, 74)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).
                        setBlockName("jukebox");
                fence =
                    (new BlockFence(85, 4)).setHardness(2.0F).setResistance(5F).setStepSound(soundWoodFootstep).
                        setBlockName("fence");
                pumpkin =
                    (new BlockPumpkin(86, 102, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName(
                        "pumpkin");
                bloodStone =
                    (new BlockBloodStone(87, 103)).setHardness(0.4F).setStepSound(soundStoneFootstep).setBlockName(
                        "hellrock");
                slowSand =
                    (new BlockSlowSand(88, 104)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName(
                        "hellsand");
                lightStone =
                    (new BlockLightStone(89, 105, Material.glass)).setHardness(0.3F).setStepSound(soundGlassFootstep).
                        setLightValue(1.0F).setBlockName("lightgem");
                portal =
                    (BlockPortal)
                    (new BlockPortal(90, 14)).setHardness(-1F).setStepSound(soundGlassFootstep).setLightValue(0.75F).
                        setBlockName("portal");
                pumpkinLantern =
                    (new BlockPumpkin(91, 102, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setLightValue(
                        1.0F).setBlockName("litpumpkin");
                cake = (new BlockCake(92, 121)).setHardness(0.5F).setStepSound(soundClothFootstep).setBlockName("cake");
                field_22011_bh =
                    (new BlockRedstoneRepeater(93, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).
                        setBlockName("diode");
                field_22010_bi =
                    (new BlockRedstoneRepeater(94, true)).setHardness(0.0F).setLightValue(0.625F).setStepSound(
                        soundWoodFootstep).setBlockName("diode");
                musicBlock = (new BlockNote(25)).setHardness(0.8F).setBlockName("musicBlock");
                bed = (new BlockBed(26)).setHardness(0.2F).setBlockName("bed");
                Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth");
                Item.itemsList[wood.blockID] = (new ItemLog(wood.blockID - 256)).setItemName("log");
                Item.itemsList[stairSingle.blockID] = (new ItemSlab(stairSingle.blockID - 256)).setItemName("stoneSlab");
                for (int i = 0; i < 256; i++)
                {
                    if (blocksList[i] != null && Item.itemsList[i] == null)
                    {
                        Item.itemsList[i] = new ItemBlock(i - 256);
                    }
                }

                field_537_s[0] = true;
            }
        }
Exemplo n.º 6
0
        public Gesture(AssetData asset)
        {
            string input = asset.Data.FromUTF8Bytes();

            input = input.Replace('\t', ' ');
            var lines = new List <string>(input.Split('\n'));

            using (var e = lines.GetEnumerator())
            {
                if (!e.MoveNext())
                {
                    throw new NotAGestureFormatException();
                }
                int i;

                if (!int.TryParse(e.Current, out i))
                {
                    throw new NotAGestureFormatException();
                }
                if (i != 2)
                {
                    throw new NotAGestureFormatException();
                }

                if (!e.MoveNext())
                {
                    throw new NotAGestureFormatException();
                }

                if (!byte.TryParse(e.Current, out TriggerKey))
                {
                    throw new NotAGestureFormatException();
                }

                if (!e.MoveNext())
                {
                    throw new NotAGestureFormatException();
                }

                if (!uint.TryParse(e.Current, out TriggerKeyMask))
                {
                    throw new NotAGestureFormatException();
                }

                if (!e.MoveNext())
                {
                    throw new NotAGestureFormatException();
                }
                Trigger = e.Current;

                if (!e.MoveNext())
                {
                    throw new NotAGestureFormatException();
                }
                ReplaceWith = e.Current;

                if (!e.MoveNext())
                {
                    throw new NotAGestureFormatException();
                }
                int count;
                if (!int.TryParse(e.Current, out count))
                {
                    throw new NotAGestureFormatException();
                }

                if (count < 0)
                {
                    throw new NotAGestureFormatException();
                }

                for (int idx = 0; idx < count; ++idx)
                {
                    if (!e.MoveNext())
                    {
                        throw new NotAGestureFormatException();
                    }

                    int intval;
                    if (!int.TryParse(e.Current, out intval))
                    {
                        throw new NotAGestureFormatException();
                    }
                    switch ((StepType)intval)
                    {
                    case StepType.EndOfGesture:
                        Sequence.Add(new StepEndOfGesture());
                        return;

                    case StepType.Animation:
                    {
                        var step = new StepAnimation();
                        if (e.MoveNext())
                        {
                            step.Name = e.Current;
                        }
                        if (e.MoveNext() &&
                            !UUID.TryParse(e.Current, out step.AssetID))
                        {
                            throw new NotAGestureFormatException();
                        }
                        if (e.MoveNext() &&
                            !int.TryParse(e.Current, out intval))
                        {
                            throw new NotAGestureFormatException();
                        }
                        step.AnimationStart = intval != 0;
                        Sequence.Add(step);
                    }
                    break;

                    case StepType.Sound:
                    {
                        var step = new StepSound();
                        if (e.MoveNext())
                        {
                            step.Name = e.Current;
                        }
                        if (e.MoveNext() &&
                            !UUID.TryParse(e.Current, out step.AssetID))
                        {
                            throw new NotAGestureFormatException();
                        }
                        Sequence.Add(step);
                    }
                    break;

                    case StepType.Chat:
                    {
                        var step = new StepChat();
                        if (e.MoveNext())
                        {
                            step.Text = e.Current;
                        }
                        e.MoveNext();
                        Sequence.Add(step);
                    }
                    break;

                    case StepType.Wait:
                    {
                        var step = new StepWait();
                        if (e.MoveNext() &&
                            !float.TryParse(e.Current, NumberStyles.Float, CultureInfo.InvariantCulture, out step.WaitTime))
                        {
                            throw new NotAGestureFormatException();
                        }
                        if (e.MoveNext())
                        {
                            int flags;
                            if (!int.TryParse(e.Current, out flags))
                            {
                                throw new NotAGestureFormatException();
                            }
                            step.WaitForTime      = (flags & 0x01) != 0;
                            step.WaitForAnimation = (flags & 0x02) != 0;
                        }
                        Sequence.Add(step);
                    }
                    break;

                    default:
                        throw new NotAGestureFormatException();
                    }
                }
            }
        }