Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        planet = GameContext.CurrentPlanet;
        Instantiate(planetLargePrefab, new Vector3(0, 0, 0), Quaternion.identity);

        List <Ship> ships = PlayerFleet.GetShipsForPlanet(planet);

        foreach (Ship ship in ships)
        {
            Transform shipObject = Instantiate(shipPrefab, new Vector3(ship.x, ship.y, 0), Quaternion.identity) as Transform;
            shipObject.gameObject.GetComponent <ShipScript>().ship = ship;
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        PlayerFleet.UpdateShipPositions();
        List <Ship> ships = PlayerFleet.GetShipsForPlanet(planet);

        foreach (GameObject shipObject in GameObject.FindGameObjectsWithTag("Ship"))
        {
            foreach (Ship ship in ships)
            {
                if (shipObject.GetComponent <ShipScript>().ship.id == ship.id)
                {
                    shipObject.transform.position = new Vector3(ship.x, ship.y, 0f);
                }
            }
        }
    }