Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/*
*
* 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
You can’t perform that action at this time.