-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathActionInkCheckVisitCount.cs
More file actions
68 lines (58 loc) · 1.99 KB
/
ActionInkCheckVisitCount.cs
File metadata and controls
68 lines (58 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace AC
{
[System.Serializable]
public class ActionInkCheckVisitCount : ActionCheck
{
public string knotName;
public IntCondition condition;
public int compareNumber;
public ActionInkCheckVisitCount()
{
this.isDisplayed = true;
category = ActionCategory.ThirdParty;
title = "Ink: Check Visit Count";
description = "Checks the visit count of a specific knot/stitch.";
}
public override bool CheckCondition(){
int visitCount;
try{
visitCount = ACInkIntegration.inkStory.state.VisitCountAtPathString(knotName);
}
catch(Exception e){
Debug.Log(e.Message);
return false;
}
switch(condition)
{
case IntCondition.EqualTo:
if(compareNumber == visitCount) return true;
break;
case IntCondition.LessThan:
if(visitCount < compareNumber) return true;
break;
case IntCondition.MoreThan:
if(visitCount > compareNumber) return true;
break;
case IntCondition.NotEqualTo:
if(visitCount != compareNumber) return true;
break;
}
return false;
}
#if UNITY_EDITOR
override public void ShowGUI (List<ActionParameter> parameters)
{
knotName = EditorGUILayout.TextField("Knot/Stitch:", knotName);
condition = (IntCondition) EditorGUILayout.EnumPopup("Condition:", condition);
compareNumber = EditorGUILayout.IntField("Number:", compareNumber);
}
#endif
}
}