コード例 #1
1
        public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer)
        {

            if (firstTime)
            {
                oldViewProjection = world.CameraManager.ActiveCamera.ViewProjection;
                firstTime = false;
            }

            effect.Parameters["attenuation"].SetValue(Attenuation);
            effect.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);
            effect.Parameters["InvertViewProjection"].SetValue(Matrix.Invert(world.CameraManager.ActiveCamera.ViewProjection));
            effect.Parameters["oldViewProjection"].SetValue(oldViewProjection);
            effect.Parameters["numSamples"].SetValue(NumSamples);
            effect.Parameters["depth"].SetValue(rHelper[PrincipalConstants.DephRT]);
            effect.Parameters["extra"].SetValue(rHelper[PrincipalConstants.extra1RT]);
            effect.Parameters["cena"].SetValue(ImageToProcess);

            oldViewProjection = world.CameraManager.ActiveCamera.ViewProjection;

            if (useFloatBuffer)
                rHelper.RenderFullScreenQuadVertexPixel(effect, SamplerState.PointClamp);
            else
                rHelper.RenderFullScreenQuadVertexPixel(effect, GraphicInfo.SamplerState);
        }
コード例 #2
0
ファイル: FarmlandBlock.cs プロジェクト: Zoxive/TrueCraft
 void HydrationCheckEvent(IMultiplayerServer server, Coordinates3D coords, IWorld world)
 {
     if (world.GetBlockID(coords) != BlockID)
         return;
     if (MathHelper.Random.Next(3) == 0)
     {
         var meta = world.GetMetadata(coords);
         if (IsHydrated(coords, world) && meta != 15)
             meta++;
         else
         {
             meta--;
             if (meta == 0)
             {
                 world.SetBlockID(coords, BlockID);
                 return;
             }
         }
         world.SetMetadata(coords, meta);
     }
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("farmland", chunk,
         TimeSpan.FromSeconds(UpdateIntervalSeconds),
         _server => HydrationCheckEvent(_server, coords, world));
 }
コード例 #3
0
        protected override void SetWorldAndRenderTechnich(out IRenderTechnic renderTech, out IWorld world)
        {
            world = new IWorld(new BepuPhysicWorld(), new SimpleCuller());

            ForwardRenderTecnichDescription desc = ForwardRenderTecnichDescription.Default();
            renderTech = new ForwardRenderTecnich(desc);
        }
コード例 #4
0
 public CameraFollowPath(CameraPathData data,IWorld world , String nextCam )
 {            
     this.world = world;
     this.nextCam = nextCam;
     this.data = data;            
     _projection = Matrix.CreatePerspectiveFieldOfView(_fieldOdView, _aspectRatio, _nearPlane, _farPlane);
 }
コード例 #5
0
 protected override void SetWorldAndRenderTechnich(out IRenderTechnic renderTech, out IWorld world)
 {
     world = new IWorld(new BepuPhysicWorld(), new SimpleCuller());
     DeferredRenderTechnicInitDescription desc = DeferredRenderTechnicInitDescription.Default();            
     desc.UseFloatingBufferForLightMap = false;
     renderTech = new DeferredRenderTechnic(desc) ;   
 }
コード例 #6
0
ファイル: PhysicsEngine.cs プロジェクト: Zoxive/TrueCraft
 public PhysicsEngine(IWorld world, IBlockPhysicsProvider physicsProvider)
 {
     World = world;
     Entities = new List<IPhysicsEntity>();
     EntityLock = new object();
     BlockPhysicsProvider = physicsProvider;
 }
コード例 #7
0
ファイル: SugarcaneBlock.cs プロジェクト: Luigifan/TrueCraft
 public static bool ValidPlacement(BlockDescriptor descriptor, IWorld world)
 {
     var below = world.GetBlockID(descriptor.Coordinates + Coordinates3D.Down);
     if (below != SugarcaneBlock.BlockID && below != GrassBlock.BlockID && below != DirtBlock.BlockID)
         return false;
     var toCheck = new[]
     {
         Coordinates3D.Down + Coordinates3D.Left,
         Coordinates3D.Down + Coordinates3D.Right,
         Coordinates3D.Down + Coordinates3D.Backwards,
         Coordinates3D.Down + Coordinates3D.Forwards
     };
     if (below != BlockID)
     {
         bool foundWater = false;
         for (int i = 0; i < toCheck.Length; i++)
         {
             var id = world.GetBlockID(descriptor.Coordinates + toCheck[i]);
             if (id == WaterBlock.BlockID || id == StationaryWaterBlock.BlockID)
             {
                 foundWater = true;
                 break;
             }
         }
         return foundWater;
     }
     return true;
 }
コード例 #8
0
ファイル: TrapdoorBlock.cs プロジェクト: Zoxive/TrueCraft
        public override void ItemUsedOnBlock(Coordinates3D coordinates, ItemStack item, BlockFace face, IWorld world, IRemoteClient user)
        {
            if (face == BlockFace.PositiveY || face == BlockFace.NegativeY)
            {
                // Trapdoors are not placed when the user clicks on the top or bottom of a block
                return;
            }

            // NOTE: These directions are rotated by 90 degrees so that the hinge of the trapdoor is placed
            // where the user had their cursor.
            switch (face)
            {
                case BlockFace.NegativeZ:
                    item.Metadata = (byte)TrapdoorDirection.West;
                    break;
                case BlockFace.PositiveZ:
                    item.Metadata = (byte)TrapdoorDirection.East;
                    break;
                case BlockFace.NegativeX:
                    item.Metadata = (byte)TrapdoorDirection.South;
                    break;
                case BlockFace.PositiveX:
                    item.Metadata = (byte)TrapdoorDirection.North;
                    break;
                default:
                    return;
            }

            base.ItemUsedOnBlock(coordinates, item, face, world, user);
        }
コード例 #9
0
        public override void Draw(Texture2D ImageToProcess,RenderHelper rHelper, GameTime gt, Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatingBuffer)
        {            
            rHelper.PushRenderTarget(renderTarget1);
            Saturate.Parameters["current"].SetValue(ImageToProcess);
            Saturate.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);
            if(useFloatingBuffer)
                rHelper.RenderFullScreenQuadVertexPixel(Saturate,SamplerState.PointClamp);
            else
                rHelper.RenderFullScreenQuadVertexPixel(Saturate, SamplerState.LinearClamp);

            Texture2D t = rHelper.PopRenderTargetAsSingleRenderTarget2D();

            rHelper.PushRenderTarget(renderTarget0);
            gaussian.Draw(t, rHelper, gt, GraphicInfo, world,useFloatingBuffer);
            Texture2D x = rHelper.PopRenderTargetAsSingleRenderTarget2D();
            rHelper.Clear(Color.Black);

            Combine.Parameters["halfPixel"].SetValue(GraphicInfo.HalfPixel);
            Combine.Parameters["base"].SetValue(ImageToProcess);
            Combine.Parameters["last"].SetValue(x);
            if (useFloatingBuffer)
                rHelper.RenderFullScreenQuadVertexPixel(Combine , SamplerState.PointClamp);
            else
                rHelper.RenderFullScreenQuadVertexPixel(Combine, GraphicInfo.SamplerState);
        }
コード例 #10
0
ファイル: Wander.cs プロジェクト: Twistie/Tick
        public Wander(Entity o, IWorld map)
            : base(o)
        {
            WorldMap = map;

            curDest = WorldMap.GetArea(random.Next(10), random.Next(10));
        }
コード例 #11
0
ファイル: CactusBlock.cs プロジェクト: ComputeLinux/TrueCraft
 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("cactus", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(MinGrowthSeconds, MaxGrowthSeconds)),
         s => TryGrowth(s, coords, world));
 }
コード例 #12
0
 public AlleleManager(IWorld world)
 {
     _controls = new List<IAlleleControl>();
     _alleles = new List<IAllele>();
     _world = world;
     _dominantAlleles = new List<IAllele>();
 }
コード例 #13
0
ファイル: DungeonDecorator.cs プロジェクト: Zoxive/TrueCraft
        public void Decorate(IWorld world, IChunk chunk, IBiomeRepository biomes)
        {
            for (int attempts = 0; attempts < 8; attempts++)
            {
                var noise = new Perlin();
                noise.Seed = world.Seed - (chunk.Coordinates.X + chunk.Coordinates.Z);
                var offsetNoise = new ClampNoise(noise);
                offsetNoise.MaxValue = 3;
                var x = 0;
                var z = 0;
                var offset = 0.0;
                offset += offsetNoise.Value2D(x, z);
                int finalX = (int)Math.Floor(x + offset);
                int finalZ = (int)Math.Floor(z + offset);
                var y = (int)(10 + offset);

                var blockX = MathHelper.ChunkToBlockX(finalX, chunk.Coordinates.X);
                var blockZ = MathHelper.ChunkToBlockZ(finalZ, chunk.Coordinates.Z);
                var spawnValue = offsetNoise.Value2D(blockX, blockZ);
                if (spawnValue > 1.95 && spawnValue < 2.09)
                {
                    var generated = new Dungeon().GenerateAt(world, chunk, new Coordinates3D(blockX, y, blockZ));
                    if (generated)
                        break;
                }
            }
        }
コード例 #14
0
ファイル: CropsBlock.cs プロジェクト: ComputeLinux/TrueCraft
 public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     var chunk = world.FindChunk(descriptor.Coordinates);
     user.Server.Scheduler.ScheduleEvent("crops", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(30, 60)),
         (server) => GrowBlock(server, world, descriptor.Coordinates + MathHelper.BlockFaceToCoordinates(face)));
 }
コード例 #15
0
ファイル: SandboxedWorld.cs プロジェクト: JohnMcCaffery/XMRM
 internal SandboxedWorld(IWorld world)
 {
     _world = world;
     _accessor = new SandboxedObjectAccessor(_world.Objects);
     _chatListener = new OnChatDelegate(TriggerChat);
     _newUserListener = new OnNewUserDelegate(TriggerNewUser);
 }
コード例 #16
0
 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("farmland", chunk,
         TimeSpan.FromSeconds(UpdateIntervalSeconds),
         s => HydrationCheckEvent(s, coords, world));
 }
コード例 #17
0
ファイル: CropsBlock.cs プロジェクト: ComputeLinux/TrueCraft
 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent("crops", chunk,
         TimeSpan.FromSeconds(MathHelper.Random.Next(30, 60)),
         (s) => GrowBlock(s, world, coords));
 }
コード例 #18
0
ファイル: GrassBlock.cs プロジェクト: zevipa/TrueCraft
 public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
 {
     var chunk = world.FindChunk(coords);
     server.Scheduler.ScheduleEvent(chunk,
         DateTime.UtcNow.AddSeconds(MathHelper.Random.Next(MinGrowthTime, MaxGrowthTime)),
         s => TrySpread(coords, world, server));
 }
コード例 #19
0
ファイル: GrassBlock.cs プロジェクト: zevipa/TrueCraft
 public override void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user)
 {
     var chunk = world.FindChunk(descriptor.Coordinates);
     user.Server.Scheduler.ScheduleEvent(chunk,
         DateTime.UtcNow.AddSeconds(MathHelper.Random.Next(MinGrowthTime, MaxGrowthTime)),
         s => TrySpread(descriptor.Coordinates, world, user.Server));
 }
コード例 #20
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "MmoItem" /> class.
 /// </summary>
 /// <param name = "world">
 ///   The world.
 /// </param>
 /// <param name = "coordinate">
 ///   The coordinate.
 /// </param>
 /// <param name = "rotation">
 ///   The rotation.
 /// </param>
 /// <param name = "properties">
 ///   The properties.
 /// </param>
 /// <param name = "owner">
 ///   The owner.
 /// </param>
 /// <param name = "itemId">
 ///   The item Id.
 /// </param>
 /// <param name = "itemType">
 ///   The item Type.
 /// </param>
 public MmoItem(IWorld world, float[] coordinate, float[] rotation, Hashtable properties, MmoActor owner, string itemId, byte itemType)
     : base(coordinate.ToVector(), properties, itemId, itemType, world, owner.Peer.RequestFiber)
 {
     this.owner = owner;
     this.Rotation = rotation;
     this.Coordinate = coordinate;
 }
コード例 #21
0
 public GeneBank(IControlManager controlManager, IWorld world)
 {
     _world = world;
     _controlManager = controlManager;
     _loci = new List<ILocus>();
     _alleleMap = new Dictionary<Guid, IAllele>();
 }
コード例 #22
0
 public void PreDrawScene(GameTime gameTime, IWorld world, RenderHelper render, GraphicInfo ginfo,List<IObject> objs)
 {
     foreach (IObject item in objs)
     {
         item.Material.PreDrawnPhase(gameTime,world, item,world.CameraManager.ActiveCamera, world.Lights, render);
     }
 }
コード例 #23
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.Texture2D ImageToProcess, RenderHelper rHelper, Microsoft.Xna.Framework.GameTime gt, PloobsEngine.Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatBuffer)
        {            
            //mix with last frame downsampled
            if (tex != null)
            {
                rHelper.PushRenderTarget(rtend);
                rHelper.RenderTextureComplete(tex, Color.FromNonPremultiplied(255, 255, 255, 255), GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp);
                rHelper.RenderTextureComplete(ImageToProcess, Color.FromNonPremultiplied(255, 255, 255, Amount), GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp, BlendState.AlphaBlend);                
                end = rHelper.PopRenderTargetAsSingleRenderTarget2D();
            }            

            //DownSample
            rHelper.PushRenderTarget(rt);
            rHelper.Clear(Color.Black);
            if (end == null)
            {
                rHelper.RenderTextureComplete(ImageToProcess, Color.White, rt.Bounds, Matrix.Identity, ImageToProcess.Bounds, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp);
            }
            else
            {
                rHelper.RenderTextureComplete(end, Color.White, rt.Bounds, Matrix.Identity, ImageToProcess.Bounds, true, SpriteSortMode.Deferred, SamplerState.AnisotropicClamp);
            }
            tex = rHelper.PopRenderTargetAsSingleRenderTarget2D();                        

            if(end!=null)
                rHelper.RenderTextureComplete(end, Color.White, GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp);
            else
                rHelper.RenderTextureComplete(ImageToProcess, Color.White, GraphicInfo.FullScreenRectangle, Matrix.Identity, null, true, SpriteSortMode.Deferred, SamplerState.LinearClamp);
             
        }
コード例 #24
0
ファイル: MoveLoop.cs プロジェクト: Twistie/Tick
 public MoveLoop(Entity o, Area[] d, IWorld map)
     : base(o)
 {
     WorldMap = map;
     Destination = d;
     curDest = 0;
 }
コード例 #25
0
ファイル: Shovel.cs プロジェクト: Cyberbanan/voxeliq
 public override void Initialize()
 {
     this._player = (IPlayer) this.Game.Services.GetService(typeof (IPlayer));
     this._world = (IWorld) this.Game.Services.GetService(typeof (IWorld));
     this._chunkCache = (IChunkCache) this.Game.Services.GetService(typeof (IChunkCache));
     this._blockStorage = (IBlockStorage) this.Game.Services.GetService(typeof (IBlockStorage));
 }
コード例 #26
0
ファイル: Location.cs プロジェクト: Earth2Me/Lotu
 public Location(long x, long y, long z)
 {
     m_World = null;
     m_X = x;
     m_Y = y;
     m_Z = z;
 }
コード例 #27
0
ファイル: Location.cs プロジェクト: Earth2Me/Lotu
 public Location(IWorld world, long x, long y, long z)
 {
     m_World = world;
     m_X = x;
     m_Y = y;
     m_Z = z;
 }
コード例 #28
0
ファイル: DoorBlock.cs プロジェクト: Gbear605/TrueCraft
 public override void BlockUpdate(BlockDescriptor descriptor, BlockDescriptor source, IMultiplayerServer server, IWorld world)
 {
     bool upper = ((DoorItem.DoorFlags)descriptor.Metadata & DoorItem.DoorFlags.Upper) == DoorItem.DoorFlags.Upper;
     var other = upper ? Coordinates3D.Down : Coordinates3D.Up;
     if (world.GetBlockID(descriptor.Coordinates + other) != ID)
         world.SetBlockID(descriptor.Coordinates, 0);
 }
コード例 #29
0
 private void Listen(IWorld source, MRMChatEventArgs args)
 {
     if (args.Channel != 0)
         Host.Object.Say(args.Text + " @ " + args.Channel);
     if (args.Channel == CHAN && args.Text.Equals(PING))
         Host.Object.Say(PING_ACK, CHAN);
 }
コード例 #30
0
 public override void Draw(Texture2D ImageToProcess, RenderHelper rHelper, GameTime gt, Engine.GraphicInfo GraphicInfo, IWorld world, bool useFloatingBuffer)
 {        
     if(useFloatingBuffer)
         rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle, SamplerState.PointClamp);
     else
         rHelper.RenderTextureToFullScreenSpriteBatch(ImageToProcess, effect, GraphicInfo.FullScreenRectangle, GraphicInfo.SamplerState);            
 }
コード例 #31
0
 public ShiftLeftInstruction(IWorld mundo) : base(mundo)
 {
 }
コード例 #32
0
ファイル: IAddressByPartition.cs プロジェクト: ifle/MineCase
 public static string MakeAddressByPartitionKey(this IWorld world, ChunkWorldPos chunkWorldPos)
 {
     return($"{world.GetPrimaryKeyString()},{chunkWorldPos.X},{chunkWorldPos.Z}");
 }
コード例 #33
0
 public AssignmentCommandLineModule(IWorld world, ITribeManager tribeManager, ILocker locker)
 {
     this.world        = world;
     this.tribeManager = tribeManager;
     this.locker       = locker;
 }
コード例 #34
0
ファイル: Tile1.cs プロジェクト: kveskimae/GermiOnMars
 public Tile_w2_r1_c0(GameplayScreen gameplayScreen, IWorld world)
     : base(gameplayScreen, new Vector2(500, 400), world)
 {
     _gameplayScreen = gameplayScreen;
 }
コード例 #35
0
        private async Task <bool> GenerateImpl(IWorld world, ChunkWorldPos chunkWorldPos, BlockWorldPos pos, Random random)
        {
            int  height             = random.Next(4) + 6;
            int  j                  = 1 + random.Next(2);
            int  k                  = height - j;
            int  l                  = 2 + random.Next(2);
            bool canSustainTreeFlag = true;

            if (pos.Y >= 1 && pos.Y + height + 1 <= 255)
            {
                for (int y = pos.Y; y <= pos.Y + 1 + height && canSustainTreeFlag; ++y)
                {
                    int xzWidth;

                    if (y - pos.Y < j)
                    {
                        xzWidth = 0;
                    }
                    else
                    {
                        xzWidth = l;
                    }

                    for (int x = pos.X - xzWidth; x <= pos.X + xzWidth && canSustainTreeFlag; ++x)
                    {
                        for (int z = pos.Z - xzWidth; z <= pos.Z + xzWidth && canSustainTreeFlag; ++z)
                        {
                            if (y >= 0 && y < 256)
                            {
                                BlockState state = await GetBlock(world, chunkWorldPos, new BlockWorldPos(x, y, z));

                                if (!(state.IsAir() ||
                                      state.IsLeaves()))
                                {
                                    canSustainTreeFlag = false;
                                }
                            }
                            else
                            {
                                canSustainTreeFlag = false;
                            }
                        }
                    }
                }

                if (!canSustainTreeFlag)
                {
                    return(false);
                }
                else
                {
                    BlockState state = await GetBlock(world, chunkWorldPos, new BlockWorldPos(pos.X, pos.Y - 1, pos.Z));

                    if (CanSustainTree(PlantsType.Spruce, state) && pos.Y < 256 - height - 1)
                    {
                        int xzWidth = random.Next(2);
                        int j3      = 1;
                        int k3      = 0;

                        for (int l3 = 0; l3 <= k; ++l3)
                        {
                            int y = pos.Y + height - l3;

                            for (int x = pos.X - xzWidth; x <= pos.X + xzWidth; ++x)
                            {
                                int deltaX = x - pos.X;

                                for (int z = pos.Z - xzWidth; z <= pos.Z + xzWidth; ++z)
                                {
                                    int deltaZ = z - pos.Z;

                                    if (Math.Abs(deltaX) != xzWidth || Math.Abs(deltaZ) != xzWidth || xzWidth <= 0)
                                    {
                                        state = await GetBlock(world, chunkWorldPos, new BlockWorldPos(x, y, z));

                                        if (state.IsAir() ||
                                            state.IsLeaves() ||
                                            state.IsSameId(BlockStates.Vines()))
                                        {
                                            await SetBlock(world, chunkWorldPos, new BlockWorldPos(x, y, z), _leaves);
                                        }
                                    }
                                }
                            }

                            if (xzWidth >= j3)
                            {
                                xzWidth = k3;
                                k3      = 1;
                                ++j3;

                                if (j3 > l)
                                {
                                    j3 = l;
                                }
                            }
                            else
                            {
                                ++xzWidth;
                            }
                        }

                        int heightLeft = random.Next(3);

                        for (int y = 0; y < height - heightLeft; ++y)
                        {
                            BlockWorldPos upN = new BlockWorldPos(pos.X, pos.Y + y, pos.Z);
                            state = await GetBlock(world, chunkWorldPos, upN);

                            if (state.IsAir() || state.IsSameId(BlockStates.Leaves()) || state.IsSameId(BlockStates.Leaves2()))
                            {
                                await SetBlock(world, chunkWorldPos, upN, _wood);
                            }
                        }

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            else
            {
                return(false);
            }
        }
コード例 #36
0
        public override void Generate(IWorld world, IGrainFactory grainFactory, ChunkColumnCompactStorage chunk, Biome biome, Random random, BlockWorldPos pos)
        {
            int height = random.Next(3) + _minTreeHeight;

            // 不超出世界边界
            if (pos.Y >= 1 && pos.Y + height + 1 <= 256)
            {
                bool canTreeGrow = CanTreeGrow(world, grainFactory, chunk, biome, random, pos, height);
                if (canTreeGrow)
                {
                    BlockWorldPos downPos      = new BlockWorldPos(pos.X, pos.Y - 1, pos.Z);
                    BlockChunkPos chunkDownPos = downPos.ToBlockChunkPos();
                    BlockState    downBlock    = chunk[chunkDownPos.X, chunkDownPos.Y, chunkDownPos.Z];

                    // 是可生成树的土壤
                    bool isSoil = CanSustainTree(_treeType, downBlock);

                    if (isSoil && pos.Y < 256 - height - 1)
                    {
                        // 生成叶子
                        for (int y = pos.Y + height - 3; y <= pos.Y + height; ++y)
                        {
                            int restHeight = y - (pos.Y + height);
                            int xzSize     = 1 - restHeight / 2;

                            for (int x = pos.X - xzSize; x <= pos.X + xzSize; ++x)
                            {
                                int xOffset = x - pos.X;

                                for (int z = pos.Z - xzSize; z <= pos.Z + xzSize; ++z)
                                {
                                    int zOffset = z - pos.Z;

                                    if (Math.Abs(xOffset) != xzSize ||
                                        Math.Abs(zOffset) != xzSize || // 不在边缘4个点
                                        (random.Next(2) != 0 &&
                                         restHeight != 0))
                                    {
                                        BlockWorldPos blockpos      = new BlockWorldPos(x, y, z);
                                        BlockChunkPos chunkBlockPos = blockpos.ToBlockChunkPos();
                                        BlockState    block         = chunk[chunkBlockPos.X, chunkBlockPos.Y, chunkBlockPos.Z];

                                        if (block.IsAir() ||
                                            block.IsLeaves() ||
                                            block.IsId(BlockId.Vine))
                                        {
                                            chunk[chunkBlockPos.X, chunkBlockPos.Y, chunkBlockPos.Z] = _leaves;
                                        }
                                    }
                                }
                            }
                        }

                        // 生成木头
                        BlockWorldPos upPos = pos;
                        for (int y = 0; y < height; ++y)
                        {
                            BlockChunkPos chunkUpPos = upPos.ToBlockChunkPos();
                            BlockState    upBlock    = chunk[chunkUpPos.X, chunkUpPos.Y, chunkUpPos.Z];

                            if (upBlock.IsAir() ||
                                upBlock.IsLeaves() ||
                                upBlock.IsId(BlockId.Vine))
                            {
                                chunk[chunkUpPos.X, chunkUpPos.Y, chunkUpPos.Z] = _wood;
                            }

                            // 生成藤蔓
                            if (_vines && y > 0)
                            {
                                if (random.Next(3) > 0 && chunk[chunkUpPos.X - 1, chunkUpPos.Y, chunkUpPos.Z].IsAir())
                                {
                                    chunk[chunkUpPos.X - 1, chunkUpPos.Y, chunkUpPos.Z] = BlockStates.Vine(new VineType {
                                        East = VineEastType.True
                                    });
                                }

                                if (random.Next(3) > 0 && chunk[chunkUpPos.X + 1, chunkUpPos.Y, chunkUpPos.Z].IsAir())
                                {
                                    chunk[chunkUpPos.X + 1, chunkUpPos.Y, chunkUpPos.Z] = BlockStates.Vine(new VineType {
                                        West = VineWestType.True
                                    });
                                }

                                if (random.Next(3) > 0 && chunk[chunkUpPos.X, chunkUpPos.Y, chunkUpPos.Z - 1].IsAir())
                                {
                                    chunk[chunkUpPos.X, chunkUpPos.Y, chunkUpPos.Z - 1] = BlockStates.Vine(new VineType {
                                        South = VineSouthType.True
                                    });
                                }

                                if (random.Next(3) > 0 && chunk[chunkUpPos.X, chunkUpPos.Y, chunkUpPos.Z + 1].IsAir())
                                {
                                    chunk[chunkUpPos.X, chunkUpPos.Y, chunkUpPos.Z + 1] = BlockStates.Vine(new VineType {
                                        North = VineNorthType.True
                                    });
                                }
                            }

                            ++upPos.Y;
                        }

                        // 生成藤蔓
                        BlockChunkPos chunkPos = pos.ToBlockChunkPos();
                        if (_vines)
                        {
                            for (int y = chunkPos.Y + height - 3; y <= chunkPos.Y + height; ++y)
                            {
                                int restHeight = y - (chunkPos.Y + height);
                                int xzSize     = 2 - restHeight / 2;

                                for (int x = chunkPos.X - xzSize; x <= chunkPos.X + xzSize; ++x)
                                {
                                    for (int z = chunkPos.Z - xzSize; z <= chunkPos.Z + xzSize; ++z)
                                    {
                                        if (chunk[x, y, z].IsLeaves())
                                        {
                                            if (random.Next(4) == 0 && chunk[x - 1, y, z].IsAir())
                                            {
                                                chunk[x - 1, y, z] = BlockStates.Vine(new VineType {
                                                    East = VineEastType.True
                                                });
                                            }

                                            if (random.Next(4) == 0 && chunk[x + 1, y, z].IsAir())
                                            {
                                                chunk[x + 1, y, z] = BlockStates.Vine(new VineType {
                                                    West = VineWestType.True
                                                });
                                            }

                                            if (random.Next(4) == 0 && chunk[x, y, z - 1].IsAir())
                                            {
                                                chunk[x, y, z - 1] = BlockStates.Vine(new VineType {
                                                    South = VineSouthType.True
                                                });
                                            }

                                            if (random.Next(4) == 0 && chunk[x, y, z + 1].IsAir())
                                            {
                                                chunk[x, y, z + 1] = BlockStates.Vine(new VineType {
                                                    North = VineNorthType.True
                                                });
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #37
0
        protected virtual void Generate(int x, int y, int z, ChunkPos pos, BlockData[,,] blocks, IWorld world, Random random)
        {
            WorldUtility.WorldSpaceToAccessorSpacePosition(pos.XOZ, ref x, ref y, ref z);
            int height = random.Next(m_MaxTreeHeightDelta) + m_MinTreeHeight;

            if (!CanTreeGrow(x, y, z, blocks, height))
            {
                return;
            }

            BlockData wood   = world.BlockDataTable.GetBlock(m_WoodBlock);
            BlockData leaves = world.BlockDataTable.GetBlock(m_LeavesBlock);

            // 生成叶子
            for (int ly = y + height - 3; ly <= y + height; ly++)
            {
                int restHeight = ly - (y + height);
                int xzSize     = 1 - restHeight / 2;

                for (int lx = x - xzSize; lx <= x + xzSize; lx++)
                {
                    int xOffset = lx - x;

                    for (int lz = z - xzSize; lz <= z + xzSize; lz++)
                    {
                        int zOffset = lz - z;

                        // 不在边缘4个点
                        if (Math.Abs(xOffset) != xzSize || Math.Abs(zOffset) != xzSize || (restHeight != 0 && random.Next(2) != 0))
                        {
                            ref BlockData block = ref blocks[lx, ly, lz];

                            if (IsBlockReplaceable(block))
                            {
                                block = leaves;
                            }
                        }
                    }
                }
            }
コード例 #38
0
ファイル: GrassBlock.cs プロジェクト: Arian150/TrueCraft
 public override void BlockUpdate(BlockDescriptor descriptor, BlockDescriptor source, IMultiplayerServer server, IWorld world)
 {
     if (source.Coordinates == descriptor.Coordinates + Coordinates3D.Up)
     {
         var provider = world.BlockRepository.GetBlockProvider(source.ID);
         if (provider.Opaque)
         {
             var chunk = world.FindChunk(descriptor.Coordinates, generate: false);
             server.Scheduler.ScheduleEvent("grass", chunk,
                                            TimeSpan.FromSeconds(MathHelper.Random.Next(MinDecayTime, MaxDecayTime)), s =>
             {
                 ScheduledUpdate(world, descriptor.Coordinates);
             });
         }
     }
 }
コード例 #39
0
ファイル: SugarCanesItem.cs プロジェクト: jdc20181/OpenCraft
 public override void ItemUsedOnBlock(Coordinates3D coordinates, ItemStack item, BlockFace face, IWorld world, IRemoteClient user)
 {
     coordinates += MathHelper.BlockFaceToCoordinates(face);
     if (SugarcaneBlock.ValidPlacement(new BlockDescriptor {
         Coordinates = coordinates
     }, world))
     {
         world.SetBlockID(coordinates, SugarcaneBlock.BlockID);
         item.Count--;
         user.Inventory[user.SelectedSlot] = item;
         user.Server.BlockRepository.GetBlockProvider(SugarcaneBlock.BlockID).BlockPlaced(
             new BlockDescriptor {
             Coordinates = coordinates
         }, face, world, user);
     }
 }
コード例 #40
0
        public MRMPrimFactory(IHost host, IWorld world, IAsynchQueueFactory queueFactory, IKeyTableFactory tableFactory, IConfigSource config, UUID hostID)
        {
            IConfig mrmConfig = config.Configs["MRM"];

            if (mrmConfig == null)
            {
                mrmConfig = config.Configs[0];
            }

            _world = world;
            _host  = host;

            _logger        = LogManager.GetLogger(typeof(MRMPrimFactory));
            _prims         = new MapKeyTable <IPrim>();
            _createdPrims  = new List <UUID>();
            _freeObjects   = new Dictionary <UUID, IObject>();
            _chatListeners = new Dictionary <int, List <ChatDelegate> >();

            //_factoryQ = queueFactory.MakeQueue();
            _factoryQ = queueFactory.SharedQueue;

            CheckWait = mrmConfig.GetInt("CheckWait", CheckWait);
            _recycle  = mrmConfig.GetBoolean("Recycle", true);

            try {
                _hostPrim = new MRMPrim(hostID, this);
            } catch (Exception e) {
                _hostPrim = null;
                throw new Exception("Problem getting Host Prim: " + e.Message + "\n" + e.StackTrace);
            }

            _chatListener += (sender, args) => {
                _world = sender;
                if (_chatListeners.ContainsKey(args.Channel))
                {
                    lock (_chatListeners)
                        foreach (var listener in _chatListeners[args.Channel])
                        {
                            listener(args.Sender.Name, args.Sender.GlobalID, args.Text, args.Channel);
                        }
                }
                if (OnChat != null)
                {
                    OnChat(args.Sender.Name, args.Sender.GlobalID, args.Text, args.Channel);
                }
            };
            _world.OnChat += _chatListener;

            _checkThread      = new Thread(CheckThread);
            _checkThread.Name = "MRMPrimFactory Check Thread";
            _checkThread.Start();



            _linkButtons = new Dictionary <uint, TouchButton>();
            _chatButtons = new Dictionary <UUID, TouchButton>();

            _knowButtons = new Dictionary <string, HashSet <UUID> >();
            _pingChannel = mrmConfig.GetInt("PingChannel", -50);
            _ping        = mrmConfig.Get("ButtonPing", "Ping");
            _pingAck     = mrmConfig.Get("ButtonPingAck", "Pong");
            _chanAck     = mrmConfig.Get("ButtonChannelAck", "ACK");
            InitTouchButtons();
        }
コード例 #41
0
 /// <summary>
 /// Initializes a new instance of the HingeJoint class.
 /// </summary>
 /// <param name="world">The world class where the constraints get added to.</param>
 /// <param name="body1">The first body connected to the second one.</param>
 /// <param name="body2">The second body connected to the first one.</param>
 /// <param name="position">The position in world space where both bodies get connected.</param>
 /// <param name="hingeAxis">The axis if the hinge.</param>
 ///
 public static void Create(IWorld world, IBody3D body1, IBody3D body2, TSVector position, TSVector hingeAxis)
 {
     new HingeJoint3D(world, body1, body2, position, hingeAxis);
 }
コード例 #42
0
ファイル: GrassBlock.cs プロジェクト: Arian150/TrueCraft
        public override void BlockLoadedFromChunk(Coordinates3D coords, IMultiplayerServer server, IWorld world)
        {
            var chunk = world.FindChunk(coords);

            server.Scheduler.ScheduleEvent("grass", chunk,
                                           TimeSpan.FromSeconds(MathHelper.Random.Next(MinGrowthTime, MaxGrowthTime)),
                                           s => TrySpread(coords, world, server));
        }
コード例 #43
0
ファイル: MRMConverter.cs プロジェクト: x8ball/Aurora-Sim
        public void GetGlobalEnvironment(IScriptModulePlugin plugin, ScriptData data, uint localID, out IWorld world, out IHost host)
        {
            // UUID should be changed to object owner.
            UUID               owner        = data.World.RegionInfo.EstateSettings.EstateOwner;
            SEUser             securityUser = new SEUser(owner, "Name Unassigned");
            SecurityCredential creds        = new SecurityCredential(securityUser, data.World);

            world = new World(data.World, creds);
            host  = new Host(new SOPObject(data.World, localID, creds), data.World, new ExtensionHandler(plugin.Extensions));
        }
コード例 #44
0
 public IncInstruction(IWorld mundo) : base(mundo)
 {
 }
コード例 #45
0
    // TODO: add labeling of path so it is known during which turn a given move will occur.
    public DijkstraPathfinder(Vector3Int start, float maxMoveSpeed, Vector3Int target, IWorld world, bool checkUnits = false)
    {
        this.checkUnits = checkUnits;

        // Runs Dijkstras, finding the shortest path to the target position and storing it.
        Dictionary <Vector3Int, Location> locations = new Dictionary <Vector3Int, Location>();
        SortedSet <Location> queue    = new SortedSet <Location>(Comparer <Location> .Create(Location.Compare));
        Location             startLoc = new Location(start, null, 0);

        locations.Add(start, startLoc);
        queue.Add(startLoc);

        Location targetLoc = null;
        int      count     = 0;

        while (queue.Count > 0)
        {
            Location source = queue.Min;
            if (source == null)
            {
                Debug.LogError("Invalid");
            }
            if (source.position.Equals(target))
            {
                targetLoc = source;
                break;
            }
            foreach (Vector3Int adj in world.GetAdjacents(source.position))
            {
                float cost = world.IsReachable(maxMoveSpeed, adj, this.checkUnits);
                if (cost >= 0)
                {
                    if (locations.ContainsKey(adj) && locations[adj].distance > source.distance + cost)
                    {
                        locations[adj].distance = source.distance + cost;
                        locations[adj].parent   = source;
                    }
                    else if (!locations.ContainsKey(adj))
                    {
                        Location adjLoc = new Location(adj, source, cost + source.distance);
                        queue.Add(adjLoc);
                        locations.Add(adj, adjLoc);
                    }
                }
            }
            if (!queue.Remove(queue.Min))
            {
                // Debug
                int x = Location.Compare(source, queue.Min);
                Debug.LogError(x);
            }
            if (count > 1000) //Check to prevent infinite loop
            {
                break;
            }
            count++;
        }

        Path = new LinkedList <Vector3Int>();
        Location last = targetLoc;

        while (last != null && !last.position.Equals(start))
        {
            Path.AddFirst(last.position);
            last = last.parent;
        }
    }
コード例 #46
0
        public override void ItemUsedOnBlock(Coordinates3D coordinates, ItemStack item, BlockFace face, IWorld world, IRemoteClient user)
        {
            var id = world.GetBlockID(coordinates);

            if (id == DirtBlock.BlockID || id == GrassBlock.BlockID)
            {
                world.SetBlockID(coordinates, FarmlandBlock.BlockID);
                user.Server.BlockRepository.GetBlockProvider(FarmlandBlock.BlockID).BlockPlaced(
                    new BlockDescriptor {
                    Coordinates = coordinates
                }, face, world, user);
            }
        }
コード例 #47
0
 /// <summary>
 /// Updates the object.
 /// </summary>
 /// <param name="gt">The gt.</param>
 /// <param name="cam">The cam.</param>
 /// <param name="world">The world.</param>
 protected virtual void UpdateObject(GameTime gt, ICamera cam, IWorld world)
 {
 }
コード例 #48
0
ファイル: NpcItem.cs プロジェクト: JasoonS/TotalTempo2
 /// <summary>
 /// Initializes a new instance of the <see cref="NpcItem"/> class.
 /// </summary>
 /// <param name="position">
 /// The position.
 /// </param>
 /// <param name="properties">
 /// The properties.
 /// </param>
 /// <param name="id">
 /// The item id.
 /// </param>
 /// <param name="type">
 /// The item type.
 /// </param>
 /// <param name="world">
 /// The world.
 /// </param>
 /// <param name="fiber">
 /// The fiber.
 /// </param>
 public NpcItem(Vector position, Hashtable properties, string id, byte type, IWorld world, IFiber fiber)
     : base(position, properties, id, type, world, fiber)
 {
 }
コード例 #49
0
        public static void HandleCollision(IDavis davis, IEnemy enemy, CollisionSide side, IWorld world)
        {
            if (side != CollisionSide.None)
            {
                if (!(enemy.PhysicsState is JulianKnockBackState))
                {
                    if (davis.PhysicsState is FlyingKneeState || davis.PhysicsState is ShoryukenState || davis.PhysicsState is ShunpoState)
                    {
                        enemy.TakeDamage();
                        world.HUD.score += 100;
                    }
                }

                //if collision is not on bottom
                if (side == CollisionSide.Top)
                {
                    if (!enemy.Dead && !davis.DeadFlag && !(enemy.PhysicsState is JulianKnockBackState))
                    {
                        enemy.TakeDamage();
                        world.HUD.score += 100;
                    }
                }
                else
                {
                    if (!enemy.Dead && davis.DavisStatus != DavisStatus.Invincible && !davis.DeadFlag && !(davis.PhysicsState is FlyingKneeState) && !(davis.PhysicsState is ShoryukenState && !(davis.PhysicsState is ShunpoState)))
                    {
                        davis.DavisDeath();
                        world.HUD.lives--;
                    }
                }
            }
        }
コード例 #50
0
        protected override void SetWorldAndRenderTechnich(out IRenderTechnic renderTech, out IWorld world)
        {
            PhysxPhysicWorld PhysxPhysicWorld = new PhysxPhysicWorld(new Vector3(0, -10, 0));

            world = new IWorld(PhysxPhysicWorld, new SimpleCuller());

            DeferredRenderTechnicInitDescription desc = DeferredRenderTechnicInitDescription.Default();

            desc.BackGroundColor = Color.CornflowerBlue;
            renderTech           = new DeferredRenderTechnic(desc);
        }
コード例 #51
0
        public void Update(Microsoft.Xna.Framework.GameTime gametime, SceneControl.IObject obj, IWorld world)
        {
            ICamera cam = world.CameraManager.ActiveCamera;

            QuadTerrain.UpdateTerrain(cam.Position, cam.BoundingFrustum, LOD);
            isupdated = true;
        }
コード例 #52
0
ファイル: Ai.cs プロジェクト: ndech/Alpha
 public Ai(RealmToken realm, IWorld world)
 {
     _realm = realm;
     _world = world;
 }
コード例 #53
0
        /// <summary>
        /// Sets the world and render technich.
        /// </summary>
        /// <param name="renderTech">The render tech.</param>
        /// <param name="world">The world.</param>
        protected override void SetWorldAndRenderTechnich(out IRenderTechnic renderTech, out IWorld world)
        {
            ///create the world
            world = new IWorld(new BepuPhysicWorld(-9.7f, true), new SimpleCuller());

            ///Create the render technich
            DeferredRenderTechnicInitDescription desc = DeferredRenderTechnicInitDescription.Default();

            desc.UseFloatingBufferForLightMap = true;
            renderTech = new DeferredRenderTechnic(desc);
        }
コード例 #54
0
ファイル: OakFence.cs プロジェクト: wqd1019dqw/Alex
 public override void BlockUpdate(IWorld world, BlockCoordinates position, BlockCoordinates updatedBlock)
 {
     base.BlockUpdate(world, position, updatedBlock);
 }
コード例 #55
0
 /// <summary>
 /// called when a camera is found
 /// </summary>
 /// <param name="world">The world.</param>
 /// <param name="factory">The factory.</param>
 /// <param name="ginfo">The ginfo.</param>
 /// <param name="cinfo">The cinfo.</param>
 /// <returns></returns>
 ICamera wl_OnCreateICamera(IWorld world, GraphicFactory factory, GraphicInfo ginfo, CameraInfo cinfo)
 {
     ///when null is returned, nothing is created
     return(null);
 }
コード例 #56
0
 public RoadPathFinder(IWorld world, ITileLocator tileLocator, IObjectTypeFactory objectTypeFactory)
 {
     this.world             = world;
     this.tileLocator       = tileLocator;
     this.objectTypeFactory = objectTypeFactory;
 }
コード例 #57
0
ファイル: TaigaGenerator.cs プロジェクト: ray-cast/MineCase
        public override void Generate(IWorld world, IGrainFactory grainFactory, ChunkColumnStorage chunk, Biome biome, Random random, BlockWorldPos pos)
        {
            int height       = random.Next(5) + 7;
            int heightLeaves = height - random.Next(2) - 3;
            int k            = height - heightLeaves;
            int l            = 1 + random.Next(k + 1);

            if (pos.Y >= 1 && pos.Y + height + 1 <= 256)
            {
                bool flag = true;

                for (int y = pos.Y; y <= pos.Y + 1 + height && flag; ++y)
                {
                    int xzWidth = 1;

                    if (y - pos.Y < heightLeaves)
                    {
                        xzWidth = 0;
                    }
                    else
                    {
                        xzWidth = l;
                    }

                    for (int x = pos.X - xzWidth; x <= pos.X + xzWidth && flag; ++x)
                    {
                        for (int z = pos.Z - xzWidth; z <= pos.Z + xzWidth && flag; ++z)
                        {
                            if (y >= 0 && y < 256)
                            {
                                BlockChunkPos chunkpos = new BlockWorldPos(x, y, z).ToBlockChunkPos();
                                BlockState    block    = chunk[chunkpos.X, chunkpos.Y, chunkpos.Z];
                                if (!(block.IsAir() ||
                                      block.IsLeaves() ||
                                      block.IsSameId(BlockStates.Vines())))
                                {
                                    flag = false;
                                }
                            }
                            else
                            {
                                flag = false;
                            }
                        }
                    }
                }

                if (!flag)
                {
                    // return false;
                }
                else
                {
                    BlockChunkPos down   = new BlockWorldPos(pos.X, pos.Y - 1, pos.Z).ToBlockChunkPos();
                    BlockState    state  = chunk[down.X, down.Y, down.Z];
                    bool          isSoil = CanSustainTree(PlantsType.Spruce, state);

                    if (isSoil && pos.Y < 256 - height - 1)
                    {
                        int xzWidth = 0;

                        for (int y = pos.Y + height; y >= pos.Y + heightLeaves; --y)
                        {
                            for (int x = pos.X - xzWidth; x <= pos.X + xzWidth; ++x)
                            {
                                int deltaX = x - pos.X;

                                for (int z = pos.Z - xzWidth; z <= pos.Z + xzWidth; ++z)
                                {
                                    int deltaZ = z - pos.Z;

                                    if (Math.Abs(deltaX) != xzWidth || Math.Abs(deltaZ) != xzWidth || xzWidth <= 0)
                                    {
                                        BlockChunkPos blockpos = new BlockWorldPos(x, y, z).ToBlockChunkPos();
                                        state = chunk[blockpos.X, blockpos.Y, blockpos.Z];

                                        if (state.IsAir() ||
                                            state.IsLeaves() ||
                                            state.IsSameId(BlockStates.Vines()))
                                        {
                                            chunk[blockpos.X, blockpos.Y, blockpos.Z] = _leaves;
                                        }
                                    }
                                }
                            }

                            if (xzWidth >= 1 && y == pos.Y + heightLeaves + 1)
                            {
                                --xzWidth;
                            }
                            else if (xzWidth < l)
                            {
                                ++xzWidth;
                            }
                        }

                        for (int y = 0; y < height - 1; ++y)
                        {
                            BlockChunkPos upN = new BlockWorldPos(pos.X, pos.Y + y, pos.Z).ToBlockChunkPos();
                            state = chunk[upN.X, upN.Y, upN.Z];

                            if (state.IsAir() || state.IsLeaves())
                            {
                                chunk[upN.X, upN.Y, upN.Z] = _wood;
                            }
                        }

                        // return true;
                    }
                    else
                    {
                        // return false;
                    }
                }
            }
            else
            {
                // return false;
            }
        }
コード例 #58
0
 /// <summary>
 /// called when a light is found
 /// </summary>
 /// <param name="world">The world.</param>
 /// <param name="factory">The factory.</param>
 /// <param name="ginfo">The ginfo.</param>
 /// <param name="li">The li.</param>
 /// <returns></returns>
 ILight wl_OnCreateILight(IWorld world, GraphicFactory factory, GraphicInfo ginfo, ILight li)
 {
     ///when null is returned nothing is created
     return(null);
 }
コード例 #59
0
ファイル: IAddressByPartition.cs プロジェクト: ifle/MineCase
 public static TGrainInterface GetPartitionGrain <TGrainInterface>(this IGrainFactory grainFactory, IWorld world, ChunkWorldPos chunkWorldPos)
     where TGrainInterface : IAddressByPartition
 {
     return(grainFactory.GetGrain <TGrainInterface>(MakeAddressByPartitionKey(world, chunkWorldPos)));
 }
コード例 #60
0
 public void CollisionWithMario(IWorld level, IPlayer mario, Direction direction)
 {
     MarioBlockHandler.UpateLocation(mario, this, direction);
 }