-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ootii Playmaker Actions and Add a new Actions for Enable and D…
…isable WeaponSet Signed-off-by: Christian Schamara <[email protected]>
- Loading branch information
Showing
4 changed files
with
70 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// (c) Copyright HutongGames, LLC 2010-2014. All rights reserved. | ||
/*--- __ECO__ __PLAYMAKER__ __ACTION__ ---*/ | ||
|
||
using UnityEngine; | ||
using com.ootii.Actors.Inventory; | ||
|
||
namespace HutongGames.PlayMaker.Actions | ||
{ | ||
[ActionCategory("ootii")] | ||
[Tooltip("Enable/Disable WeaponSet")] | ||
public class EnableWeaponSet : FsmStateAction | ||
{ | ||
[RequiredField] | ||
[Tooltip("The GameObject Player.")] | ||
[CheckForComponent(typeof(BasicInventory))] | ||
public FsmOwnerDefault gameObject; | ||
|
||
public FsmString mWeaponSet; | ||
|
||
public bool enable = false; | ||
|
||
private BasicInventory mBasicInventory; | ||
|
||
public override void Reset() | ||
{ | ||
gameObject = null; | ||
mWeaponSet = null; | ||
enable = false; | ||
} | ||
|
||
public override void OnEnter() | ||
{ | ||
isWeaponSet(); | ||
Finish(); | ||
} | ||
|
||
public override void OnUpdate() | ||
{ | ||
isWeaponSet(); | ||
} | ||
|
||
void isWeaponSet() | ||
{ | ||
GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); | ||
if (go == null) | ||
{ | ||
return; | ||
} | ||
|
||
mBasicInventory = go.GetComponent<BasicInventory>(); | ||
|
||
if (mBasicInventory == null) | ||
{ | ||
Finish(); | ||
return; | ||
} | ||
|
||
BasicInventorySet lWeaponSet = mBasicInventory.GetWeaponSet(mWeaponSet.Value); | ||
|
||
if (lWeaponSet != null) | ||
{ | ||
lWeaponSet.IsEnabled = enable; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters