Example #1
0
        public static List <int> WriteTraitListToFile()
        {
            FileStream fcreate = File.Open(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                                           + "/Content/TraitList.json", FileMode.Create);

            fcreate.Close();


            Console.WriteLine("Getting API");
            //Get list from API
            GetAPIClient();

            _listOfTraits = new TraitList();
            HttpResponseMessage response = APIClient.GetAsync(new Uri("/v2/traits", UriKind.Relative)).Result;
            var failedList = new List <int>();

            if (response.IsSuccessStatusCode)
            {
                // Get Skill ID list
                _listOfTraits.Items.AddRange(GetListGW2APITraits());
                var writer = new StreamWriter(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)
                                              + "/Content/TraitList.json");
                var serializer = new JsonSerializer
                {
                    NullValueHandling    = NullValueHandling.Ignore,
                    Formatting           = Formatting.None,
                    DefaultValueHandling = DefaultValueHandling.Ignore,
                    ContractResolver     = GeneralHelper.ContractResolver
                };
                serializer.Serialize(writer, _listOfTraits.Items);
                writer.Close();
            }
            return(failedList);
        }
Example #2
0
 private void OnEnable()
 {
     traitList = (TraitList)target;
     if (traitList.traits == null)
     {
         traitList.traits = new List <Trait>();
     }
 }
Example #3
0
 public void GenerateTraitsList(CreatureManager hManager, string speciesName)
 {
     //Generate the list of traits. This is because all traits will be on the same layout
     //              This MIGHT change through mutation (swap with other traits etc?)
     //genome = gameObject.GetComponent<HumanManager>().genomeManager.genome;
     genome    = hManager.genomeManager.genome;
     traitList = new TraitList(genome, this, hManager, speciesName);
     //This has been moved to the Thread
     //EvaluateTraits();
 }
Example #4
0
    public Character(int maxTraits, int minLevel, int maxLevel)
    {
        GameObject.Find("GameController").GetComponent <GameController> ().CharacterDatabase.AssignID(this);
        SecondWindActive      = false;
        SecondWindEnergyGain  = 200;
        LevelUpThreshold      = 1000;
        SkillAdvanceThreshold = 1000;
        //TODO: Replace Array here with dynamic list, and the demands for executing one with a matching string in list
        //Alternatively, a game object or class instance per special move?
        SpecialMovesKnown      = new bool[2];
        RandomBonusRange       = 5;
        RandomHealthBonusRange = 100;
        RandomEnergyBonusRange = 400;

        UsedSpecialMoveThisTurn   = false;
        TurnsSinceLastSpecialMove = 0;
        IsInTeam = false;
        Traits   = new List <Trait>();
        TraitList    traitList  = new TraitList();
        List <Trait> allTraits  = traitList.GetTrait();
        RaceList     races      = new RaceList();
        List <Race>  allRaces   = races.GetRace();
        ClassList    classes    = new ClassList();
        List <Class> allClasses = classes.GetFClass();

        Level = 1;
        SetRace(allRaces);
        SetGender();
        SetAge();
        SetName();
        SetTraits(allTraits, maxTraits);
        SetFClass(allClasses);
        SetAllStats();
        SetBaseSpecialMoves();
        SetRandomFightMoneyCut();
        InitialLeveling(minLevel, maxLevel);
        CurrentHealth = MaxHealth;
        CurrentEnergy = MaxEnergy;

        ExperiencePoints = 0;

        Relations      = new CharacterRelations();
        CharacterFlags = new CharacterFlags();
    }
Example #5
0
    public UnitInfoDisplayScript uid; //maybe remove from here later

	void Start()
    {
        traits = new TraitList();

        ReconstructGUI();
    }