Created
March 22, 2020 01:37
-
-
Save gaiusjaugustus/da50546f06d4970a158e7c9b9c5a5f04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* 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