コード例 #1
0
        /// <summary>
        ///     Schedules a tick according to the given tick offset;
        /// </summary>
        /// <param name="world">The world in which the block is.</param>
        /// <param name="position">The position of the block a tick should be scheduled for.</param>
        /// <param name="tickOffset">The offset in frames to when the block should be ticked.</param>
        protected void ScheduleTick(World world, Vector3i position, int tickOffset)
        {
            Chunk?chunk = world.GetChunkWithPosition(position);

            chunk?.ScheduleBlockTick(new BlockTick(position, this, TickOperation.Tick), tickOffset);
        }
コード例 #2
0
        /// <summary>
        ///     Schedule the destruction of this block.
        /// </summary>
        /// <param name="world">The world in which the block is located.</param>
        /// <param name="position">The position of the block that will be scheduled to be destroyed.</param>
        protected void ScheduleDestroy(World world, Vector3i position)
        {
            Chunk?chunk = world.GetChunkWithPosition(position);

            chunk?.ScheduleBlockTick(new BlockTick(position, this, TickOperation.Destroy), ScheduledDestroyOffset);
        }
コード例 #3
0
        /// <summary>
        ///     Schedules a tick according to the viscosity.
        /// </summary>
        protected void ScheduleTick(World world, Vector3i position)
        {
            Chunk?chunk = world.GetChunkWithPosition(position);

            chunk?.ScheduleLiquidTick(new LiquidTick(position, this), Viscosity);
        }