Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *
- * Adventure Creator
- * by Chris Burton, 2013-2020
- *
- * "ActionTemplate.cs"
- *
- * This is a blank action template.
- *
- */
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using AC;
- using UnityEngine.UI;
- #if UNITY_EDITOR
- using UnityEditor;
- #endif
- namespace AC
- {
- [System.Serializable]
- public class ActionDisableObject : Action
- {
- // Declare variables here
- //bool showBtn = true;
- public GameObject m_Object;
- public int constantID;
- public bool showBtn;
- public Text mytext;
- public ActionDisableObject ()
- {
- this.isDisplayed = true;
- category = ActionCategory.Custom;
- title = "Disable or Enable Object";
- description = "Disable or Enable Object";
- }
- override public float Run ()
- {
- /*
- * This function is called when the action is performed.
- *
- * The float to return is the time that the game
- * should wait before moving on to the next action.
- * Return 0f to make the action instantenous.
- *
- * For actions that take longer than one frame,
- * you can return "defaultPauseTime" to make the game
- * re-run this function a short time later. You can
- * use the isRunning boolean to check if the action is
- * being run for the first time, eg:
- */
- if (showBtn == true)
- {
- m_Object.SetActive(true);
- Debug.Log("true");
- }
- else
- {
- m_Object.SetActive(false);
- Debug.Log("false");
- }
- return 0f;
- }
- public override void Skip ()
- {
- /*
- * This function is called when the Action is skipped, as a
- * result of the player invoking the "EndCutscene" input.
- *
- * It should perform the instructions of the Action instantly -
- * regardless of whether or not the Action itself has been run
- * normally yet. If this method is left blank, then skipping
- * the Action will have no effect. If this method is removed,
- * or if the Run() method call is left below, then skipping the
- * Action will cause it to run itself as normal.
- */
- Run ();
- }
- override public void AssignValues()
- {
- m_Object = AssignFile(constantID, m_Object);
- }
- #if UNITY_EDITOR
- public override void ShowGUI ()
- {
- m_Object = (GameObject)EditorGUILayout.ObjectField("Object to Disable", m_Object, typeof(Object), true);
- showBtn = EditorGUILayout.Toggle("Toggle?", showBtn);
- constantID = FieldToID(m_Object, constantID);
- m_Object = IDToField(m_Object, constantID, true);
- AfterRunningOption ();
- }
- public override string SetLabel ()
- {
- // (Optional) Return a string used to describe the specific action's job.
- return string.Empty;
- }
- #endif
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement