shuriken can now be thrown jumping animtions jumping animations timing state machine changes start of online integration
61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using System.Runtime.InteropServices.WindowsRuntime;
|
|
using NodeCanvas.Framework;
|
|
using ParadoxNotion.Design;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Reset.Items{
|
|
|
|
[Category("Reset/Combat")]
|
|
[Description("Check if the provided value matches the weapon actor's variable")]
|
|
public class CheckWeaponActorVariable<T> : ConditionTask<Transform> where T : class{
|
|
public BBParameter<string> variable;
|
|
public BBParameter<T> value;
|
|
|
|
WeaponActor actor;
|
|
|
|
protected override string info{
|
|
get{ return $"weapon actor variable <b>{variable.value}</b> is <b><i>{value.value}</b></i>"; }
|
|
}
|
|
|
|
//Use for initialization. This is called only once in the lifetime of the task.
|
|
//Return null if init was successfull. Return an error string otherwise
|
|
protected override string OnInit(){
|
|
return null;
|
|
}
|
|
|
|
//Called whenever the condition gets enabled.
|
|
protected override void OnEnable(){
|
|
actor = agent.GetComponent<WeaponActor>();
|
|
}
|
|
|
|
//Called whenever the condition gets disabled.
|
|
protected override void OnDisable(){
|
|
|
|
}
|
|
|
|
//Called once per frame while the condition is active.
|
|
//Return whether the condition is success or failure.
|
|
protected override bool OnCheck(){
|
|
if (!actor) {
|
|
Debug.LogError(
|
|
$"No weapon actor variable found on this player. Cannot check for value of {variable.value}.",
|
|
agent);
|
|
return false;
|
|
}
|
|
|
|
if (actor.weaponVariables.ContainsKey(variable.value)) {
|
|
T valueAsType = value.value;
|
|
|
|
Debug.Log((T)actor.weaponVariables[variable.value]);
|
|
Debug.Log(valueAsType);
|
|
return ((T)actor.weaponVariables[variable.value]).Equals(valueAsType);
|
|
|
|
} else {
|
|
Debug.LogError($"No variable found by name {variable.value} on the weapon actor", agent);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|