Skip to content

Commit

Permalink
Update ootii Playmaker Actions and Add a new Actions for Enable and D…
Browse files Browse the repository at this point in the history
…isable WeaponSet

Signed-off-by: Christian Schamara <[email protected]>
  • Loading branch information
Salja committed Jan 27, 2018
1 parent 53619e3 commit bace4da
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
66 changes: 66 additions & 0 deletions ootii/EnableWeaponSet.cs
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;
}
}
}
}
2 changes: 1 addition & 1 deletion ootii/GetAttributeFloat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void GetAttribute()

if (mBasicAttributes != null)
{
float lValue = mBasicAttributes.GetAttributeValue(attribute.Value);
float lValue = mBasicAttributes.GetAttributeValue<float>(attribute.Value);
store.Value = mBasicAttributes.GetAttributeValue(attribute.Value, lValue);
}
}
Expand Down
4 changes: 2 additions & 2 deletions ootii/ModifyAttributeFloat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ void ModifyAttribute()

if (!perSecond)
{
float lValue = mBasicAttributes.GetAttributeValue(attribute.Value);
float lValue = mBasicAttributes.GetAttributeValue<float>(attribute.Value);
mBasicAttributes.SetAttributeValue(attribute.Value, lValue + floatValue.Value);
}
else
{
float lValue = mBasicAttributes.GetAttributeValue(attribute.Value);
float lValue = mBasicAttributes.GetAttributeValue<float>(attribute.Value);
mBasicAttributes.SetAttributeValue(attribute.Value, lValue + floatValue.Value * Time.deltaTime);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ootii/SetAttributeFloat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void SetAttribute()

mBasicAttributes = go.GetComponent<BasicAttributes>();

float lValue = mBasicAttributes.GetAttributeValue(attribute.Value);
float lValue = mBasicAttributes.GetAttributeValue<float>(attribute.Value);
mBasicAttributes.SetAttributeValue(attribute.Value, floatValue.Value);
}
}
Expand Down

0 comments on commit bace4da

Please sign in to comment.