Ejemplo n.º 1
0
    //create new ship with a list of tiles
    public Ship newShip(string name, Sector sector, SectorPosition sectorPosition, Vector3 angle, List <Tile> tileList)
    {
        Ship ship = new Ship(name, this, sector, sectorPosition, angle, tileList);

        this.shipList.Add(ship);
        return(ship);
    }
Ejemplo n.º 2
0
 public Ship(string name, Ships ships, Sector sector, SectorPosition sectorPosition, Vector3 angle, Tile tile)
 {
     this.name           = name;
     this.ships          = ships;
     this.sector         = sector;
     this.sectorPosition = sectorPosition;
     this.angle          = angle;
     this.tilesList.Add(tile);
 }
Ejemplo n.º 3
0
 public Ship(string name, Ships ships, Sector sector, SectorPosition sectorPosition, Vector3 angle, Tile tile)
 {
     this.name = name;
     this.ships = ships;
     this.sector = sector;
     this.sectorPosition = sectorPosition;
     this.angle = angle;
     this.tilesList.Add(tile);
 }
Ejemplo n.º 4
0
 //acceleration or power/weight
 //turn rates
 //any other parts that aren't in cubes
 public Ship()
 {
     name = null;
     ships = null;
     sector = new Sector();
     sectorPosition = new SectorPosition();
     ObjectVelocity velocity = new ObjectVelocity();
     List<Tile> tiles = new List<Tile>();
 }
Ejemplo n.º 5
0
    //acceleration or power/weight
    //turn rates
    //any other parts that aren't in cubes

    public Ship()
    {
        name           = null;
        ships          = null;
        sector         = new Sector();
        sectorPosition = new SectorPosition();
        ObjectVelocity velocity = new ObjectVelocity();
        List <Tile>    tiles    = new List <Tile>();
    }
Ejemplo n.º 6
0
 public Player(GameObject playerObject)
 {
     this.playerObject = playerObject;
     sector = new Sector();
     sectorPosition = new SectorPosition();
     Vector3 angle = new Vector3(0,0,0);
     ObjectVelocity velocity = new ObjectVelocity();
      	Vector3 angularVelocity = new Vector3(0,0,0);
     updateScriptRef();
 }
Ejemplo n.º 7
0
    public Player(GameObject playerObject)
    {
        this.playerObject = playerObject;
        sector            = new Sector();
        sectorPosition    = new SectorPosition();
        Vector3        angle           = new Vector3(0, 0, 0);
        ObjectVelocity velocity        = new ObjectVelocity();
        Vector3        angularVelocity = new Vector3(0, 0, 0);

        updateScriptRef();
    }
Ejemplo n.º 8
0
 public Ship(string name, Ships ships, Sector sector, SectorPosition sectorPosition, Vector3 angle, List<Tile> tileList)
 {
     this.name = name;
     this.ships = ships;
     this.sector = sector;
     this.sectorPosition = sectorPosition;
     this.angle = angle;
     foreach (Tile tile in tileList) {
         this.tilesList.Add(tile);
         tile.ship = this;
     }
 }
Ejemplo n.º 9
0
        public Map4D <TNode> SectorAt(int x, int y, int z, int w)
        {
            var sectorPosition = new SectorPosition(x / _sectorWidth, y / _sectorHeight, z / _sectorDepth, w / _sectorFourthDimension);

            if (!_sectors.TryGetValue(sectorPosition, out var sector))
            {
                sector = new Map4D <TNode>(_sectorWidth, _sectorHeight, _sectorDepth, _sectorFourthDimension);
                _sectors[sectorPosition] = sector;
                _onSectorCreated?.Invoke(sector, sectorPosition.X * _sectorWidth, sectorPosition.Y * _sectorHeight, sectorPosition.Z * _sectorDepth, sectorPosition.W * _sectorFourthDimension);
            }

            return(sector);
        }
Ejemplo n.º 10
0
 public Ship(string name, Ships ships, Sector sector, SectorPosition sectorPosition, Vector3 angle, List <Tile> tileList)
 {
     this.name           = name;
     this.ships          = ships;
     this.sector         = sector;
     this.sectorPosition = sectorPosition;
     this.angle          = angle;
     foreach (Tile tile in tileList)
     {
         this.tilesList.Add(tile);
         tile.ship = this;
     }
 }
Ejemplo n.º 11
0
        public Map2D <TNode> SectorAt(int x, int y)
        {
            var sectorPosition = new SectorPosition(x / _sectorWidth, y / _sectorHeight);

            if (!_sectors.TryGetValue(sectorPosition, out var sector))
            {
                sector = new Map2D <TNode>(_sectorWidth, _sectorHeight);
                _sectors[sectorPosition] = sector;
                _onSectorCreated?.Invoke(sector, sectorPosition.X * _sectorWidth, sectorPosition.Y * _sectorHeight);
            }

            return(sector);
        }
    static public Vector3 GetScenePosition(Sector sector, SectorPosition position, Player player)
    {
        //get difference between player sector and ship
        int sectorOffsetX = sector.x - player.sector.x;
        int sectorOffsetY = sector.y - player.sector.y;
        int sectorOffsetZ = sector.z - player.sector.z;

        //get difference between player and ship sectorPosition
        float positionOffsetX = position.x - player.sectorPosition.x;
        float positionOffsetY = position.y - player.sectorPosition.y;
        float positionOffsetZ = position.z - player.sectorPosition.z;

        //get final distance between them by allowing for crossing of sector limit
        positionOffsetX = positionOffsetX + sectorOffsetX * HandlerScene.sectorSize;
        positionOffsetY = positionOffsetY + sectorOffsetY * HandlerScene.sectorSize;
        positionOffsetZ = positionOffsetZ + sectorOffsetZ * HandlerScene.sectorSize;

        return(new Vector3(positionOffsetX, positionOffsetY, positionOffsetZ));
    }
    public static Vector3 GetScenePosition(Sector sector, SectorPosition position, Player player)
    {
        //get difference between player sector and ship
        int sectorOffsetX = sector.x - player.sector.x;
        int sectorOffsetY = sector.y - player.sector.y;
        int sectorOffsetZ = sector.z - player.sector.z;

        //get difference between player and ship sectorPosition
        float positionOffsetX = position.x - player.sectorPosition.x;
        float positionOffsetY = position.y - player.sectorPosition.y;
        float positionOffsetZ = position.z - player.sectorPosition.z;

        //get final distance between them by allowing for crossing of sector limit
        positionOffsetX = positionOffsetX + sectorOffsetX * HandlerScene.sectorSize;
        positionOffsetY = positionOffsetY + sectorOffsetY * HandlerScene.sectorSize;
        positionOffsetZ = positionOffsetZ + sectorOffsetZ * HandlerScene.sectorSize;

        return new Vector3(positionOffsetX, positionOffsetY, positionOffsetZ);
    }
Ejemplo n.º 14
0
 //create new ship with a list of tiles
 public Ship newShip(string name, Sector sector, SectorPosition sectorPosition, Vector3 angle, List<Tile> tileList)
 {
     Ship ship = new Ship(name, this, sector, sectorPosition, angle, tileList);
     this.shipList.Add(ship);
     return ship;
 }
Ejemplo n.º 15
0
 public MarkSectorEventArgs(SectorPosition position)
 {
     Position = position;
 }
Ejemplo n.º 16
0
        public Map4D <TNode> SafeSectorAt(int x, int y, int z, int w)
        {
            var sectorPosition = new SectorPosition(x / _sectorWidth, y / _sectorHeight, z / _sectorDepth, w / _sectorFourthDimension);

            return(!_sectors.TryGetValue(sectorPosition, out var sector) ? null : sector);
        }
Ejemplo n.º 17
0
        public Map2D <TNode> SafeSectorAt(int x, int y)
        {
            var sectorPosition = new SectorPosition(x / _sectorWidth, y / _sectorHeight);

            return(!_sectors.TryGetValue(sectorPosition, out var sector) ? null : sector);
        }