Beispiel #1
0
 public object GetData(BattleObject owner, GameAction action)
 {
     if (source == SubactionSource.CONSTANT)
     {
         if (type == SubactionVarType.STRING)
         {
             return(data);
         }
         else if (type == SubactionVarType.INT)
         {
             return(int.Parse(data));
         }
         else if (type == SubactionVarType.FLOAT)
         {
             return(float.Parse(data));
         }
         else if (type == SubactionVarType.BOOL)
         {
             return(bool.Parse(data));
         }
         else
         {
             Debug.LogError("SubactionVarData incorrect type: " + type);
             return(null);
         }
     }
     else if (source == SubactionSource.OWNER)
     {
         if (type == SubactionVarType.STRING)
         {
             return(owner.GetStringVar(data));
         }
         else if (type == SubactionVarType.INT)
         {
             return(owner.GetIntVar(data));
         }
         else if (type == SubactionVarType.FLOAT)
         {
             return(owner.GetFloatVar(data));
         }
         else if (type == SubactionVarType.BOOL)
         {
             return(owner.GetBoolVar(data));
         }
         else
         {
             Debug.LogError("SubactionVarData incorrect type: " + type);
             return(null);
         }
     }
     else if (source == SubactionSource.ACTION)
     {
         if (type == SubactionVarType.STRING)
         {
             return(action.GetStringVar(data));
         }
         else if (type == SubactionVarType.INT)
         {
             return(action.GetIntVar(data));
         }
         else if (type == SubactionVarType.FLOAT)
         {
             return(action.GetFloatVar(data));
         }
         else if (type == SubactionVarType.BOOL)
         {
             return(action.GetBoolVar(data));
         }
         else
         {
             Debug.LogError("SubactionVarData incorrect type: " + type);
             return(null);
         }
     }
     else
     {
         Debug.LogError("SubactionVarData incorrect source: " + source);
         return(null);
     }
 }