void DoSet(Blackboard bb, string name, T value)
        {
            var targetVariable = bb.GetVariable <T>(name);

            if (targetVariable == null)
            {
                targetVariable = (Variable <T>)bb.AddVariable(varName.value, typeof(T));
            }
            if (operation != OperationMethod.Set)
            {
                if (typeof(T) == typeof(float))
                {
                    targetVariable.value = (T)(object)OperationTools.Operate((float)(object)targetVariable.value, (float)(object)value, operation);
                }
                else if (typeof(T) == typeof(int))
                {
                    targetVariable.value = (T)(object)OperationTools.Operate((int)(object)targetVariable.value, (int)(object)value, operation);
                }
                else if (typeof(T) == typeof(Vector3))
                {
                    targetVariable.value = (T)(object)OperationTools.Operate((Vector3)(object)targetVariable.value, (Vector3)(object)value, operation);
                }
                else
                {
                    targetVariable.value = value;
                }
            }
            else
            {
                targetVariable.value = value;
            }
        }
 void DoSet(T value)
 {
     if (operation != OperationMethod.Set)
     {
         if (typeof(T) == typeof(float))
         {
             targetVariable.value = (T)(object)OperationTools.Operate((float)(object)targetVariable.value, (float)(object)value, operation, perSecond ? Time.deltaTime : 1f);
         }
         else if (typeof(T) == typeof(int))
         {
             targetVariable.value = (T)(object)OperationTools.Operate((int)(object)targetVariable.value, (int)(object)value, operation);
         }
         else if (typeof(T) == typeof(Vector3))
         {
             targetVariable.value = (T)(object)OperationTools.Operate((Vector3)(object)targetVariable.value, (Vector3)(object)value, operation, perSecond ? Time.deltaTime : 1f);
         }
         else
         {
             targetVariable.value = value;
         }
     }
     else
     {
         targetVariable.value = value;
     }
 }
 protected override void OnExecute()
 {
     valueA.value = OperationTools.Operate(valueA.value, valueB.value, Operation);
     EndAction();
 }
		protected override void OnExecute(){
			valueA.value = OperationTools.Operate(valueA.value, valueB.value, operation, perSecond? Time.deltaTime : 1f );
			EndAction();
		}
Beispiel #5
0
 protected override void OnExecute()
 {
     valueA.value = OperationTools.Operate(valueA.value, valueB.value, Operation, perSecond ? UnityEngine.Time.deltaTime : 1f);
     EndAction(true);
 }