Browse Source
Add concept of Collection to Fungus. Add Collection Demo, Physics Cast Demo. They are their own type, that are addressed in a generic way. Internally using object boxing and type comparisons. A number of refactorings and additions along with this to make it work more seamlessly. Variable operators defined by Variable itself Conditional and Looping commands refactored, to avoid more duplication in the new looping commands, such as ForEach AnyVariableData removes duplication from SetVariable and Condition logic, provides a clearer method of adding additional variable types that result in immediate support in those commands PlayMode Tests and Utils added Additional Variable Types, such as Quaternion, Matrix4x4 Physics casts Commands that use collections * Initial Fungus Collection work with support for int and IntegerVariable * While and Condition related changes to allow for new command Loop Range * Collection Get changes and ForEach rough * Added Collection Commands Reordered Elif logic in Condition * More collection types and commands * Variable reorg to allow for new types to be added more simply and centrally * Added more Fungus Vars for Common Unity types VariableList Adapter can delegate to the variable itself for custom drawing Variable IsArthithemticSupported queries for each op rather than all, more fine grain support for types like color and quaterion Event handlers, such as physics related, now have optional fungus variable to store the data they are given by unity in fungus variable for use in the block VariableInfo consolidates more info into the typeActionLookup table, updates to support new fungus var types * Many basic collection operations added Common Collection types Physics Overlap command * Custom variable drawing moved to VariableInfo.cs rather than child variable itself Added Physics cast and overlap commands * Move all Editor scripts into Editor AsmDef folder * LoopRange also registers as command name For * Condition base class commenting improved and refactored repeated looping style child class elements into base * More descriptive CollectionBase Command class names * Fungus Collection interface and comments refined * Rename ICollection to IFungusCollection Cleanup formatting * Collection example scene * Added Collection Tests * Format collection and test files Added CopyFrom to IFungusCollection * Added FungusCollection initial summaries * Added CollectionRandom commands -added simple use to CollectionLoop demo scene * Added Unique to FungusCollection -Updated tests to include unique Added Collection Physics demo, shows use of returned array of all cast intersecting GameObjects * CollectionPhysics tracks mousepos with visual Added Fungus Command to get mouse position * Variable custom draw moved to its own editor class, no longer part of typeinfo Variable generation run * Add playmode test for variable type sets Add playmode test for flow control * Update doco and formatting for Collection classes Refactor parts of Conditional classes and AnyVariable Move Property commands into Category 'Property' * Update Collection comments, formatting and Update internal to public * Add License header to added variable typesmaster
Steve Halliwell
5 years ago
committed by
GitHub
300 changed files with 30913 additions and 2363 deletions
@ -0,0 +1,70 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
using UnityEngine.Assertions; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Assert on 2 Fungus variable values. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Scripting", |
||||||
|
"Assert", |
||||||
|
"Assert based on compared values.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class AssertCommand : Command |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected StringData message; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(AllVariableTypes.VariableAny.Any)] |
||||||
|
protected Variable a, b; |
||||||
|
|
||||||
|
public enum Method |
||||||
|
{ |
||||||
|
AreEqual, |
||||||
|
AreNotEqual, |
||||||
|
} |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Method method; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
switch (method) |
||||||
|
{ |
||||||
|
case Method.AreEqual: |
||||||
|
Assert.AreEqual(a.GetValue(), b.GetValue()); |
||||||
|
break; |
||||||
|
|
||||||
|
case Method.AreNotEqual: |
||||||
|
Assert.AreNotEqual(a.GetValue(), b.GetValue()); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (a == null) |
||||||
|
return "Error: No A variable"; |
||||||
|
if (b == null) |
||||||
|
return "Error: No B variable"; |
||||||
|
|
||||||
|
return a.Key + " " + method.ToString() + " " + b.Key; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == message.stringRef || |
||||||
|
variable == a || variable == b || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c40b126bd148ae743b56bc8c00162589 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -1,9 +1,8 @@ |
|||||||
fileFormatVersion: 2 |
fileFormatVersion: 2 |
||||||
guid: f7ddb80a0487d1342b36129da32ad1f6 |
guid: 7d7820abad934b747ae1797c3aa82197 |
||||||
folderAsset: yes |
folderAsset: yes |
||||||
timeCreated: 1503815490 |
|
||||||
licenseType: Free |
|
||||||
DefaultImporter: |
DefaultImporter: |
||||||
|
externalObjects: {} |
||||||
userData: |
userData: |
||||||
assetBundleName: |
assetBundleName: |
||||||
assetBundleVariant: |
assetBundleVariant: |
@ -0,0 +1,35 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseCommand : Command |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected CollectionData collection; |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(191, 217, 235, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == collection.collectionRef; |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
return collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: dab2b4efcfae62841b5070c4cfec8c4a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,42 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that use an intvar |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseIntCommand : CollectionBaseCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData integer; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void OnEnterInner(); |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == integer.integerRef || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
return integer.Value.ToString() + " on " + collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 328b7e125f24d5349be4fe583267ba1d |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,50 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that require a second collection of the same type |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseTwoCollectionCommand : CollectionBaseCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected CollectionData rhsCollection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null && rhsCollection.Value != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void OnEnterInner(); |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == rhsCollection.collectionRef || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (rhsCollection.Value == null) |
||||||
|
return "Error: no variable selected"; |
||||||
|
|
||||||
|
if (collection.Value.ContainedType() != rhsCollection.Value.ContainedType()) |
||||||
|
{ |
||||||
|
return "Error: Collection types do not match. " + collection.Value.ContainedType().Name + " != " + rhsCollection.Value.ContainedType().Name; |
||||||
|
} |
||||||
|
|
||||||
|
return collection.Value.name + " , " + rhsCollection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c4010b5577069fc4cb9480f87ed3f73e |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,47 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that require a compatible variable and an integer |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseVarAndIntCommand : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(IntegerVariable))] |
||||||
|
protected IntegerVariable integer; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null && variableToUse != null && integer != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == integer || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (variableToUse == null) |
||||||
|
return "Error: no variable selected"; |
||||||
|
|
||||||
|
if (integer == null) |
||||||
|
return "Error: no integer selected"; |
||||||
|
|
||||||
|
return integer.Key + " on " + variableToUse.Key + " in " + collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 561b53abc515d704d8845caa3b3ee26f |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,54 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Base class for all FungusCollection commands that require a compatible variable type |
||||||
|
/// </summary> |
||||||
|
[AddComponentMenu("")] |
||||||
|
public abstract class CollectionBaseVarCommand : CollectionBaseCommand, ICollectionCompatible |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(compatibleVariableName = "collection")] |
||||||
|
protected Variable variableToUse; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null && variableToUse != null) |
||||||
|
{ |
||||||
|
OnEnterInner(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract void OnEnterInner(); |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == variableToUse || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (variableToUse == null) |
||||||
|
return "Error: no variable selected"; |
||||||
|
|
||||||
|
return variableToUse.Key + " to " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
bool ICollectionCompatible.IsVarCompatibleWithCollection(Variable variable, string compatibleWith) |
||||||
|
{ |
||||||
|
if (compatibleWith == "collection") |
||||||
|
return collection.Value == null ? false : collection.Value.IsElementCompatible(variable); |
||||||
|
else |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: fe12b6eb87e59984cb4122f978f11e45 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,39 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Add an item to a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Add", |
||||||
|
"Add an item to a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandAdd : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[Tooltip("Only add if the item does not already exist in the collection")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData onlyIfUnique = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (onlyIfUnique.Value) |
||||||
|
collection.Value.AddUnique(variableToUse); |
||||||
|
else |
||||||
|
collection.Value.Add(variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return onlyIfUnique.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (onlyIfUnique.Value ? " Unique" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a30a3b6902ecde54ea81d503f6a2b27e |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,39 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Add all items in given rhs collection to target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Add All", |
||||||
|
"Add all items in given rhs collection to target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandAddAll : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
[Tooltip("Only add if the item does not already exist in the collection")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData onlyIfUnique = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (onlyIfUnique.Value) |
||||||
|
collection.Value.AddUnique(rhsCollection); |
||||||
|
else |
||||||
|
collection.Value.Add(rhsCollection); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return onlyIfUnique.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (onlyIfUnique.Value ? " Unique" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 5688faa1580d8d147b59e18fcdd888ad |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Clears a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Clear", |
||||||
|
"Clears a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandClear : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Clear(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 8b071472a9dcdc7469059042e2e6e50d |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,37 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Does the collection contain the given variable |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Contains", |
||||||
|
"Does the collection contain the given variable")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandContains : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[VariableProperty(typeof(BooleanVariable))] |
||||||
|
protected BooleanVariable result; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (result == null) |
||||||
|
{ |
||||||
|
Debug.LogWarning("No result var set"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
result.Value = collection.Value.Contains(variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return result == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 6bd67ee6ac8134b4e9aea26299040034 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,53 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Does target collection, contain all rhs collection items |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Contains All Of", |
||||||
|
"Does target collection, contain all rhs collection items")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandContainsAll : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
[Tooltip("Do they have to be in the same order?")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData inSameOrder = new BooleanData(false); |
||||||
|
|
||||||
|
[VariableProperty(typeof(BooleanVariable))] |
||||||
|
protected BooleanVariable result; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (result == null) |
||||||
|
{ |
||||||
|
Debug.LogWarning("No result var set"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
if (inSameOrder.Value) |
||||||
|
{ |
||||||
|
result.Value = collection.Value.ContainsAllOfOrdered(rhsCollection.Value); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
result.Value = collection.Value.ContainsAllOf(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return result == variable || inSameOrder.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (inSameOrder.Value ? " Ordered" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1df2de5cf986f9d419a124bb9d834b11 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,37 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Does target collection, contain any of the items in the rhs collection items |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Contains Any Of", |
||||||
|
"Does target collection, contain any of the items in the rhs collection items")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandContainsAny : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
[VariableProperty(typeof(BooleanVariable))] |
||||||
|
protected BooleanVariable result; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (result == null) |
||||||
|
{ |
||||||
|
Debug.LogWarning("No result var set"); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
result.Value = collection.Value.ContainsAnyOf(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return result == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c4e05f36271510b41a7d7889025e180e |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Clears target and then adds all of rhs to target. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Copy", |
||||||
|
"Clears target and then adds all of rhs to target.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandCopy : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.CopyFrom(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 820324be5b6a927469519df54a9bbad0 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,25 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Number of items in the collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Count", |
||||||
|
"Number of items in the collection")] |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Length", |
||||||
|
"Number of items in the collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandCount : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
integer.Value = collection.Value.Count; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 31765259d3ac50e4993fd654cd7ea78b |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,53 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Get or Set, an element in a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Element", |
||||||
|
"Get or Set, an element in a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandElement : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
public enum GetSet |
||||||
|
{ |
||||||
|
Get, |
||||||
|
Set, |
||||||
|
} |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected IntegerData index; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected GetSet getset = GetSet.Get; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (index.Value >= 0 && index.Value < collection.Value.Count) |
||||||
|
{ |
||||||
|
if (getset == GetSet.Get) |
||||||
|
{ |
||||||
|
collection.Value.Get(index.Value, ref variableToUse); |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
collection.Value.Set(index.Value, variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
throw new System.ArgumentOutOfRangeException(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + " " + getset.ToString(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: bf40659a274400d40856f146223798ac |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,24 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove all items from collection that are also in RHS and add all the items in RHS that are not already |
||||||
|
/// in target. Similar to a xor |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Exclusive", |
||||||
|
"Remove all items from collection that are also in RHS and add all the items in RHS that are not already in target. " + |
||||||
|
"Similar to a xor")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandExclusive : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Exclusive(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 824e24d12ca84774ea135507417e94a1 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,41 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Find an item in a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Find", |
||||||
|
"Find an item in a collection")] |
||||||
|
[CommandInfo("Collection", |
||||||
|
"IndexOf", |
||||||
|
"Find an item in a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandFind : CollectionBaseVarAndIntCommand |
||||||
|
{ |
||||||
|
[Tooltip("If true, will find the last occurance rather than first occurance.")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData lastInsteadOfFirst = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
integer.Value = !lastInsteadOfFirst.Value ? |
||||||
|
collection.Value.IndexOf(variableToUse) |
||||||
|
: collection.Value.LastIndexOf(variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return lastInsteadOfFirst.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (lastInsteadOfFirst.Value ? " Last" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 59afe81b26e37ea4ea10dd91dfeee937 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Add at a specific location in the collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Insert", |
||||||
|
"Add at a specific location in the collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandInsert : CollectionBaseVarAndIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Insert(integer.Value, variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: dd126ef47d8264a4d8a6aac5b4f3fb12 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove all items from collection that aren't also in RHS, similar to an overlap. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Intersection", |
||||||
|
"Remove all items from collection that aren't also in RHS, similar to an overlap.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandIntersection : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Intersection(rhsCollection.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 586c189d813b1b045ba358c612f4a6eb |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// How many occurrences of a given variable exist in a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Occurrences", |
||||||
|
"How many occurrences of a given variable exist in a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandOccurrences : CollectionBaseVarAndIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
integer.Value = collection.Value.Occurrences(variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 75a3711bc9cd44e429e15e10f6029fae |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,39 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove an item to a collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Remove", |
||||||
|
"Remove an item to a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandRemove : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[Tooltip("Should it remove ALL occurances of variable")] |
||||||
|
[SerializeField] |
||||||
|
protected BooleanData allOccurances = new BooleanData(false); |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (allOccurances.Value) |
||||||
|
collection.Value.RemoveAll(variableToUse); |
||||||
|
else |
||||||
|
collection.Value.Remove(variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return allOccurances.booleanRef == variable || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + (allOccurances.Value ? " ALL" : ""); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 6e2313a05ce56ea49bbf1922b58d793a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove all items in given rhs collection to target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Remove All Of", |
||||||
|
"Remove all items in given rhs collection to target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandRemoveAllOf : CollectionBaseTwoCollectionCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.RemoveAll(rhsCollection); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 2bb49f43c99a0af4db604a1770b31e83 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Remove item at given index |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Remove At", |
||||||
|
"Remove item at given index")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandRemoveAt : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.RemoveAt(integer.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c8ee8f64433f29a4f82b03a8e6550ae2 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Reserve space for given number of items in the collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Reserve", |
||||||
|
"Reserve space for given number of items in the collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandReserve : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Reserve(integer.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 4672406760fa8f340aabac4528f04c1c |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Resize will grow the collection to be the given size, will not remove items to shrink |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Resize", |
||||||
|
"Resize will grow the collection to be the given size, will not remove items to shrink")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandResize : CollectionBaseIntCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Resize(integer.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 3ce11d7cce59a3340937a8d112cd4ad5 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Reverse the current order of a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Reverse", |
||||||
|
"Reverse the current order of a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandReverse : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Reverse(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: d7359fcb744d14a41acae4b3a2e34b73 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Randomly reorders all elements of a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Shuffle", |
||||||
|
"Randomly reorders all elements of a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandShuffle : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Shuffle(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: a15d511e013edfe45a0a4726bda90c8f |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Sort a target collection |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Sort", |
||||||
|
"Sort a target collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandSort : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Sort(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 00093f39e8583954ba5935bca806f0f1 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,27 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Removes all duplicates. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"Unique", |
||||||
|
"Removes all duplicates.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionCommandUnique : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (collection.Value != null) |
||||||
|
{ |
||||||
|
collection.Value.Unique(); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 59ae026a39db9cf4d8453309fa6192db |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,22 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Use the collection as a source of random selection. Picking a random item each run. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"RandomItem", |
||||||
|
"Use the collection as a source of random selection. Picking a random item each run.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionRandom : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
collection.Value.Get(Random.Range(0, collection.Value.Count - 1), ref variableToUse); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: d58ddca8952c1a149a39835e2eeac9a7 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,80 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Use the collection as a source of random items and turn it into a random bag. Drawing the |
||||||
|
/// next random item until out of items and then reshuffling them. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"RandomBag", |
||||||
|
"Use the collection as a source of random items and turn it into a random bag. " + |
||||||
|
"Drawing the next random item until out of items and then reshuffling them.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionRandomBag : CollectionBaseVarCommand |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
[Tooltip("Will add this many copies to the bag. If you want 5 of everything, you want 4 copies.")] |
||||||
|
protected IntegerData duplicatesToPutInBag = new IntegerData(0); |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected IntegerData currentIndex = new IntegerData(int.MaxValue); |
||||||
|
|
||||||
|
protected bool isInit = false; |
||||||
|
|
||||||
|
protected override void OnEnterInner() |
||||||
|
{ |
||||||
|
if (!isInit) |
||||||
|
{ |
||||||
|
Init(); |
||||||
|
} |
||||||
|
|
||||||
|
currentIndex.Value++; |
||||||
|
|
||||||
|
if (currentIndex.Value >= collection.Value.Count) |
||||||
|
{ |
||||||
|
Reshuffle(); |
||||||
|
} |
||||||
|
|
||||||
|
collection.Value.Get(currentIndex.Value, ref variableToUse); |
||||||
|
} |
||||||
|
|
||||||
|
protected void Init() |
||||||
|
{ |
||||||
|
var startingCount = collection.Value.Count; |
||||||
|
for (int i = 0; i < duplicatesToPutInBag.Value; i++) |
||||||
|
{ |
||||||
|
for (int j = 0; j < startingCount; j++) |
||||||
|
{ |
||||||
|
collection.Value.Add(collection.Value.Get(j)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
//force invalid index |
||||||
|
currentIndex.Value = collection.Value.Count; |
||||||
|
|
||||||
|
isInit = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected void Reshuffle() |
||||||
|
{ |
||||||
|
currentIndex.Value = 0; |
||||||
|
collection.Value.Shuffle(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return base.HasReference(variable) || duplicatesToPutInBag.integerRef == variable || currentIndex.integerRef; |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return base.GetSummary() + |
||||||
|
(duplicatesToPutInBag.integerRef != null ? " " + duplicatesToPutInBag.integerRef.Key : "") + |
||||||
|
(currentIndex.integerRef != null ? " " + currentIndex.integerRef.Key : ""); ; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 56176eef6b396a442b08b88220304436 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,90 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Loop over each element in the given collection. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Collection", |
||||||
|
"For Each", |
||||||
|
"Loop over each element in the given collection, similar to a foreach but internally uses indicies")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class ForEach : Condition, ICollectionCompatible |
||||||
|
{ |
||||||
|
[SerializeField] |
||||||
|
protected CollectionData collection; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(compatibleVariableName = "collection")] |
||||||
|
protected Variable item; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[Tooltip("Optional")] |
||||||
|
protected IntegerData curIndex; |
||||||
|
|
||||||
|
#region Public members |
||||||
|
|
||||||
|
public override bool IsLooping { get { return true; } } |
||||||
|
|
||||||
|
protected override void PreEvaluate() |
||||||
|
{ |
||||||
|
//if we came from the end then we are already looping, if not this is first loop so prep |
||||||
|
if (ParentBlock.PreviousActiveCommandIndex != endCommand.CommandIndex) |
||||||
|
{ |
||||||
|
curIndex.Value = -1; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool EvaluateCondition() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
curIndex.Value++; |
||||||
|
if (curIndex < col.Count) |
||||||
|
{ |
||||||
|
col.Get(curIndex, ref item); |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnFalse() |
||||||
|
{ |
||||||
|
MoveToEnd(); |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool HasNeededProperties() |
||||||
|
{ |
||||||
|
return collection.Value != null && item != null; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return collection.collectionRef == variable || item == variable || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
bool ICollectionCompatible.IsVarCompatibleWithCollection(Variable variable, string compatibleWith) |
||||||
|
{ |
||||||
|
if (compatibleWith == "collection") |
||||||
|
return collection.Value == null ? false : collection.Value.IsElementCompatible(variable); |
||||||
|
else |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (item == null) |
||||||
|
return "Error: No item var"; |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: No collection"; |
||||||
|
|
||||||
|
return item.Key + " in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
#endregion Public members |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 1ce547d5384ce3a41b7142cab8ab41dd |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,51 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("GameObject", |
||||||
|
"FindAll", |
||||||
|
"Find all gameobjects by tag and store in a collection")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class GameObjectFind : CollectionBaseCommand |
||||||
|
{ |
||||||
|
[Tooltip("Find all gameobjects of tag")] |
||||||
|
[SerializeField] |
||||||
|
protected StringData tagString; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
var res = GameObject.FindGameObjectsWithTag(tagString.Value); |
||||||
|
|
||||||
|
for (int i = 0; i < res.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(res[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == tagString.stringRef || base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return tagString.Value + " GOs, store in " + collection.Value.name; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 8509f58e038dd8c46b98cab78d34e06a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,162 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Physics2D", |
||||||
|
"Cast2D", |
||||||
|
"Find all gameobjects hit by given physics shape overlap")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class Physics2DCast : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum CastType |
||||||
|
{ |
||||||
|
Box, |
||||||
|
Capsule, |
||||||
|
Circle, |
||||||
|
Line, |
||||||
|
Ray, |
||||||
|
} |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected CastType castType = CastType.Ray; |
||||||
|
|
||||||
|
[Tooltip("Starting point or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data direction; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData maxDistance = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & Circle ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data shapeSize = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData shapeAngle; |
||||||
|
|
||||||
|
[Tooltip("LINE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data lineEnd; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData minDepth = new FloatData(float.NegativeInfinity), maxDepth = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CapsuleDirection2D capsuleDirection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
RaycastHit2D[] resHits = null; |
||||||
|
|
||||||
|
switch (castType) |
||||||
|
{ |
||||||
|
case CastType.Box: |
||||||
|
resHits = Physics2D.BoxCastAll(position1.Value, shapeSize.Value, shapeAngle.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Capsule: |
||||||
|
resHits = Physics2D.CapsuleCastAll(position1.Value, shapeSize.Value, capsuleDirection, shapeAngle.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Circle: |
||||||
|
resHits = Physics2D.CircleCastAll(position1.Value, radius.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Line: |
||||||
|
resHits = Physics2D.LinecastAll(position1.Value, lineEnd.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Ray: |
||||||
|
resHits = Physics2D.RaycastAll(position1.Value, direction.Value, maxDistance.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resHits); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(RaycastHit2D[] resColliders) |
||||||
|
{ |
||||||
|
if (resColliders != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resColliders.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resColliders[i].collider.gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == position1.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == shapeSize.vector3Ref || |
||||||
|
variable == shapeAngle.floatRef || |
||||||
|
variable == minDepth.floatRef || |
||||||
|
variable == maxDepth.floatRef || |
||||||
|
variable == direction.vector3Ref || |
||||||
|
variable == maxDistance.floatRef || |
||||||
|
variable == lineEnd.vector3Ref || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return castType.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (castType == CastType.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (castType == CastType.Line && propertyName == "lineEnd") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((castType == CastType.Capsule || castType == CastType.Circle) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((castType == CastType.Capsule || castType == CastType.Box) && |
||||||
|
(propertyName == "shapeAngle" || propertyName == "shapeSize")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: da8de59f5960f5c4b9d61002cc912b37 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,154 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Physics2D", |
||||||
|
"Overlap2D", |
||||||
|
"Find all gameobjects hit by given physics shape overlap")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class Physics2DOverlap : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum Shape |
||||||
|
{ |
||||||
|
Point, |
||||||
|
Area, |
||||||
|
Box, |
||||||
|
Circle, |
||||||
|
Capsule, |
||||||
|
} |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Shape shape = Shape.Box; |
||||||
|
|
||||||
|
[Tooltip("Starting point or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("AREA ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data areaEndPosition; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & Circle ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data shapeSize = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX & CAPSULE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData shapeAngle; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData minDepth = new FloatData(float.NegativeInfinity), maxDepth = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CapsuleDirection2D capsuleDirection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
Collider2D[] resColliders = null; |
||||||
|
|
||||||
|
switch (shape) |
||||||
|
{ |
||||||
|
case Shape.Area: |
||||||
|
resColliders = Physics2D.OverlapAreaAll(position1.Value, areaEndPosition.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Box: |
||||||
|
resColliders = Physics2D.OverlapBoxAll(position1.Value, shapeSize.Value, shapeAngle.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Circle: |
||||||
|
resColliders = Physics2D.OverlapCircleAll(position1.Value, radius.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Capsule: |
||||||
|
resColliders = Physics2D.OverlapCapsuleAll(position1.Value, shapeSize.Value, capsuleDirection, shapeAngle.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Point: |
||||||
|
resColliders = Physics2D.OverlapPointAll(position1.Value, layerMask.value, minDepth.Value, maxDepth.Value); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resColliders); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(Collider2D[] resColliders) |
||||||
|
{ |
||||||
|
if (resColliders != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resColliders.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resColliders[i].gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == position1.vector3Ref || |
||||||
|
variable == areaEndPosition.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == shapeSize.vector3Ref || |
||||||
|
variable == shapeAngle.floatRef || |
||||||
|
variable == minDepth.floatRef || |
||||||
|
variable == maxDepth.floatRef || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return shape.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (shape == Shape.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (shape == Shape.Area && propertyName == "areaEndPosition") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((shape == Shape.Capsule || shape == Shape.Circle) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((shape == Shape.Capsule || shape == Shape.Box) && propertyName == "shapeAngle") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (shape == Shape.Box && (propertyName == "boxHalfExtends" || propertyName == "boxOrientation")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c27aec18d802f45429190093660305e4 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,147 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[CommandInfo("Physics", |
||||||
|
"Cast", |
||||||
|
"Find all gameobjects hit by given physics shape cast")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class PhysicsCast : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum CastType |
||||||
|
{ |
||||||
|
Box, |
||||||
|
Capsule, |
||||||
|
Ray, |
||||||
|
Sphere, |
||||||
|
} |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CastType castType = CastType.Ray; |
||||||
|
|
||||||
|
[Tooltip("Starting point/origin or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data direction; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData maxDistance = new FloatData(float.PositiveInfinity); |
||||||
|
|
||||||
|
[Tooltip("CAPSULE ONLY; end point of the capsule")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data capsulePosition2; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & SPHERE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data boxHalfExtends = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected QuaternionData boxOrientation = new QuaternionData(Quaternion.identity); |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
RaycastHit[] resHits = null; |
||||||
|
|
||||||
|
switch (castType) |
||||||
|
{ |
||||||
|
case CastType.Ray: |
||||||
|
resHits = Physics.RaycastAll(position1.Value, direction.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Sphere: |
||||||
|
resHits = Physics.SphereCastAll(position1.Value, radius.Value, direction.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Box: |
||||||
|
resHits = Physics.BoxCastAll(position1.Value, boxHalfExtends.Value, direction.Value, boxOrientation.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case CastType.Capsule: |
||||||
|
resHits = Physics.CapsuleCastAll(position1.Value, capsulePosition2.Value, radius.Value, direction.Value, maxDistance.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resHits); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(RaycastHit[] resHits) |
||||||
|
{ |
||||||
|
if (resHits != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resHits.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resHits[i].collider.gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == direction.vector3Ref || |
||||||
|
variable == maxDistance.floatRef || |
||||||
|
variable == position1.vector3Ref || |
||||||
|
variable == capsulePosition2.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == boxHalfExtends.vector3Ref || |
||||||
|
variable == boxOrientation.quaternionRef || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return castType.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (castType == CastType.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((castType == CastType.Capsule || castType == CastType.Sphere) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (castType == CastType.Box && (propertyName == "boxHalfExtends" || propertyName == "boxOrientation")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 44a4b238cb3af004bbae4a6145089ea2 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,136 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Physics", |
||||||
|
"Overlap", |
||||||
|
"Find all gameobjects hit by given physics shape overlap")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class PhysicsOverlap : CollectionBaseCommand |
||||||
|
{ |
||||||
|
public enum Shape |
||||||
|
{ |
||||||
|
Box, |
||||||
|
Capsule, |
||||||
|
Sphere, |
||||||
|
} |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected Shape shape = Shape.Box; |
||||||
|
|
||||||
|
[Tooltip("Starting point or centre of shape")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data position1; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE ONLY; end point of the capsule")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data capsulePosition2; |
||||||
|
|
||||||
|
[Tooltip("CAPSULE & SPHERE ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected FloatData radius = new FloatData(0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Data boxHalfExtends = new Vector3Data(Vector3.one * 0.5f); |
||||||
|
|
||||||
|
[Tooltip("BOX ONLY")] |
||||||
|
[SerializeField] |
||||||
|
protected QuaternionData boxOrientation = new QuaternionData(Quaternion.identity); |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected LayerMask layerMask = ~0; |
||||||
|
|
||||||
|
[Tooltip("")] |
||||||
|
[SerializeField] |
||||||
|
protected QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
|
||||||
|
if (col != null) |
||||||
|
{ |
||||||
|
Collider[] resColliders = null; |
||||||
|
|
||||||
|
switch (shape) |
||||||
|
{ |
||||||
|
case Shape.Box: |
||||||
|
resColliders = Physics.OverlapBox(position1.Value, boxHalfExtends.Value, boxOrientation.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Sphere: |
||||||
|
resColliders = Physics.OverlapSphere(position1.Value, radius.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
case Shape.Capsule: |
||||||
|
resColliders = Physics.OverlapCapsule(position1.Value, capsulePosition2.Value, radius.Value, layerMask.value, queryTriggerInteraction); |
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
PutCollidersIntoGameObjectCollection(resColliders); |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void PutCollidersIntoGameObjectCollection(Collider[] resColliders) |
||||||
|
{ |
||||||
|
if (resColliders != null) |
||||||
|
{ |
||||||
|
var col = collection.Value; |
||||||
|
for (int i = 0; i < resColliders.Length; i++) |
||||||
|
{ |
||||||
|
col.Add(resColliders[i].gameObject); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return variable == position1.vector3Ref || |
||||||
|
variable == capsulePosition2.vector3Ref || |
||||||
|
variable == radius.floatRef || |
||||||
|
variable == boxHalfExtends.vector3Ref || |
||||||
|
variable == boxOrientation.quaternionRef || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collection.Value == null) |
||||||
|
return "Error: no collection selected"; |
||||||
|
|
||||||
|
//TODO we could support more than just GOs |
||||||
|
if (!(collection.Value is GameObjectCollection)) |
||||||
|
return "Error: collection is not GameObjectCollection"; |
||||||
|
|
||||||
|
return shape.ToString() + ", store in " + collection.Value.name; |
||||||
|
} |
||||||
|
|
||||||
|
public override bool IsPropertyVisible(string propertyName) |
||||||
|
{ |
||||||
|
if (shape == Shape.Capsule && propertyName == "capsulePosition2") |
||||||
|
return true; |
||||||
|
|
||||||
|
if ((shape == Shape.Capsule || shape == Shape.Sphere) && propertyName == "radius") |
||||||
|
return true; |
||||||
|
|
||||||
|
if (shape == Shape.Box && (propertyName == "boxHalfExtends" || propertyName == "boxOrientation")) |
||||||
|
return true; |
||||||
|
|
||||||
|
return base.IsPropertyVisible(propertyName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 5996bc0e902a19f4fa257341b0691de3 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,89 @@ |
|||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Store Input.mousePosition and mouse screen conversions in a variable(s) |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Input", |
||||||
|
"Get Mouse Position", |
||||||
|
"Store various interpretations of Input.mousePosition")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class GetMousePosition : Command |
||||||
|
{ |
||||||
|
[VariableProperty(typeof(Vector2Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector2Variable screenPosition; |
||||||
|
|
||||||
|
[Tooltip("If null, Camera.main is used")] |
||||||
|
protected Camera castCamera; |
||||||
|
|
||||||
|
[VariableProperty(typeof(Vector2Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector2Variable viewPosition; |
||||||
|
|
||||||
|
[VariableProperty(typeof(Vector3Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Variable worldPosition; |
||||||
|
|
||||||
|
[VariableProperty(typeof(Vector3Variable))] |
||||||
|
[SerializeField] |
||||||
|
protected Vector3Variable worldDirection; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
if (castCamera == null) |
||||||
|
{ |
||||||
|
castCamera = Camera.main; |
||||||
|
} |
||||||
|
|
||||||
|
if (screenPosition != null) |
||||||
|
{ |
||||||
|
screenPosition.Value = Input.mousePosition; |
||||||
|
} |
||||||
|
|
||||||
|
if (viewPosition != null) |
||||||
|
{ |
||||||
|
viewPosition.Value = castCamera.ScreenToViewportPoint(Input.mousePosition); |
||||||
|
} |
||||||
|
|
||||||
|
if (worldPosition != null) |
||||||
|
{ |
||||||
|
var screenWithZ = Input.mousePosition; |
||||||
|
screenWithZ.z = castCamera.nearClipPlane; |
||||||
|
worldPosition.Value = castCamera.ScreenToWorldPoint(screenWithZ); |
||||||
|
} |
||||||
|
|
||||||
|
if (worldDirection != null) |
||||||
|
{ |
||||||
|
var screenWithZ = Input.mousePosition; |
||||||
|
screenWithZ.z = castCamera.nearClipPlane; |
||||||
|
worldDirection.Value = castCamera.ScreenPointToRay(screenWithZ).direction; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
return (screenPosition != null ? screenPosition.Key + " " : "") + |
||||||
|
(castCamera != null ? castCamera.name + " " : "MainCam") + |
||||||
|
(viewPosition != null ? viewPosition.Key + " " : "") + |
||||||
|
(worldPosition != null ? worldPosition.Key + " " : "") + |
||||||
|
(worldDirection != null ? worldDirection.Key + " " : ""); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return (screenPosition == variable || |
||||||
|
viewPosition == variable || |
||||||
|
worldPosition == variable || |
||||||
|
worldDirection == variable); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: fb32240870e5bf545a0dafba446d3990 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,84 @@ |
|||||||
|
// This code is part of the Fungus library (https://github.com/snozbot/fungus) maintained by Chris Gregan (http://twitter.com/gofungus). |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
/// <summary> |
||||||
|
/// Loop over a fixed integer range, similar to a common for loop. |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Flow", |
||||||
|
"Loop Range", |
||||||
|
"Loop over a fixed integer range, similar to a common for loop.")] |
||||||
|
[CommandInfo("Flow", |
||||||
|
"For", |
||||||
|
"Loop over a fixed integer range, similar to a common for loop.")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class LoopRange : Condition |
||||||
|
{ |
||||||
|
[Tooltip("Starting value for the counter variable")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData startingValue; |
||||||
|
|
||||||
|
[Tooltip("End value for the counter variable, exclusive")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData endValue; |
||||||
|
|
||||||
|
[Tooltip("Optional int var to hold the current loop counter.")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData counter; |
||||||
|
|
||||||
|
[Tooltip("Step size for the counter, how much does it go up by each loop. Default 1")] |
||||||
|
[SerializeField] |
||||||
|
protected IntegerData step = new IntegerData(1); |
||||||
|
|
||||||
|
#region Public members |
||||||
|
|
||||||
|
public override bool IsLooping { get { return true; } } |
||||||
|
|
||||||
|
protected override void PreEvaluate() |
||||||
|
{ |
||||||
|
//if we came from the end then we are already looping, if not this is first loop so prep |
||||||
|
if (ParentBlock.PreviousActiveCommandIndex != endCommand.CommandIndex) |
||||||
|
{ |
||||||
|
counter.Value = startingValue.Value; |
||||||
|
} |
||||||
|
else |
||||||
|
{ |
||||||
|
counter.Value += (startingValue.Value <= endValue.Value ? step.Value : -step.Value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override bool EvaluateCondition() |
||||||
|
{ |
||||||
|
return (startingValue.Value <= endValue.Value ? |
||||||
|
counter.Value < endValue.Value : |
||||||
|
counter.Value > endValue.Value); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnFalse() |
||||||
|
{ |
||||||
|
MoveToEnd(); |
||||||
|
} |
||||||
|
|
||||||
|
public override void OnValidate() |
||||||
|
{ |
||||||
|
// no infinite loops |
||||||
|
if (step.Value == 0) |
||||||
|
step.Value = 1; |
||||||
|
|
||||||
|
//no negative steps, we do that automatically |
||||||
|
step.Value = Mathf.Abs(step.Value); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
return startingValue.integerRef == variable || endValue.integerRef == variable || |
||||||
|
counter.integerRef == variable || step.integerRef == variable || |
||||||
|
base.HasReference(variable); |
||||||
|
} |
||||||
|
|
||||||
|
#endregion |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: b0eebb5bf2fc1e542a35e2e5332e60d4 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,8 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 8a1a00144f44775449d32d39b5a7185a |
||||||
|
folderAsset: yes |
||||||
|
DefaultImporter: |
||||||
|
externalObjects: {} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,292 @@ |
|||||||
|
/*This script has been, partially or completely, generated by the Fungus.GenerateVariableWindow*/ |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Get or Set a property of a Animator component |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Property", |
||||||
|
"Animator", |
||||||
|
"Get or Set a property of a Animator component")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class AnimatorProperty : BaseVariableProperty |
||||||
|
{ |
||||||
|
//generated property |
||||||
|
public enum Property |
||||||
|
{ |
||||||
|
IsOptimizable, |
||||||
|
IsHuman, |
||||||
|
HasRootMotion, |
||||||
|
HumanScale, |
||||||
|
IsInitialized, |
||||||
|
DeltaPosition, |
||||||
|
DeltaRotation, |
||||||
|
Velocity, |
||||||
|
AngularVelocity, |
||||||
|
RootPosition, |
||||||
|
RootRotation, |
||||||
|
ApplyRootMotion, |
||||||
|
HasTransformHierarchy, |
||||||
|
GravityWeight, |
||||||
|
BodyPosition, |
||||||
|
BodyRotation, |
||||||
|
StabilizeFeet, |
||||||
|
LayerCount, |
||||||
|
ParameterCount, |
||||||
|
FeetPivotActive, |
||||||
|
PivotWeight, |
||||||
|
PivotPosition, |
||||||
|
IsMatchingTarget, |
||||||
|
Speed, |
||||||
|
TargetPosition, |
||||||
|
TargetRotation, |
||||||
|
PlaybackTime, |
||||||
|
RecorderStartTime, |
||||||
|
RecorderStopTime, |
||||||
|
HasBoundPlayables, |
||||||
|
LayersAffectMassCenter, |
||||||
|
LeftFeetBottomHeight, |
||||||
|
RightFeetBottomHeight, |
||||||
|
LogWarnings, |
||||||
|
FireEvents, |
||||||
|
KeepAnimatorControllerStateOnDisable, |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Property property; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(AnimatorVariable))] |
||||||
|
protected AnimatorVariable animatorVar; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(BooleanVariable), |
||||||
|
typeof(FloatVariable), |
||||||
|
typeof(Vector3Variable), |
||||||
|
typeof(QuaternionVariable), |
||||||
|
typeof(IntegerVariable))] |
||||||
|
protected Variable inOutVar; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var iob = inOutVar as BooleanVariable; |
||||||
|
var iof = inOutVar as FloatVariable; |
||||||
|
var iov = inOutVar as Vector3Variable; |
||||||
|
var ioq = inOutVar as QuaternionVariable; |
||||||
|
var ioi = inOutVar as IntegerVariable; |
||||||
|
|
||||||
|
|
||||||
|
var target = animatorVar.Value; |
||||||
|
|
||||||
|
switch (getOrSet) |
||||||
|
{ |
||||||
|
case GetSet.Get: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.IsOptimizable: |
||||||
|
iob.Value = target.isOptimizable; |
||||||
|
break; |
||||||
|
case Property.IsHuman: |
||||||
|
iob.Value = target.isHuman; |
||||||
|
break; |
||||||
|
case Property.HasRootMotion: |
||||||
|
iob.Value = target.hasRootMotion; |
||||||
|
break; |
||||||
|
case Property.HumanScale: |
||||||
|
iof.Value = target.humanScale; |
||||||
|
break; |
||||||
|
case Property.IsInitialized: |
||||||
|
iob.Value = target.isInitialized; |
||||||
|
break; |
||||||
|
case Property.DeltaPosition: |
||||||
|
iov.Value = target.deltaPosition; |
||||||
|
break; |
||||||
|
case Property.DeltaRotation: |
||||||
|
ioq.Value = target.deltaRotation; |
||||||
|
break; |
||||||
|
case Property.Velocity: |
||||||
|
iov.Value = target.velocity; |
||||||
|
break; |
||||||
|
case Property.AngularVelocity: |
||||||
|
iov.Value = target.angularVelocity; |
||||||
|
break; |
||||||
|
case Property.RootPosition: |
||||||
|
iov.Value = target.rootPosition; |
||||||
|
break; |
||||||
|
case Property.RootRotation: |
||||||
|
ioq.Value = target.rootRotation; |
||||||
|
break; |
||||||
|
case Property.ApplyRootMotion: |
||||||
|
iob.Value = target.applyRootMotion; |
||||||
|
break; |
||||||
|
case Property.HasTransformHierarchy: |
||||||
|
iob.Value = target.hasTransformHierarchy; |
||||||
|
break; |
||||||
|
case Property.GravityWeight: |
||||||
|
iof.Value = target.gravityWeight; |
||||||
|
break; |
||||||
|
case Property.BodyPosition: |
||||||
|
iov.Value = target.bodyPosition; |
||||||
|
break; |
||||||
|
case Property.BodyRotation: |
||||||
|
ioq.Value = target.bodyRotation; |
||||||
|
break; |
||||||
|
case Property.StabilizeFeet: |
||||||
|
iob.Value = target.stabilizeFeet; |
||||||
|
break; |
||||||
|
case Property.LayerCount: |
||||||
|
ioi.Value = target.layerCount; |
||||||
|
break; |
||||||
|
case Property.ParameterCount: |
||||||
|
ioi.Value = target.parameterCount; |
||||||
|
break; |
||||||
|
case Property.FeetPivotActive: |
||||||
|
iof.Value = target.feetPivotActive; |
||||||
|
break; |
||||||
|
case Property.PivotWeight: |
||||||
|
iof.Value = target.pivotWeight; |
||||||
|
break; |
||||||
|
case Property.PivotPosition: |
||||||
|
iov.Value = target.pivotPosition; |
||||||
|
break; |
||||||
|
case Property.IsMatchingTarget: |
||||||
|
iob.Value = target.isMatchingTarget; |
||||||
|
break; |
||||||
|
case Property.Speed: |
||||||
|
iof.Value = target.speed; |
||||||
|
break; |
||||||
|
case Property.TargetPosition: |
||||||
|
iov.Value = target.targetPosition; |
||||||
|
break; |
||||||
|
case Property.TargetRotation: |
||||||
|
ioq.Value = target.targetRotation; |
||||||
|
break; |
||||||
|
case Property.PlaybackTime: |
||||||
|
iof.Value = target.playbackTime; |
||||||
|
break; |
||||||
|
case Property.RecorderStartTime: |
||||||
|
iof.Value = target.recorderStartTime; |
||||||
|
break; |
||||||
|
case Property.RecorderStopTime: |
||||||
|
iof.Value = target.recorderStopTime; |
||||||
|
break; |
||||||
|
case Property.HasBoundPlayables: |
||||||
|
iob.Value = target.hasBoundPlayables; |
||||||
|
break; |
||||||
|
case Property.LayersAffectMassCenter: |
||||||
|
iob.Value = target.layersAffectMassCenter; |
||||||
|
break; |
||||||
|
case Property.LeftFeetBottomHeight: |
||||||
|
iof.Value = target.leftFeetBottomHeight; |
||||||
|
break; |
||||||
|
case Property.RightFeetBottomHeight: |
||||||
|
iof.Value = target.rightFeetBottomHeight; |
||||||
|
break; |
||||||
|
case Property.LogWarnings: |
||||||
|
iob.Value = target.logWarnings; |
||||||
|
break; |
||||||
|
case Property.FireEvents: |
||||||
|
iob.Value = target.fireEvents; |
||||||
|
break; |
||||||
|
case Property.KeepAnimatorControllerStateOnDisable: |
||||||
|
iob.Value = target.keepAnimatorControllerStateOnDisable; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
case GetSet.Set: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.RootPosition: |
||||||
|
target.rootPosition = iov.Value; |
||||||
|
break; |
||||||
|
case Property.RootRotation: |
||||||
|
target.rootRotation = ioq.Value; |
||||||
|
break; |
||||||
|
case Property.ApplyRootMotion: |
||||||
|
target.applyRootMotion = iob.Value; |
||||||
|
break; |
||||||
|
case Property.BodyPosition: |
||||||
|
target.bodyPosition = iov.Value; |
||||||
|
break; |
||||||
|
case Property.BodyRotation: |
||||||
|
target.bodyRotation = ioq.Value; |
||||||
|
break; |
||||||
|
case Property.StabilizeFeet: |
||||||
|
target.stabilizeFeet = iob.Value; |
||||||
|
break; |
||||||
|
case Property.FeetPivotActive: |
||||||
|
target.feetPivotActive = iof.Value; |
||||||
|
break; |
||||||
|
case Property.Speed: |
||||||
|
target.speed = iof.Value; |
||||||
|
break; |
||||||
|
case Property.PlaybackTime: |
||||||
|
target.playbackTime = iof.Value; |
||||||
|
break; |
||||||
|
case Property.RecorderStartTime: |
||||||
|
target.recorderStartTime = iof.Value; |
||||||
|
break; |
||||||
|
case Property.RecorderStopTime: |
||||||
|
target.recorderStopTime = iof.Value; |
||||||
|
break; |
||||||
|
case Property.LayersAffectMassCenter: |
||||||
|
target.layersAffectMassCenter = iob.Value; |
||||||
|
break; |
||||||
|
case Property.LogWarnings: |
||||||
|
target.logWarnings = iob.Value; |
||||||
|
break; |
||||||
|
case Property.FireEvents: |
||||||
|
target.fireEvents = iob.Value; |
||||||
|
break; |
||||||
|
case Property.KeepAnimatorControllerStateOnDisable: |
||||||
|
target.keepAnimatorControllerStateOnDisable = iob.Value; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (animatorVar == null) |
||||||
|
{ |
||||||
|
return "Error: no animatorVar set"; |
||||||
|
} |
||||||
|
if (inOutVar == null) |
||||||
|
{ |
||||||
|
return "Error: no variable set to push or pull data to or from"; |
||||||
|
} |
||||||
|
|
||||||
|
return getOrSet.ToString() + " " + property.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
if (animatorVar == variable || inOutVar == variable) |
||||||
|
return true; |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: e4616a794b2245d46970401b3acc492f |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,261 @@ |
|||||||
|
/*This script has been, partially or completely, generated by the Fungus.GenerateVariableWindow*/ |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Get or Set a property of a AudioSource component |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Property", |
||||||
|
"AudioSource", |
||||||
|
"Get or Set a property of a AudioSource component")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class AudioSourceProperty : BaseVariableProperty |
||||||
|
{ |
||||||
|
//generated property |
||||||
|
public enum Property |
||||||
|
{ |
||||||
|
Volume, |
||||||
|
Pitch, |
||||||
|
Time, |
||||||
|
TimeSamples, |
||||||
|
IsPlaying, |
||||||
|
IsVirtual, |
||||||
|
Loop, |
||||||
|
IgnoreListenerVolume, |
||||||
|
PlayOnAwake, |
||||||
|
IgnoreListenerPause, |
||||||
|
PanStereo, |
||||||
|
SpatialBlend, |
||||||
|
Spatialize, |
||||||
|
SpatializePostEffects, |
||||||
|
ReverbZoneMix, |
||||||
|
BypassEffects, |
||||||
|
BypassListenerEffects, |
||||||
|
BypassReverbZones, |
||||||
|
DopplerLevel, |
||||||
|
Spread, |
||||||
|
Priority, |
||||||
|
Mute, |
||||||
|
MinDistance, |
||||||
|
MaxDistance, |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Property property; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(AudioSourceVariable))] |
||||||
|
protected AudioSourceVariable audioSourceVar; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(FloatVariable), |
||||||
|
typeof(IntegerVariable), |
||||||
|
typeof(BooleanVariable))] |
||||||
|
protected Variable inOutVar; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var iof = inOutVar as FloatVariable; |
||||||
|
var ioi = inOutVar as IntegerVariable; |
||||||
|
var iob = inOutVar as BooleanVariable; |
||||||
|
|
||||||
|
|
||||||
|
var target = audioSourceVar.Value; |
||||||
|
|
||||||
|
switch (getOrSet) |
||||||
|
{ |
||||||
|
case GetSet.Get: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Volume: |
||||||
|
iof.Value = target.volume; |
||||||
|
break; |
||||||
|
case Property.Pitch: |
||||||
|
iof.Value = target.pitch; |
||||||
|
break; |
||||||
|
case Property.Time: |
||||||
|
iof.Value = target.time; |
||||||
|
break; |
||||||
|
case Property.TimeSamples: |
||||||
|
ioi.Value = target.timeSamples; |
||||||
|
break; |
||||||
|
case Property.IsPlaying: |
||||||
|
iob.Value = target.isPlaying; |
||||||
|
break; |
||||||
|
case Property.IsVirtual: |
||||||
|
iob.Value = target.isVirtual; |
||||||
|
break; |
||||||
|
case Property.Loop: |
||||||
|
iob.Value = target.loop; |
||||||
|
break; |
||||||
|
case Property.IgnoreListenerVolume: |
||||||
|
iob.Value = target.ignoreListenerVolume; |
||||||
|
break; |
||||||
|
case Property.PlayOnAwake: |
||||||
|
iob.Value = target.playOnAwake; |
||||||
|
break; |
||||||
|
case Property.IgnoreListenerPause: |
||||||
|
iob.Value = target.ignoreListenerPause; |
||||||
|
break; |
||||||
|
case Property.PanStereo: |
||||||
|
iof.Value = target.panStereo; |
||||||
|
break; |
||||||
|
case Property.SpatialBlend: |
||||||
|
iof.Value = target.spatialBlend; |
||||||
|
break; |
||||||
|
case Property.Spatialize: |
||||||
|
iob.Value = target.spatialize; |
||||||
|
break; |
||||||
|
case Property.SpatializePostEffects: |
||||||
|
iob.Value = target.spatializePostEffects; |
||||||
|
break; |
||||||
|
case Property.ReverbZoneMix: |
||||||
|
iof.Value = target.reverbZoneMix; |
||||||
|
break; |
||||||
|
case Property.BypassEffects: |
||||||
|
iob.Value = target.bypassEffects; |
||||||
|
break; |
||||||
|
case Property.BypassListenerEffects: |
||||||
|
iob.Value = target.bypassListenerEffects; |
||||||
|
break; |
||||||
|
case Property.BypassReverbZones: |
||||||
|
iob.Value = target.bypassReverbZones; |
||||||
|
break; |
||||||
|
case Property.DopplerLevel: |
||||||
|
iof.Value = target.dopplerLevel; |
||||||
|
break; |
||||||
|
case Property.Spread: |
||||||
|
iof.Value = target.spread; |
||||||
|
break; |
||||||
|
case Property.Priority: |
||||||
|
ioi.Value = target.priority; |
||||||
|
break; |
||||||
|
case Property.Mute: |
||||||
|
iob.Value = target.mute; |
||||||
|
break; |
||||||
|
case Property.MinDistance: |
||||||
|
iof.Value = target.minDistance; |
||||||
|
break; |
||||||
|
case Property.MaxDistance: |
||||||
|
iof.Value = target.maxDistance; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
case GetSet.Set: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Volume: |
||||||
|
target.volume = iof.Value; |
||||||
|
break; |
||||||
|
case Property.Pitch: |
||||||
|
target.pitch = iof.Value; |
||||||
|
break; |
||||||
|
case Property.Time: |
||||||
|
target.time = iof.Value; |
||||||
|
break; |
||||||
|
case Property.TimeSamples: |
||||||
|
target.timeSamples = ioi.Value; |
||||||
|
break; |
||||||
|
case Property.Loop: |
||||||
|
target.loop = iob.Value; |
||||||
|
break; |
||||||
|
case Property.IgnoreListenerVolume: |
||||||
|
target.ignoreListenerVolume = iob.Value; |
||||||
|
break; |
||||||
|
case Property.PlayOnAwake: |
||||||
|
target.playOnAwake = iob.Value; |
||||||
|
break; |
||||||
|
case Property.IgnoreListenerPause: |
||||||
|
target.ignoreListenerPause = iob.Value; |
||||||
|
break; |
||||||
|
case Property.PanStereo: |
||||||
|
target.panStereo = iof.Value; |
||||||
|
break; |
||||||
|
case Property.SpatialBlend: |
||||||
|
target.spatialBlend = iof.Value; |
||||||
|
break; |
||||||
|
case Property.Spatialize: |
||||||
|
target.spatialize = iob.Value; |
||||||
|
break; |
||||||
|
case Property.SpatializePostEffects: |
||||||
|
target.spatializePostEffects = iob.Value; |
||||||
|
break; |
||||||
|
case Property.ReverbZoneMix: |
||||||
|
target.reverbZoneMix = iof.Value; |
||||||
|
break; |
||||||
|
case Property.BypassEffects: |
||||||
|
target.bypassEffects = iob.Value; |
||||||
|
break; |
||||||
|
case Property.BypassListenerEffects: |
||||||
|
target.bypassListenerEffects = iob.Value; |
||||||
|
break; |
||||||
|
case Property.BypassReverbZones: |
||||||
|
target.bypassReverbZones = iob.Value; |
||||||
|
break; |
||||||
|
case Property.DopplerLevel: |
||||||
|
target.dopplerLevel = iof.Value; |
||||||
|
break; |
||||||
|
case Property.Spread: |
||||||
|
target.spread = iof.Value; |
||||||
|
break; |
||||||
|
case Property.Priority: |
||||||
|
target.priority = ioi.Value; |
||||||
|
break; |
||||||
|
case Property.Mute: |
||||||
|
target.mute = iob.Value; |
||||||
|
break; |
||||||
|
case Property.MinDistance: |
||||||
|
target.minDistance = iof.Value; |
||||||
|
break; |
||||||
|
case Property.MaxDistance: |
||||||
|
target.maxDistance = iof.Value; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (audioSourceVar == null) |
||||||
|
{ |
||||||
|
return "Error: no audioSourceVar set"; |
||||||
|
} |
||||||
|
if (inOutVar == null) |
||||||
|
{ |
||||||
|
return "Error: no variable set to push or pull data to or from"; |
||||||
|
} |
||||||
|
|
||||||
|
return getOrSet.ToString() + " " + property.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
if (audioSourceVar == variable || inOutVar == variable) |
||||||
|
return true; |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 2250cfac690a2b74f8f9dd9be91985c6 |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,125 @@ |
|||||||
|
/*This script has been, partially or completely, generated by the Fungus.GenerateVariableWindow*/ |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Get or Set a property of a Collection component |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Property", |
||||||
|
"Collection", |
||||||
|
"Get or Set a property of a Collection component")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class CollectionProperty : BaseVariableProperty |
||||||
|
{ |
||||||
|
//generated property |
||||||
|
public enum Property |
||||||
|
{ |
||||||
|
Capacity, |
||||||
|
Count, |
||||||
|
IsFixedSize, |
||||||
|
IsReadOnly, |
||||||
|
IsSynchronized, |
||||||
|
Name, |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Property property; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected CollectionData collectionData; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(IntegerVariable), |
||||||
|
typeof(BooleanVariable), |
||||||
|
typeof(StringVariable))] |
||||||
|
protected Variable inOutVar; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var ioi = inOutVar as IntegerVariable; |
||||||
|
var iob = inOutVar as BooleanVariable; |
||||||
|
var ios = inOutVar as StringVariable; |
||||||
|
|
||||||
|
|
||||||
|
var target = collectionData.Value; |
||||||
|
|
||||||
|
switch (getOrSet) |
||||||
|
{ |
||||||
|
case GetSet.Get: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Capacity: |
||||||
|
ioi.Value = target.Capacity; |
||||||
|
break; |
||||||
|
case Property.Count: |
||||||
|
ioi.Value = target.Count; |
||||||
|
break; |
||||||
|
case Property.IsFixedSize: |
||||||
|
iob.Value = target.IsFixedSize; |
||||||
|
break; |
||||||
|
case Property.IsReadOnly: |
||||||
|
iob.Value = target.IsReadOnly; |
||||||
|
break; |
||||||
|
case Property.IsSynchronized: |
||||||
|
iob.Value = target.IsSynchronized; |
||||||
|
break; |
||||||
|
case Property.Name: |
||||||
|
ios.Value = target.Name; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
case GetSet.Set: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Capacity: |
||||||
|
target.Capacity = ioi.Value; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collectionData.Value == null) |
||||||
|
{ |
||||||
|
return "Error: no collection set"; |
||||||
|
} |
||||||
|
if (inOutVar == null) |
||||||
|
{ |
||||||
|
return "Error: no variable set to push or pull data to or from"; |
||||||
|
} |
||||||
|
|
||||||
|
return getOrSet.ToString() + " " + property.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
if (collectionData.collectionRef == variable || inOutVar == variable) |
||||||
|
return true; |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: 6f03dcf7e7a1d2e418e5588731888b5a |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,153 @@ |
|||||||
|
/*This script has been, partially or completely, generated by the Fungus.GenerateVariableWindow*/ |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Get or Set a property of a Collider2D component |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Property", |
||||||
|
"Collider2D", |
||||||
|
"Get or Set a property of a Collider2D component")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class Collider2DProperty : BaseVariableProperty |
||||||
|
{ |
||||||
|
//generated property |
||||||
|
public enum Property |
||||||
|
{ |
||||||
|
Density, |
||||||
|
IsTrigger, |
||||||
|
UsedByEffector, |
||||||
|
UsedByComposite, |
||||||
|
Offset, |
||||||
|
AttachedRigidbody, |
||||||
|
ShapeCount, |
||||||
|
Friction, |
||||||
|
Bounciness, |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Property property; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Collider2DData collider2DData; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(FloatVariable), |
||||||
|
typeof(BooleanVariable), |
||||||
|
typeof(Vector2Variable), |
||||||
|
typeof(Rigidbody2DVariable), |
||||||
|
typeof(IntegerVariable))] |
||||||
|
protected Variable inOutVar; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var iof = inOutVar as FloatVariable; |
||||||
|
var iob = inOutVar as BooleanVariable; |
||||||
|
var iov2 = inOutVar as Vector2Variable; |
||||||
|
var iorb2d = inOutVar as Rigidbody2DVariable; |
||||||
|
var ioi = inOutVar as IntegerVariable; |
||||||
|
|
||||||
|
|
||||||
|
var target = collider2DData.Value; |
||||||
|
|
||||||
|
switch (getOrSet) |
||||||
|
{ |
||||||
|
case GetSet.Get: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Density: |
||||||
|
iof.Value = target.density; |
||||||
|
break; |
||||||
|
case Property.IsTrigger: |
||||||
|
iob.Value = target.isTrigger; |
||||||
|
break; |
||||||
|
case Property.UsedByEffector: |
||||||
|
iob.Value = target.usedByEffector; |
||||||
|
break; |
||||||
|
case Property.UsedByComposite: |
||||||
|
iob.Value = target.usedByComposite; |
||||||
|
break; |
||||||
|
case Property.Offset: |
||||||
|
iov2.Value = target.offset; |
||||||
|
break; |
||||||
|
case Property.AttachedRigidbody: |
||||||
|
iorb2d.Value = target.attachedRigidbody; |
||||||
|
break; |
||||||
|
case Property.ShapeCount: |
||||||
|
ioi.Value = target.shapeCount; |
||||||
|
break; |
||||||
|
case Property.Friction: |
||||||
|
iof.Value = target.friction; |
||||||
|
break; |
||||||
|
case Property.Bounciness: |
||||||
|
iof.Value = target.bounciness; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
case GetSet.Set: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Density: |
||||||
|
target.density = iof.Value; |
||||||
|
break; |
||||||
|
case Property.IsTrigger: |
||||||
|
target.isTrigger = iob.Value; |
||||||
|
break; |
||||||
|
case Property.UsedByEffector: |
||||||
|
target.usedByEffector = iob.Value; |
||||||
|
break; |
||||||
|
case Property.UsedByComposite: |
||||||
|
target.usedByComposite = iob.Value; |
||||||
|
break; |
||||||
|
case Property.Offset: |
||||||
|
target.offset = iov2.Value; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (collider2DData.Value == null) |
||||||
|
{ |
||||||
|
return "Error: no collider2D set"; |
||||||
|
} |
||||||
|
if (inOutVar == null) |
||||||
|
{ |
||||||
|
return "Error: no variable set to push or pull data to or from"; |
||||||
|
} |
||||||
|
|
||||||
|
return getOrSet.ToString() + " " + property.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
if (collider2DData.collider2DRef == variable || inOutVar == variable) |
||||||
|
return true; |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: c5d345b268622414c9bb53e05f4580ed |
||||||
|
timeCreated: 1517559095 |
||||||
|
licenseType: Free |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
@ -0,0 +1,123 @@ |
|||||||
|
/*This script has been, partially or completely, generated by the Fungus.GenerateVariableWindow*/ |
||||||
|
using UnityEngine; |
||||||
|
|
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
// <summary> |
||||||
|
/// Get or Set a property of a Collider component |
||||||
|
/// </summary> |
||||||
|
[CommandInfo("Property", |
||||||
|
"Collider", |
||||||
|
"Get or Set a property of a Collider component")] |
||||||
|
[AddComponentMenu("")] |
||||||
|
public class ColliderProperty : BaseVariableProperty |
||||||
|
{ |
||||||
|
//generated property |
||||||
|
public enum Property |
||||||
|
{ |
||||||
|
Enabled, |
||||||
|
AttachedRigidbody, |
||||||
|
IsTrigger, |
||||||
|
ContactOffset, |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected Property property; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
protected ColliderData colliderData; |
||||||
|
|
||||||
|
[SerializeField] |
||||||
|
[VariableProperty(typeof(BooleanVariable), |
||||||
|
typeof(RigidbodyVariable), |
||||||
|
typeof(FloatVariable))] |
||||||
|
protected Variable inOutVar; |
||||||
|
|
||||||
|
public override void OnEnter() |
||||||
|
{ |
||||||
|
var iob = inOutVar as BooleanVariable; |
||||||
|
var iorb = inOutVar as RigidbodyVariable; |
||||||
|
var iof = inOutVar as FloatVariable; |
||||||
|
|
||||||
|
|
||||||
|
var target = colliderData.Value; |
||||||
|
|
||||||
|
switch (getOrSet) |
||||||
|
{ |
||||||
|
case GetSet.Get: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Enabled: |
||||||
|
iob.Value = target.enabled; |
||||||
|
break; |
||||||
|
case Property.AttachedRigidbody: |
||||||
|
iorb.Value = target.attachedRigidbody; |
||||||
|
break; |
||||||
|
case Property.IsTrigger: |
||||||
|
iob.Value = target.isTrigger; |
||||||
|
break; |
||||||
|
case Property.ContactOffset: |
||||||
|
iof.Value = target.contactOffset; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
case GetSet.Set: |
||||||
|
switch (property) |
||||||
|
{ |
||||||
|
case Property.Enabled: |
||||||
|
target.enabled = iob.Value; |
||||||
|
break; |
||||||
|
case Property.IsTrigger: |
||||||
|
target.isTrigger = iob.Value; |
||||||
|
break; |
||||||
|
case Property.ContactOffset: |
||||||
|
target.contactOffset = iof.Value; |
||||||
|
break; |
||||||
|
default: |
||||||
|
Debug.Log("Unsupported get or set attempted"); |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
Continue(); |
||||||
|
} |
||||||
|
|
||||||
|
public override string GetSummary() |
||||||
|
{ |
||||||
|
if (colliderData.Value == null) |
||||||
|
{ |
||||||
|
return "Error: no collider set"; |
||||||
|
} |
||||||
|
if (inOutVar == null) |
||||||
|
{ |
||||||
|
return "Error: no variable set to push or pull data to or from"; |
||||||
|
} |
||||||
|
|
||||||
|
return getOrSet.ToString() + " " + property.ToString(); |
||||||
|
} |
||||||
|
|
||||||
|
public override Color GetButtonColor() |
||||||
|
{ |
||||||
|
return new Color32(235, 191, 217, 255); |
||||||
|
} |
||||||
|
|
||||||
|
public override bool HasReference(Variable variable) |
||||||
|
{ |
||||||
|
if (colliderData.colliderRef == variable || inOutVar == variable) |
||||||
|
return true; |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
fileFormatVersion: 2 |
||||||
|
guid: ca6e05b34c44a734988887ef775a1a1b |
||||||
|
timeCreated: 1517559091 |
||||||
|
licenseType: Free |
||||||
|
MonoImporter: |
||||||
|
externalObjects: {} |
||||||
|
serializedVersion: 2 |
||||||
|
defaultReferences: [] |
||||||
|
executionOrder: 0 |
||||||
|
icon: {instanceID: 0} |
||||||
|
userData: |
||||||
|
assetBundleName: |
||||||
|
assetBundleVariant: |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue