Example #1
0
        private GameObject CreateGameObjectInGame(CelestialUnityObject celestialObject)
        {
            switch (celestialObject.Type)
            {
            case ObjectType.Star: return(Instantiate(StarPrefab));

            case ObjectType.Planet: return(Instantiate(PlanetPrefab));

            case ObjectType.SuperAsteroid: return(Instantiate(SuperAsteroidPrefab));

            default: return(null);
            }
        }
Example #2
0
        private void TransformInstance(CelestialUnityObject celestialObject, GameObject instance)
        {
            instance.name = celestialObject.Name;
            SetOrbit(celestialObject.Orbit, instance);
            instance.transform.position   = celestialObject.Position;
            instance.transform.localScale = celestialObject.Size;

            var flameEffect = instance.GetComponentsInChildren <Component>().FirstOrDefault(c => c.name == "FlameEffect");

            if (flameEffect != null)
            {
                flameEffect.transform.localScale = celestialObject.Size;
            }
        }
Example #3
0
 private GameObject GetOrCreateInstance(CelestialUnityObject celestialObject)
 {
     return(GameObject.Find(celestialObject.Name) ?? CreateGameObjectInGame(celestialObject));
 }