public void OnSelectBuild(int index)
 {
     if (Builds.builds.Length > index)
     {
         CharacterBuildController.ApplyBuild(index);
     }
 }
 public void OnUpdateBuild(int index)
 {
     if (Builds.builds.Length > index)
     {
         Build build    = CharacterBuildController.CreateBuild();
         Build existing = Builds.builds[index];
         existing.equipment = build.equipment;
         existing.hotKeys   = build.hotKeys;
         CharacterBuildController.SaveBuilds();
     }
 }
        public void OnCreateBuild()
        {
            string label = input.text;

            if (label?.Length > 2)
            {
                Build build = CharacterBuildController.CreateBuild();
                build.label = label + "";
                Build[] dest = new Build[Builds.builds.Length + 1];
                Array.Copy(Builds.builds, 0, dest, 0, Builds.builds.Length);
                dest[Builds.builds.Length] = build;
                Builds.builds = dest;
                CharacterBuildController.SaveBuilds();
            }
        }
        public void OnDeleteBuild(int index)
        {
            if (Builds.builds.Length > index)
            {
                Build[] dest = new Build[Builds.builds.Length - 1];
                if (index > 0)
                {
                    Array.Copy(Builds.builds, 0, dest, 0, index);
                }

                if (index < Builds.builds.Length - 1)
                {
                    Array.Copy(Builds.builds, index + 1, dest, index, Builds.builds.Length - index - 1);
                }

                Builds.builds = dest;
                CharacterBuildController.SaveBuilds();
            }
        }
 public static void ApplyBuild(int index)
 {
     if (builds.builds.Length > index)
     {
         try
         {
             player.UnequipAll();
             player.UnSetHotKeys();
             player.EquipAll(builds.builds[index].equipment);
             player.SetHotKeys(builds.builds[index].hotKeys);
             builds.currentBuild = index;
             CharacterBuildController.SaveBuilds();
         }
         catch (Exception e)
         {
             Debug.Log("Could not apply build " + builds.builds[index].label);
             Debug.Log(e);
         }
     }
 }