Beispiel #1
0
 public override void InitIvy(RuntimeGrowthParameters growthParameters, IvyContainer ivyContainer, IvyParameters ivyParameters)
 {
     this.growthParameters = growthParameters;
     Init(null, ivyParameters);
     InitMeshBuilder();
     AddFirstBranch();
 }
        public void PrepareRuntimeBaked()
        {
            RTIvy                   rtIvy      = ivyGO.GetComponent <RTIvy>();
            RuntimeBakedIvy         rtBakedIvy = (RuntimeBakedIvy)rtIvy;
            RuntimeGrowthParameters defaultGrowthParameters = new RuntimeGrowthParameters();
            IvyController           ivyController           = ivyGO.GetComponent <IvyController>();

            if (rtIvy == null)
            {
                rtBakedIvy = ivyGO.GetComponent <RuntimeBakedIvy>();
                if (rtBakedIvy == null)
                {
                    rtBakedIvy = ivyGO.AddComponent <RuntimeBakedIvy>();
                }

                if (ivyController == null)
                {
                    ivyController = ivyGO.AddComponent <IvyController>();
                }

                ivyController.rtIvy            = rtBakedIvy;
                ivyController.ivyContainer     = currentIvyInfo.infoPool.ivyContainer;
                ivyController.ivyParameters    = currentIvyInfo.infoPool.ivyParameters;
                ivyController.growthParameters = defaultGrowthParameters;


                rtBakedIvy.meshFilter   = rtBakedIvy.GetComponent <MeshFilter>();
                rtBakedIvy.meshRenderer = rtBakedIvy.GetComponent <MeshRenderer>();


                if (rtBakedIvy.mrProcessedMesh == null)
                {
                    GameObject processedMesh = new GameObject();
                    processedMesh.name                    = "processedMesh";
                    processedMesh.transform.parent        = rtBakedIvy.transform;
                    processedMesh.transform.localPosition = Vector3.zero;
                    processedMesh.transform.localRotation = Quaternion.identity;
                    MeshRenderer mrProcessedMesh = processedMesh.AddComponent <MeshRenderer>();
                    MeshFilter   mfProcessedMesh = processedMesh.AddComponent <MeshFilter>();

                    rtBakedIvy.mrProcessedMesh = mrProcessedMesh;
                    rtBakedIvy.mfProcessedMesh = mfProcessedMesh;
                }
            }

            ivyController.ivyParameters = currentIvyInfo.infoPool.ivyParameters;
        }
Beispiel #3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            IvyController           ivyController    = (IvyController)target;
            RuntimeGrowthParameters growthParameters = ivyController.growthParameters;

            GUILayout.Space(10f);

            if (ivyController.rtIvy is RuntimeProceduralIvy)
            {
                EditorGUILayout.LabelField(STR_PROCEDURAL_IVY);
            }
            else if (ivyController.rtIvy is RuntimeBakedIvy)
            {
                EditorGUILayout.LabelField(STR_BAKED_IVY);
            }

            GUILayout.Space(10f);

            EditorGUILayout.PropertyField(spGrowthSpeed);

            if (ivyController.rtIvy is RuntimeProceduralIvy)
            {
                EditorGUILayout.PropertyField(spLifetime);
            }

            EditorGUILayout.PropertyField(spDelay);

            GUILayout.BeginHorizontal();

            EditorGUILayout.PropertyField(spSpeedOverLifetimeEnabled);
            if (spSpeedOverLifetimeEnabled.boolValue)
            {
                EditorGUILayout.PropertyField(spSpeedOverLifetimeCurve, GUIContent.none);
            }
            GUILayout.EndHorizontal();

            EditorGUILayout.PropertyField(spStartGrowthOnAwake);

            serializedObject.ApplyModifiedProperties();
        }
Beispiel #4
0
 public abstract void InitIvy(RuntimeGrowthParameters growthParameters, IvyContainer ivyContainer, IvyParameters ivyParameters);
 public void InitIvyEditor(RuntimeGrowthParameters growthParameters, IvyContainer ivyContainer, IvyParameters ivyParameters)
 {
     this.growthParameters = growthParameters;
     Init(ivyContainer, ivyParameters);
 }