private void Start()
    {
        Application.runInBackground = true;

        Universe = new OSTData.Universe(0);
        Universe.Build();

        PlayerCorp = Universe.CreateCorp(1);
        PlayerCorp.AddICU(200, "starting");

        OSTData.Station city = Universe.GetStation(2);
        city.CreateHangar(PlayerCorp);
        OSTData.Station mine = Universe.GetStation(6);
        mine.CreateHangar(PlayerCorp);
        OSTData.Station reprocessing = Universe.GetStation(21);
        reprocessing.CreateHangar(PlayerCorp);
        OSTData.Ship            ship = city.CreateShip(PlayerCorp);
        OSTData.ShipDestination dest = ship.AddDestination(city);
        dest.AddLoad(OSTData.ResourceElement.ResourceType.Wastes, 50);
        OSTData.ShipDestination dest2 = ship.AddDestination(mine);
        dest2.AddUnload(OSTData.ResourceElement.ResourceType.Wastes, 50);
        ship.Start();

        OSTData.Ship            ship2 = mine.CreateShip(PlayerCorp);
        OSTData.ShipDestination dest3 = ship2.AddDestination(reprocessing);
        dest3.AddUnload(OSTData.ResourceElement.ResourceType.Wastes, 100);
        OSTData.ShipDestination dest4 = ship2.AddDestination(mine);
        dest4.AddLoad(OSTData.ResourceElement.ResourceType.Wastes, 100);
        ship2.Start();
    }
示例#2
0
 private void OnDestroy()
 {
     if (null != _universe)
     {
         _universe = null;
     }
 }
 public void SetUniverse(OSTData.Universe universe)
 {
     foreach (OSTData.Station s in universe.GetStations())
     {
         StationListLine line = Instantiate <StationListLine>(stationListLinePrefab);
         line.transform.SetParent(content);
         line.SetStation(s);
     }
 }
    public void SetUniverse(OSTData.Universe universe)
    {
        _universe = universe;

        foreach (OSTData.Ship s in _universe.Ships)
        {
            ShipListLine line = Instantiate <ShipListLine>(linePrefab);
            line.transform.SetParent(content);
            line.SetShip(s);
        }
    }
示例#5
0
 public void SetUniverse(OSTData.Universe universe)
 {
     _universe = universe;
     UpdateView();
 }
示例#6
0
    public void SetUniverse(OSTData.Universe universe)
    {
        _universe = universe;

        Vector3[] posSystem1 = { new Vector3(400.0f,  0.0f,    0.0f),
                                 new Vector3(-400.0f, 0.0f,    0.0f),
                                 new Vector3(0.0f,    0.0f, -250.0f),
                                 new Vector3(-200.0f, 0.0f,  125.0f),
                                 new Vector3(200.0f,  0.0f, 125.0f) };

        foreach (OSTData.Station s in universe.GetStations())
        {
            StationOnMap sOnMap = Instantiate <StationOnMap>(stationOnMapPrefab);
            sOnMap.transform.SetParent(mapZone.transform);
            RectTransform rt  = sOnMap.GetComponent <RectTransform>();
            Vector3       pos = posSystem1[s.System.ID];
            pos += new Vector3((float)s.Position.X, (float)s.Position.Y, (float)s.Position.Z);
            rt.anchoredPosition = new Vector2(pos.x, pos.z);
            sOnMap.GetComponent <Image>().color = stationColor[s.Type];
            sOnMap.GetComponent <Image>().SetNativeSize();
        }

        GameObject     StarPortals = new GameObject("portals");
        UILineRenderer splr        = StarPortals.AddComponent <UILineRenderer>();

        StarPortals.transform.SetParent(mapZone.transform);
        RectTransform portalRT = StarPortals.GetComponent <RectTransform>();

        portalRT.SetAsFirstSibling();
        portalRT.anchoredPosition = Vector2.zero;
        portalRT.anchorMin        = Vector2.zero;
        portalRT.anchorMax        = Vector2.one;
        portalRT.pivot            = Vector2.one;
        portalRT.sizeDelta        = Vector2.zero;
        splr.Points   = new Vector2[universe.Portals.Count * 2];
        splr.color    = Color.red;
        splr.LineList = true;

        GameObject     stationPortals = new GameObject("Portals internal");
        UILineRenderer stationlr      = stationPortals.AddComponent <UILineRenderer>();

        stationPortals.transform.SetParent(mapZone.transform);
        RectTransform stationRT = stationPortals.GetComponent <RectTransform>();

        stationRT.SetAsFirstSibling();
        stationRT.anchoredPosition = Vector2.zero;
        stationRT.anchoredPosition = Vector2.zero;
        stationRT.anchorMin        = Vector2.zero;
        stationRT.anchorMax        = Vector2.one;
        stationRT.pivot            = Vector2.one;
        stationRT.sizeDelta        = Vector2.zero;
        stationlr.Points           = new Vector2[universe.Portals.Count * 2];
        stationlr.color            = Color.blue;
        stationlr.LineList         = true;

        int index  = 0;
        int index2 = 0;

        foreach (OSTData.Portal p in universe.Portals)
        {
            if (p.TypePortal == OSTData.Portal.PortalType.StarToStar)
            {
                Vector3 pos1 = posSystem1[p.Station1.System.ID] + new Vector3((float)p.Station1.Position.X, 0.0f, (float)p.Station1.Position.Z);
                splr.Points[index++] = new Vector2(pos1.x, pos1.z);
                Vector3 pos2 = posSystem1[p.Station2.System.ID] + new Vector3((float)p.Station2.Position.X, 0.0f, (float)p.Station2.Position.Z);
                splr.Points[index++] = new Vector2(pos2.x, pos2.z);
            }
            else
            {
                Vector3 pos1 = posSystem1[p.Station1.System.ID] + new Vector3((float)p.Station1.Position.X, 0.0f, (float)p.Station1.Position.Z);
                stationlr.Points[index2++] = new Vector2(pos1.x, pos1.z);
                Vector3 pos2 = posSystem1[p.Station2.System.ID] + new Vector3((float)p.Station2.Position.X, 0.0f, (float)p.Station2.Position.Z);
                stationlr.Points[index2++] = new Vector2(pos2.x, pos2.z);
            }
        }
    }
示例#7
0
        /// <summary>
        /// Compare si deux object sont identiques.
        /// </summary>
        /// <param name="obj">L'autre objet a comparer</param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            Universe other = obj as Universe;

            if (null == other)
            {
                return(false);
            }

            //date
            if (other.Day != Day || other.Hour != Hour)
            {
                return(false);
            }

            //tester la map (Systems + stations + portals)
            if (Systems.Count != other.Systems.Count)
            {
                return(false);
            }
            for (int i = 0; i < Systems.Count; i++)
            {
                if (!Systems[i].Equals(other.Systems[i]))
                {
                    return(false);
                }
            }

            if (_stations.Count != other._stations.Count)
            {
                return(false);
            }
            foreach (int i in _stations.Keys)
            {
                if (!_stations[i].Equals(other._stations[i]))
                {
                    return(false);
                }
            }

            if (Portals.Count != other.Portals.Count)
            {
                return(false);
            }
            for (int i = 0; i < Portals.Count; i++)
            {
                if (!Portals[i].Equals(other.Portals[i]))
                {
                    return(false);
                }
            }

            if (Ships.Count != other.Ships.Count)
            {
                return(false);
            }
            for (int i = 0; i < Ships.Count; i++)
            {
                if (!Ships[i].Equals(other.Ships[i]))
                {
                    return(false);
                }
            }
            return(true);
        }