コード例 #1
0
ファイル: ZBEffectDeco.cs プロジェクト: Zipcore/7Dmods
        public IEnumerator Fly(BlockPos pos, string item)
        {
            int my = (pos.Value.Block.isMultiBlock) ? pos.Value.Block.multiBlockPos.dim.y : 1;
            // GameManager.Instance.World.SetBlockRPC(pos.Pos, BlockValue.Air);
            // yield return WaitFrame;
            int     wgt    = ItemClass.GetItem(item, false).ItemClass.Weight.Value; // TODO: quicker access string->ItemValue->ItemClass
            Vector3 dir    = Upward(this.rand, wgt);
            float   offset = (1f + my / 2f - 1f);

            offset = offset = Math.Max(offset, 2);
            if (item.Equals("ZBProj_treeShrub"))
            {
                offset = offset = Math.Max(offset, 3);
            }

            SdtdUtils.EffectsItem.SpawnParticle(Vectors.ToFloat(pos.Pos), "wire_tool_sparks", biome.groundColor, "electric_fence_impact");
            yield return(afterParticle);

            yield return(Zombiome.Routines.Start(EffectsItem.spawnItemGhost(
                                                     item,
                                                     Vectors.ToFloat(pos.Pos) + offset * Vectors.Float.UnitY,
                                                     dir// throw dir
                                                     ), "FlyDeco-Item"));

            // yield return WaitFrame; // o ther way around, byt careful not to spawn on existing (ghost proj will delay it though)
            GameManager.Instance.World.SetBlockRPC(pos.Pos, BlockValue.Air);
            // Do not repop because the projectile does at impact !
        }
コード例 #2
0
        public static IEnumerator ThrowItem(Vector3 pos, string item, int rep = 1)
        {
            for (int k = 0; k < rep; k++)
            {
                yield return(EffectsItem.spawnItemGhost(item, pos, -Vectors.Float.UnitY));

                yield return(echo);
            }
        }
コード例 #3
0
ファイル: ZBEffectGround.cs プロジェクト: Zipcore/7Dmods
        private IEnumerator PeakProj(EntityPlayer player, Emplacement place, OptionEffect opt)
        {
            yield return(EffectsGround.Peak(player, place, opt));

            for (int k = 0; k < 10; k++)
            {
                Vector3 pos = place.position + (opt.OptionShape.shape.y + 2) * Vectors.Float.UnitY;
                yield return(EffectsItem.spawnItemGhost(opt.OptionItem.item,
                                                        pos,
                                                        3 * (Vectors.Float.UnitY + Placer.directions.Generate(pos).normalized)
                                                        ));

                yield return(new WaitForSeconds(0.5f));
            }
        }
コード例 #4
0
        public override void Effect1(EntityPlayer player, Emplacement place, OptionEffect opt)
        {
            // Ignore place.direction, regen it
            // Iter.EverySeconds(ref tMonitor, dtMonitor, this.Monitor(player.GetPosition()), place.position);

            Vector3i iwhere = place.ipos;

            iwhere = Geo3D.Surface(iwhere);
            Vector3 speed = -Vectors.Float.UnitY + Vectors.Float.Randomize(rand, 0.5f);

            speed = speed.normalized * (50 + 50 * rand.RandomFloat); // weight 100
            speed = 0f * speed;                                      // [!]
            float altitude = 25;

            Printer.Log(40, "Meteorite Effect1", iwhere, speed, altitude);
            Vector3 where = Vectors.ToFloat(iwhere) + new Vector3(0f, altitude, 0f);
            where.y       = 254f; // accelere trop ?
            Zombiome.Routines.Start(EffectsItem.spawnItemGhost(
                                        opt.OptionItem.item,
                                        where,
                                        speed
                                        // Vectors.Float.Randomize(GameManager.Instance.World.GetGameRandom(), 1f, speed)
                                        ), "Meteorite-spawnItemGhost");
        }