Exemplo n.º 1
0
    private IEnumerator InitializeWithDelay(PlanetController planetController)
    {
        for (int i = 0; i < Count; i++)
        {
            PlanetProps planetProps = InstantiatePlanetProps();
            planetProps.Initialize(planetController);
            _planetProps.Add(planetProps);

            yield return(null);
        }
    }
Exemplo n.º 2
0
 public void MoveTo(PlanetProps target)
 {
 }
        private void setupData(DataRow r)
        {
            int    objectType = int.Parse(r["type"].ToString());
            String oType      = "";

            switch (objectType)
            {
            case 0:
                oType = "Mobs";
                break;

            case 3:
                oType = "Planets";
                break;

            case 11:
                oType = "Stargates";
                break;

            case 12:
                oType = "Starbases";
                break;

            case 37:
                oType = "Decorations";
                break;

            case 38:
                oType = "Harvestables";
                break;
            }

            dp = new PlanetProps();

            //Base Props
            dp.SectorID         = int.Parse(r["sector_id"].ToString());
            dp.NavType          = r["nav_type"].ToString();
            dp.Signature        = float.Parse(r["signature"].ToString());
            dp.IsHuge           = (Boolean)r["is_huge"];
            dp.BaseXP           = int.Parse(r["base_xp"].ToString());
            dp.ExplorationRange = float.Parse(r["exploration_range"].ToString());

            dp.BaseAssetID = int.Parse(r["base_asset_id"].ToString());

            AdobeColors.HSL hslColor = new AdobeColors.HSL();
            hslColor.H = float.Parse(r["h"].ToString());
            hslColor.S = float.Parse(r["s"].ToString());
            hslColor.L = float.Parse(r["v"].ToString());
            Color newColor = AdobeColors.HSL_to_RGB(hslColor);

            dp.Color = newColor;

            dp.Type      = oType;
            dp.Scale     = float.Parse(r["scale"].ToString());;
            dp.PositionX = float.Parse(r["position_x"].ToString());
            dp.PositionY = float.Parse(r["position_y"].ToString());
            dp.PositionZ = float.Parse(r["position_z"].ToString());;

            double[] quat1 = new double[4];
            quat1[0] = double.Parse(r["orientation_z"].ToString());
            quat1[1] = double.Parse(r["orientation_u"].ToString());
            quat1[2] = double.Parse(r["orientation_v"].ToString());
            quat1[3] = double.Parse(r["orientation_w"].ToString());

            QuaternionCalc qc1 = new QuaternionCalc();

            double[] ang1 = qc1.QuatToAngle(quat1);
            if (ang1[0] == double.NaN)
            {
                ang1[0] = 0;
            }
            if (ang1[1] == double.NaN)
            {
                ang1[1] = 0;
            }
            if (ang1[2] == double.NaN)
            {
                ang1[2] = 0;
            }
            dp.Orientation_Yaw   = Math.Round(ang1[0], 0);
            dp.Orientation_Pitch = Math.Round(ang1[1], 0);
            dp.Orientation_Roll  = Math.Round(ang1[2], 0);

            dp.Name             = r["name"].ToString();
            dp.AppearsInRadar   = (Boolean)r["appears_in_radar"];
            dp.RadarRange       = float.Parse(r["radar_range"].ToString());
            dp.Destination      = int.Parse(r["gate_to"].ToString());
            dp.SoundEffect      = int.Parse(r["sound_effect_id"].ToString());
            dp.SoundEffectRange = float.Parse(r["sound_effect_range"].ToString());

            try
            {
                //Planet Props
                dp.OrbitID     = int.Parse(r["orbit_id"].ToString());
                dp.OrbitDist   = float.Parse(r["orbit_dist"].ToString());
                dp.OrbitAngle  = float.Parse(r["orbit_angle"].ToString());
                dp.OrbitRate   = float.Parse(r["orbit_rate"].ToString());
                dp.RotateAngle = float.Parse(r["rotate_angle"].ToString());
                dp.RotateRate  = float.Parse(r["rotate_rate"].ToString());
                dp.TiltAngle   = float.Parse(r["tilt_angle"].ToString());
                dp.IsLandable  = bool.Parse(r["is_landable"].ToString());
            }
            catch (Exception)
            {
                dp.OrbitID     = 0;
                dp.OrbitDist   = 0;
                dp.OrbitAngle  = 0;
                dp.OrbitRate   = 0;
                dp.RotateAngle = 0;
                dp.RotateRate  = 0;
                dp.TiltAngle   = 0;
                dp.IsLandable  = false;
            }
        }
Exemplo n.º 4
0
        private void NewSectorObject_Load(object sender, EventArgs e)
        {
            String sectorName = tree.SelectedNode.Text;
            int    sectorID   = mainFrm.sectors.getIDFromName(sectorName);

            if (type.Contains("Mobs"))
            {
                mp                           = new MobProps();
                mp.SectorID                  = sectorID;
                mp.Color                     = Color.Black;
                mp.Type                      = "Mobs";
                mp.Signature                 = 7000;
                mp.RadarRange                = 5000;
                mp.ExplorationRange          = 3000;
                mp.SoundEffect               = -1;
                mp.SoundEffectRange          = 0;
                mp.SpawnGroup                = "<Collection...>";
                mp.SpawnRadius               = 4000;
                mp.Name                      = "<New Sector Object>";
                propertyGrid1.SelectedObject = mp;
                type2                        = 0;
            }
            else if (type.Contains("Planets"))
            {
                pp                           = new PlanetProps();
                pp.SectorID                  = sectorID;
                pp.Color                     = Color.Black;
                pp.Type                      = "Planets";
                pp.Signature                 = 7000;
                pp.RadarRange                = 5000;
                pp.ExplorationRange          = 3000;
                pp.SoundEffect               = -1;
                pp.SoundEffectRange          = 0;
                pp.Name                      = "<New Sector Object>";
                propertyGrid1.SelectedObject = pp;
                type2                        = 3;
            }
            else if (type.Contains("Stargates"))
            {
                sgp                          = new StargateProps();
                sgp.SectorID                 = sectorID;
                sgp.Color                    = Color.Black;
                sgp.Type                     = "Stargates";
                sgp.Signature                = 7000;
                sgp.RadarRange               = 5000;
                sgp.ExplorationRange         = 3000;
                sgp.SoundEffect              = -1;
                sgp.SoundEffectRange         = 0;
                sgp.Name                     = "<New Sector Object>";
                sgp.PositionX                = position.X * 100;
                sgp.PositionY                = position.Y * 100;
                propertyGrid1.SelectedObject = sgp;
                type2                        = 11;
            }
            else if (type.Contains("Starbases"))
            {
                sbp                          = new StarbaseProps();
                sbp.SectorID                 = sectorID;
                sbp.Color                    = Color.Black;
                sbp.Type                     = "Starbases";
                sbp.Signature                = 7000;
                sbp.RadarRange               = 5000;
                sbp.ExplorationRange         = 3000;
                sbp.SoundEffect              = -1;
                sbp.SoundEffectRange         = 0;
                sbp.Name                     = "<New Sector Object>";
                propertyGrid1.SelectedObject = sbp;
                type2                        = 12;
            }
            else if (type.Contains("Decorations"))
            {
                bp                           = new BaseProps();
                bp.SectorID                  = sectorID;
                bp.Color                     = Color.Black;
                bp.Type                      = "Decorations";
                bp.Signature                 = 7000;
                bp.RadarRange                = 5000;
                bp.ExplorationRange          = 3000;
                bp.SoundEffect               = -1;
                bp.SoundEffectRange          = 0;
                bp.Name                      = "<New Sector Object>";
                propertyGrid1.SelectedObject = bp;
                type2                        = 37;
            }
            else if (type.Contains("Harvestable"))
            {
                hp                           = new HarvestableProps();
                hp.SectorID                  = sectorID;
                hp.Color                     = Color.Black;
                hp.Type                      = "Harvestables";
                hp.Signature                 = 7000;
                hp.RadarRange                = 5000;
                hp.Field                     = "Random";
                hp.ExplorationRange          = 3000;
                hp.SoundEffect               = -1;
                hp.SoundEffectRange          = 0;
                hp.SpawnGroup                = "<Collection...>";
                hp.MaxFieldRadius            = 3000;
                hp.MobSpawnRadius            = 0;
                hp.Name                      = "<New Sector Object>";
                hp.ResType                   = "<Collection...>";
                propertyGrid1.SelectedObject = hp;
                type2                        = 38;
            }
        }
        private void NewSectorObject_Load(object sender, EventArgs e)
        {
            String sectorName = tree.SelectedNode.Text;
            int sectorID = mainFrm.sectors.getIDFromName(sectorName);

            if(type.Contains("Mobs"))
            {
                mp = new MobProps();
                mp.SectorID = sectorID;
                mp.Color = Color.Black;
                mp.Type = "Mobs";
                mp.Signature = 7000;
                mp.RadarRange = 5000;
                mp.ExplorationRange = 3000;
                mp.SoundEffect = -1;
                mp.SoundEffectRange = 0;
                mp.SpawnGroup = "<Collection...>";
                mp.SpawnRadius = 4000;
                mp.Name = "<New Sector Object>";
                propertyGrid1.SelectedObject = mp;
                type2 = 0;
            }
            else if (type.Contains("Planets"))
            {
                pp = new PlanetProps();
                pp.SectorID = sectorID;
                pp.Color = Color.Black;
                pp.Type = "Planets";
                pp.Signature = 7000;
                pp.RadarRange = 5000;
                pp.ExplorationRange = 3000;
                pp.SoundEffect = -1;
                pp.SoundEffectRange = 0;
                pp.Name = "<New Sector Object>";
                propertyGrid1.SelectedObject = pp;
                type2 = 3;
            }
            else if (type.Contains("Stargates"))
            {
                sgp = new StargateProps();
                sgp.SectorID = sectorID;
                sgp.Color = Color.Black;
                sgp.Type = "Stargates";
                sgp.Signature = 7000;
                sgp.RadarRange = 5000;
                sgp.ExplorationRange = 3000;
                sgp.SoundEffect = -1;
                sgp.SoundEffectRange = 0;
                sgp.Name = "<New Sector Object>";
                sgp.PositionX = position.X * 100;
                sgp.PositionY = position.Y * 100;
                propertyGrid1.SelectedObject = sgp;
                type2 = 11;
            }
            else if (type.Contains("Starbases"))
            {
                sbp = new StarbaseProps();
                sbp.SectorID = sectorID;
                sbp.Color = Color.Black;
                sbp.Type = "Starbases";
                sbp.Signature = 7000;
                sbp.RadarRange = 5000;
                sbp.ExplorationRange = 3000;
                sbp.SoundEffect = -1;
                sbp.SoundEffectRange = 0;
                sbp.Name = "<New Sector Object>";
                propertyGrid1.SelectedObject = sbp;
                type2 = 12;
            }
            else if (type.Contains("Decorations"))
            {
                bp = new BaseProps();
                bp.SectorID = sectorID;
                bp.Color = Color.Black;
                bp.Type = "Decorations";
                bp.Signature = 7000;
                bp.RadarRange = 5000;
                bp.ExplorationRange = 3000;
                bp.SoundEffect = -1;
                bp.SoundEffectRange = 0;
                bp.Name = "<New Sector Object>";
                propertyGrid1.SelectedObject = bp;
                type2 = 37;
            }
            else if (type.Contains("Harvestable"))
            {
                hp = new HarvestableProps();
                hp.SectorID = sectorID;
                hp.Color = Color.Black;
                hp.Type = "Harvestables";
                hp.Signature = 7000;
                hp.RadarRange = 5000;
                hp.Field = "Random";
                hp.ExplorationRange = 3000;
                hp.SoundEffect = -1;
                hp.SoundEffectRange = 0;
                hp.SpawnGroup = "<Collection...>";
                hp.MaxFieldRadius = 3000;
                hp.MobSpawnRadius = 0;
                hp.Name = "<New Sector Object>";
                hp.ResType = "<Collection...>";
                propertyGrid1.SelectedObject = hp;
                type2 = 38;
            }
        }
Exemplo n.º 6
0
    public TownController GetRandomTown()
    {
        int randIndex = Random.Range(0, PlanetProps.Count - 1);

        return(PlanetProps.ElementAt(randIndex).GetComponent <TownController>());
    }