New PlayMaker actions: IsoIsUseGravity, IsoSetIsKinematic, IsoSetUseGravity, IsoWakeUp

This commit is contained in:
2015-12-20 21:04:59 +06:00
parent 7c867f36ff
commit 6ef010b147
9 changed files with 199 additions and 1 deletions

View File

@@ -0,0 +1,50 @@
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Tests if a IsoRigidbody use gravity.")]
public class IsoIsUseGravity : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public FsmEvent trueEvent;
public FsmEvent falseEvent;
[UIHint(UIHint.Variable)]
public FsmBool storeResult;
public bool everyFrame;
public override void Reset() {
gameObject = null;
trueEvent = null;
falseEvent = null;
storeResult = null;
everyFrame = false;
}
public override void OnEnter() {
DoAction();
if ( !everyFrame ) {
Finish();
}
}
public override void OnUpdate() {
DoAction();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
var value = isoRigidbody.useGravity;
storeResult.Value = value;
Fsm.Event(value ? trueEvent : falseEvent);
}
}
}
} // IsoTools.PlayMaker.Actions

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bc13998ebfe99487a9e042a27adb3d18
timeCreated: 1450621205
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Sets the IsKinematic of a IsoRigidbody.")]
public class IsoSetIsKinematic : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmBool isKinematic;
public override void Reset() {
gameObject = null;
isKinematic = true;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.isKinematic = isKinematic.Value;
}
}
}
} // IsoTools.PlayMaker.Actions

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fd8b09a582b9846e79c50485090f3fe3
timeCreated: 1450622310
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Sets the UseGravity of a IsoRigidbody.")]
public class IsoSetUseGravity : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
[RequiredField]
public FsmBool useGravity;
public override void Reset() {
gameObject = null;
useGravity = true;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.useGravity = useGravity.Value;
}
}
}
} // IsoTools.PlayMaker.Actions

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ad8fb89aabd864275b73abb7a6b47165
timeCreated: 1450623490
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
using UnityEngine;
using HutongGames.PlayMaker;
using IsoTools.PlayMaker.Internal;
namespace IsoTools.PlayMaker.Actions {
[ActionCategory("IsoTools.Physics")]
[HutongGames.PlayMaker.Tooltip(
"Force a IsoRigidbody to WakeUp.")]
public class IsoWakeUp : IsoComponentAction<IsoRigidbody> {
[RequiredField]
[CheckForComponent(typeof(IsoRigidbody))]
public FsmOwnerDefault gameObject;
public override void Reset() {
gameObject = null;
}
public override void OnEnter() {
DoAction();
Finish();
}
void DoAction() {
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if ( UpdateCache(go) ) {
isoRigidbody.WakeUp();
}
}
}
} // IsoTools.PlayMaker.Actions

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b4872fa9b5ff346f88f45459d0c257e0
timeCreated: 1450621127
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: