Skip to content

Instantly share code, notes, and snippets.

@gaiusjaugustus
Created March 22, 2020 01:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaiusjaugustus/da50546f06d4970a158e7c9b9c5a5f04 to your computer and use it in GitHub Desktop.
Save gaiusjaugustus/da50546f06d4970a158e7c9b9c5a5f04 to your computer and use it in GitHub Desktop.
/*
*
* Adventure Creator
* by Chris Burton, 2013-2020
*
* "ActionCheckTansform.cs"
*
* This is a blank action template, which has two outputs.
*
*/
using UnityEngine;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace AC
{
[System.Serializable]
public class ActionCheckTransform : ActionCheck
{
// Declare variables here
public GameObject objectToCheck;
public Vector3 objectRotation;
public Vector3 newVector;
//public TransformType transformType;
public ActionCheckTransform()
{
this.isDisplayed = true;
category = ActionCategory.Object;
title = "Check Object Transform";
description = "This checks an objects transform properties (just rotation for now).";
}
public override bool CheckCondition ()
{
// Return 'true' if the condition is met, and 'false' if it is not met.
if (objectToCheck != null)
{
objectRotation = objectToCheck.transform.rotation.eulerAngles;
return (newVector == objectRotation);
}
return false;
}
#if UNITY_EDITOR
public override void ShowGUI ()
{
// Action-specific Inspector GUI code here. The "Condition is met" / "Condition is not met" GUI is rendered automatically afterwards.
objectToCheck = (GameObject) EditorGUILayout.ObjectField ("GameObject to check:", objectToCheck, typeof (GameObject), true);
newVector = EditorGUILayout.Vector3Field ("Check has rotation value:", newVector);
}
public override string SetLabel ()
{
// (Optional) Return a string used to describe the specific action's job.
return string.Empty;
}
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment