コード例 #1
0
    RPGWorld GetRPGWorld()
    {
        Entities[] entities = level.entities;
        RPGWorld   world    = new RPGWorld();

        world.width     = level.width;
        world.height    = level.height;
        world._entities = new Entity[entities.Length];
        for (int i = 0; i < entities.Length; i++)
        {
            world._entities[i] = new Entity(x: entities[i].x, y: entities[i].y, type: entities[i].type);
        }
        // world.width = 4;
        // world.height = 4;
        //
        // world._entities = new []
        // {
        // new Entity(0, 0, Entity.ACTOR),
        // new Entity(0, 3, Entity.TREASURE),
        // new Entity(1, 2, Entity.BARRIER),
        // new Entity(2, 3, Entity.SPIKE),
        // new Entity(2, 2, Entity.WALL),

        // new Entity(0, 0, Entity.ACTOR),
        // new Entity(1, 1, Entity.BARRIER),
        // new Entity(0, 2, Entity.BARRIER),
        // };
        return(world);
    }
コード例 #2
0
ファイル: FieldOfView.cs プロジェクト: EgoIncarnate/Tychaia
 public FieldOfView(RPGWorld world)
 {
     this.m_World = world;
     this.m_Tileset = this.m_World.Tileset as ChunkTileset;
     this.m_BroadphaseHeightGrid = new int[Chunk.Width / BROADPHASE_CELL, Chunk.Height / BROADPHASE_CELL];
     this.m_BroadphaseAngleGrid = new float[Chunk.Width / BROADPHASE_CELL, Chunk.Height / BROADPHASE_CELL];
     this.BroadphaseGrid = new bool[Chunk.Width / BROADPHASE_CELL, Chunk.Height / BROADPHASE_CELL];
 }
コード例 #3
0
 // Start is called before the first frame update
 void Start()
 {
     level  = GetData.getBuild();
     _world = GetRPGWorld();
     GenerateWorld();
 }