Exemplo n.º 1
0
        //_newValue.Name => name of trait or relationship
        //_newValue.LiteralValueOrBoundVarName => literal value or variable bound value of trait or relationship strength
        //_newTarget.Name => name of relationship (should be same as _newValue.Name)
        //_newTarget.LiteralValueOrBoundVarName => character variable that is bound to new relationship
        public ActionEditObject(UInt64 parentPlotFragmentId, string varObjectName, UInt64 objectTypeId, ObjectEditingMode mode, StoryData world)
            : base(parentPlotFragmentId, world)
        {
            _varObjectName = varObjectName;
            _varObjectTypeId = objectTypeId;
            _mode = mode;

            //Find editing type
            if (objectTypeId == world.CharTypeId) //Character
            {
                _newValue = new Parameter("Name", TraitDataType.Text, false, world);
                _newTarget = new Parameter("", TraitDataType.Text, true, world);
            }
            else if (objectTypeId == world.EnvTypeId) //Environment
            {
                _newValue = new Parameter("Name", TraitDataType.Text, false, world);
                _newTarget = new Parameter("", TraitDataType.Text, true, world);
            }
            else //Plot Point
            {
                PlotPointType currType = world.findPlotPointTypeById(objectTypeId);

                _newValue = new Parameter(currType.Traits[0].Name, currType.Traits[0].Type, false, world);
                _newTarget = new Parameter("", TraitDataType.Text, true, world);
            }
        }
Exemplo n.º 2
0
 public ActionCalculation(UInt64 parentPlotFragmentId, string varName, StoryData world)
     : base(parentPlotFragmentId, world)
 {
     _resultVar = new Trait(varName, TraitDataType.Number, world.getNewId(), world);
     _paramLeft = new Parameter("paramLeft", TraitDataType.Number, false, world);
     _paramRight = new Parameter("paramRight", TraitDataType.Number, false, world);
     _op = CalculationOperation.Add;
 }
Exemplo n.º 3
0
 public Constraint(UInt64 parentPlotFragmentId, UInt64 parentPrecondStatementId, bool allowedToSave, UInt64 matchingEntityTypeId, StoryData world)
 {
     _matchingEntityTypeId = matchingEntityTypeId;
     _constraintId = world.getNewId();
     _parentPrecondStmtId = parentPrecondStatementId;
     _allowedToSave = allowedToSave;
     _parentPlotFragmentId = parentPlotFragmentId;
     _constraintType = ConstraintComparisonType.Equals;
     _comparisonValue = new Parameter("", TraitDataType.Text, false, world);
     _saveAttribute = false;
     _savedVariable = new Trait("", TraitDataType.Text, "", 0, world);
     _mustAlwaysBeTrue = false;
 }
Exemplo n.º 4
0
 public Parameter(Parameter anotherParameter, StoryData world)
     : base(anotherParameter, world)
 {
     _valueIsBoundToVariable = anotherParameter.ValueIsBoundToVariable;
 }
Exemplo n.º 5
0
        private static string generateJavaValueString(Parameter input)
        {
            switch(input.Type)
              {
              case TraitDataType.TrueFalse:
                  bool val = (bool)input.LiteralValueOrBoundVarName;
                  if (val) { return "true"; } else { return "false"; }
                  break;
              case TraitDataType.Number:
                  return ((double)input.LiteralValueOrBoundVarName).ToString() + "f";
              case TraitDataType.Text:
                  return generateValidLiteralString((string)input.LiteralValueOrBoundVarName);
              }

              return "";
        }