Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * Adventure Creator
- * by Chris Burton, 2013-2015
- *
- * "ActionTemplate.cs"
- *
- * This is a blank action template.
- *
- */
- using UnityEngine;
- using System.Collections;
- #if UNITY_EDITOR
- using UnityEditor;
- #endif
- namespace AC
- {
- [System.Serializable]
- public class ActionSkybox : Action
- {
- // Declare variables here
- public GameObject objectToAffect;
- public Material newSkybox;
- public ActionSkybox ()
- {
- this.isDisplayed = true;
- category = ActionCategory.Object;
- title = "Change skybox";
- description = "This action changes a camera's skybox material.";
- }
- override public float Run ()
- {
- if (objectToAffect && objectToAffect.GetComponent <Skybox>())
- {
- objectToAffect.GetComponent <Skybox>().material = newSkybox;
- }
- return 0f;
- }
- #if UNITY_EDITOR
- override public void ShowGUI ()
- {
- objectToAffect = (GameObject) EditorGUILayout.ObjectField ("GameObject to affect:", objectToAffect, typeof (GameObject), true);
- newSkybox = (Material) EditorGUILayout.ObjectField ("New material:", newSkybox, typeof (Material), true);
- }
- public override string SetLabel ()
- {
- // Return a string used to describe the specific action's job.
- if (objectToAffect)
- {
- return (" (" + objectToAffect.name + " - " + newSkybox.ToString () + ")");
- }
- return "";
- }
- #endif
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement