예제 #1
0
        // Создание префаба сферы планетарной планеты
        public static GameObject CreatePlanetSphere(PlanetType APlanetType, PlanetMode aMode)
        {
            string LPrefabPath = "PL/Planet/";
            int    LSkinID;
            string LPrefabPlanetSphereType = APlanetType.ToString();

            // Временное украшательство
            if (APlanetType == PlanetType.Earth && aMode == PlanetMode.Big)
            {
                LPrefabPlanetSphereType = "Big";
                LSkinID = Random.Range(1, 4);
            }
            else if (APlanetType == PlanetType.Earth && aMode == PlanetMode.Normal)
            {
                LPrefabPlanetSphereType = "Small";
                LSkinID = Random.Range(1, 4);
            }
            else
            if (APlanetType == PlanetType.Hydro)
            {
                LSkinID = Random.Range(1, 3);
            }
            else
            if (APlanetType == PlanetType.Sun)
            {
                LSkinID = 2;
            }
            else
            {
                LSkinID = 1;
            }
            string LPrefabPlanetSphere = LPrefabPlanetSphereType + "/pfPLPlanetSphere" + LPrefabPlanetSphereType + LSkinID.ToString();

            return(Create(LPrefabPath + LPrefabPlanetSphere, Vector3.zero));
        }
예제 #2
0
        // Конструктор сразу определяет тип данных
        public Planet(int AUID, Transform AParent, int APosX, int APosY, PlanetType AType, PlanetMode aMode)
        {
            UID        = AUID;
            Name       = string.Empty;
            PlanetType = AType;
            PlanetMode = aMode;
            /* выенсти в функции */
            IsTiming  = (PlanetType == PlanetType.Hole) || (PlanetType == PlanetType.Pulsar);
            Ships     = new List <Ship>();
            Links     = new List <Planet>();
            Buildings = new BuildingType[10];
            /* магические переменные */
            Vector3 LPosition = new Vector3(APosX / 100f * 5.65f - 3.39f, -APosY / 100f * 5.65f + 3.39f, 1);

            Transform = PrefabManager.CreatePlanet(LPosition).transform;
            Transform.SetParent(AParent, false);
            FScript         = Transform.GetComponent <MonoPlanet>();
            FScript._Sphere = PrefabManager.CreatePlanetSphere(AType, aMode);
            FScript._Sphere.transform.SetParent(Transform, false);
            FSubScript = FScript._Sphere.GetComponent <MonoPlanetCustom>();
        }