ProceduralPlanets
ProceduralPlanets.Planet Class Referenceabstract

This is the base class for planets. Solid and Gas planets derive from this class. More...

Properties

abstract bool IsBuildingTextures [get]
 

Public Member Functions

virtual void AddListener (GameObject _gameObject)
 
abstract void SetPlanetBlueprint (int _index=-1, bool _leaveOverride=false, bool _setProperties=true)
 
abstract void UpdateProceduralTexture (string _textureName)
 
virtual float SetPropertyFloat (string _key)
 Sets a property float to the value determined by the random seed. Public because editor script calls this method. More...
 
virtual Color SetPropertyColor (string _key)
 Sets a property color to the color determined by the random seed. Public because editor script calls this method. More...
 
virtual int SetPropertyMaterial (string _key)
 Sets a property material to the material determined by the random seed. Public because editor script calls this method. More...
 
virtual void OverridePropertyFloat (string _key, float _value, bool _updateSerializedPlanetCache=true)
 Overrides a property value. By default this updates the serialized cache for the planet. Public any script should be able to override a property of the planet (e.g. manually set or animate liquid level etc.) More...
 
virtual bool IsPropertyFloatOverridden (string _key)
 Answers if property float is overridden based on key (returns true/false) Public because any script should be able to find out if a property of the planet is overridden More...
 
virtual float GetPropertyFloat (string _key)
 Gets the float value based on key (returns current value regardless whether it is determined by seed or overridden) Public because any script should be able to find out value of a property of the planet More...
 
virtual void OverridePropertyColor (string _key, Color _color, bool _updateSerializedPlanetCache=true)
 Overrides a property color. By default this updates the serialized cache for the planet. Public because any script should be able to override a property of the planet (e.g. manually set or animate liquid level etc.) More...
 
virtual bool IsPropertyColorOverridden (string _key)
 Answers if property color is overridden based on key (returns true/false) Public any script should be able to find out if a property of the planet is overridden More...
 
virtual Color GetPropertyColor (string _key)
 Gets the color value based on key (returns current value regardless whether it is determined by seed or overridden) Public because any script should be able to find out color of a property of the planet More...
 
virtual void OverridePropertyMaterial (string _key, int _value, bool _updateSerializedPlanetCache=true)
 Overrides a property material. By default this updates the serialized cache for the planet. Public because any script should be able to override a property of the planet (e.g. manually set or animate liquid level etc.) More...
 
virtual bool IsPropertyMaterialOverridden (string _key)
 Answers if property material is overridden based on key (returns true/false) Public any script should be able to find out if a property of the planet is overridden More...
 
virtual int GetPropertyMaterial (string _key)
 Gets the material index integer value based on key (returns current value regardless whether it is determined by seed or overridden) Public because any script should be able to find out color of a property of the planet More...
 
virtual void CreateRing (string _jsonString=null)
 Creates a ring using based on blueprint random values or using optional jSON string. More...
 
virtual bool HasRing ()
 Answers the question whether or not the planet has a planetary ring More...
 
virtual Ring GetRing ()
 Gets the ring component of a planetary ring of this planet. More...
 
virtual void DestroyRing ()
 Destroy ring if planet has one (child object must be named "Ring") More...
 
virtual string ExportToJSON (StringFormat _format=StringFormat.JSON_EASY_READ)
 Exports the planet to JSON string in different formats (easy to read / compact / "escaped" (i.e. slashes are replaced for copy/paste compatibility) and base64 encoding. The planet and variation seed is included in the exported string but also all property values even if they are not overridden (the reason being that if the planet blueprint index hierarchy changes or updates to ProceduralPlanet asset affects the random seed, all values that used to be default seed values will instead be set to override. Public so other scripts can export planet. More...
 
virtual string ImportFromJSON (string _jsonString, bool _createRing=false)
 Import planet properties from JSON string (supports easy to read/compact/escaped/base64 encoded formats). Public so other scripts can call action to import planet settings. More...
 
virtual BlueprintRing GetRingBlueprint ()
 Gets the blueprint for the ring based on the planet blueprint child ring blueprint. More...
 
float GetLODPercent ()
 
void SetSharedMesh (Mesh _mesh)
 
virtual void OnEnable ()
 
virtual void OnDisable ()
 
void AnimateFloat (string _key, float _source, float _destination, float _duration, float _delay)
 Animates a float after a delay from a source value to a destination value over the time of duration. More...
 
abstract void CacheProceduralProperty (string _property, bool _value)
 

Public Attributes

string serializedPlanetCache
 
string initJSONSettings = ""
 
int planetSeed = 0
 
int variationSeed = 0
 
int planetBlueprintIndex = -1
 
bool planetBlueprintOverride = false
 
BlueprintPlanet blueprint = null
 
int meshLODLevel
 
MeshFilter meshFilter
 
int textureLODLevel = -1
 
int textureProgressiveStep = -1
 
List< PropertyFloatpropertyFloats = new List<PropertyFloat>(0)
 
List< PropertyColorpropertyColors = new List<PropertyColor>(0)
 
List< PropertyMaterialpropertyMaterials = new List<PropertyMaterial>(0)
 

Protected Member Functions

virtual void TriggerOnTextureBuildComplete (float _timeTaken)
 
virtual void TriggerOnTextureBuildStart (float _timeStarted)
 
abstract int GetPlanetBlueprintSeededIndex ()
 
abstract void Awake ()
 
abstract void HandleModifiedTextures (string[] _proceduralTextures)
 Handles any modified textures by examining the string array to see if the array contains reference to one or more procedural texture(s). If there is a reference to a texture it means that it has been modified and the rebuild flag for the texture is set to true. More...
 
virtual PropertyFloat [] AssembleFloatArray (string _map)
 Assembles array with float values to be sent to Manager to be used during texture building. More...
 
virtual void SetProceduralMaterialFloats (string _map, ProceduralMaterial _proceduralMaterial)
 
virtual void SetDefaultProperties (bool _leaveOverride=false)
 Sets the default properties based on the seed. Optioanally leave or overwrite overridden properties. More...
 
virtual void UpdatePropertyFloatShader (PropertyFloat _propertyFloat)
 Updates the planet shader if affected by the PropertyFloat. More...
 
virtual void UpdatePropertyColorShader (PropertyColor _propertyColor)
 Updates the planet shader if affected by the PropertyColor More...
 
virtual void UpdateDictionariesIfNeeded (bool _force=false)
 Updates the dictionaries to contains the Float,Color,Material values of the property lists. Unity does not support serialized dictionaries so this component need to keep values in the dictionary for the game and in the list for serialization for the custom inspector in the editor script. More...
 
virtual Texture2D GenerateLookupTexture (float _level, int _detail=1024)
 Generates lookup textures with a sharp transition. More...
 
virtual Texture2D GenerateLookupSmoothTexture (float _level, float _lowLimit=-1.0f, float _upLimit=-1.0f)
 Genereates smooth lookup textures with a gradient transition between lowLimit and upLimit. More...
 
virtual void AddPropertyFloat (string _key, string _label, float _minValue, float _maxValue, bool _clamp01, bool _displayAsInt, int _seedOffset, bool _variation, string[] _proceduralTextures, Material _materials, string _shaderProperty=null, PropertyFloat.Method _method=PropertyFloat.Method.VALUE, PropertyFloat.DataType _dataType=PropertyFloat.DataType.FLOAT)
 Adds a float property that affects a single Procedural Material More...
 
virtual void AddPropertyFloat (string _key, string _label, float _minValue, float _maxValue, bool _clamp01, bool _displayAsInt, int _seedOffset, bool _variation, string[] _proceduralTextures=null, Material[] _materials=null, string _shaderProperty=null, PropertyFloat.Method _method=PropertyFloat.Method.VALUE, PropertyFloat.DataType _dataType=PropertyFloat.DataType.FLOAT)
 Adds a float property that affects multiple Procedural Materials. More...
 
virtual void AddPropertyColor (string _key, string _label, Color _baseColor, float _hueRange, float _saturationRange, float _brightnessRange, int _seedOffset, bool _variation, Material _material=null, string _shaderProperty=null)
 Adds a Color property that affects a single Procedural Material. More...
 
virtual void AddPropertyColor (string _key, string _label, Color _baseColor, float _hueRange, float _saturationRange, float _brightnessRange, int _seedOffset, bool _variation, Material[] _materials=null, string _shaderProperty=null)
 Adds a Color property that affects multiple Procedural Materials. More...
 
virtual void AddPropertyMaterial (string _key, string _label, ProceduralMaterial[] _materials, int _seedOffset, string[] _proceduralTextures=null, Material _material=null, string _shaderProperty=null)
 Adds a Material property that affects a single Procedural Material. More...
 
virtual float GetPropertySeededFloat (string _key)
 Gets the property value as determined by the random seed using the key as argument. See GetPropertySeededFloat(PropertyFloat _p) method for details. More...
 
virtual float GetPropertySeededFloat (PropertyFloat _propertyFloat)
 Gets the property value as determined by the random seed using the PropertyFloat as argument. More...
 
virtual Color GetPropertySeededColor (string _key)
 Gets the property color as determined by the random seed using the key as argument. More...
 
virtual int GetPropertySeededMaterial (string _key)
 Gets the property material (integer index) as determined by the random seed using the key as argument. More...
 
virtual void Update ()
 

Protected Attributes

const string PLANET_VERSION = "1.0"
 
bool _isBuildingTextures = false
 
float _timerStartBuildingTextures = -1f
 
List< PropertyFloatAnimation.Animation_propertyFloatAnimations = new List<PropertyFloatAnimation.Animation>()
 
List< GameObject > _eventListeners = new List<GameObject>()
 
MeshRenderer _meshRenderer
 
GameObject _externalAtmosphere
 
MeshFilter _externalAtmosphereMeshFilter
 
MeshRenderer _externalAtmosphereRenderer
 
int _shaderID_LocalStarPosition
 
int _shaderID_LocalStarColor
 
int _shaderID_LocalStarIntensity
 
int _shaderID_LocalStarAmbientIntensity
 
LocalStar.ShaderCacheSettings _localStarShaderCacheSettings
 
LocalStar _localStarNearestInstance
 
Dictionary< string, PropertyFloat_dictionaryFloats = new Dictionary<string, PropertyFloat>(0)
 
Dictionary< string, PropertyColor_dictionaryColors = new Dictionary<string, PropertyColor>(0)
 
Dictionary< string, PropertyMaterial_dictionaryMaterials = new Dictionary<string, PropertyMaterial>(0)
 
Vector3 _lastPosition
 

Detailed Description

This is the base class for planets. Solid and Gas planets derive from this class.

Version 1.0 - 2018 (c) Imphenzia AB - Author: Stefan Persson

Inheritance diagram for ProceduralPlanets.Planet:
ProceduralPlanets.GasPlanet ProceduralPlanets.SolidPlanet

The documentation for this class was generated from the following file: