/// <summary> </summary> public static Weapon Create(Weaponary type) { Weapon weapon = null; string weaponary = Enum.GetName(typeof(Weaponary), type); switch (weaponary) { case "Axe": weapon = new Axe(); break; case "None": weapon = new None(); break; case "Spear": weapon = new Spear(); break; case "Sword": weapon = new Sword(); break; default: break; } return(weapon); }
void Start() { var weaponsFromGUI = weaponaryTransform.GetComponentsInChildren <Weapon>(); List <Weapon> weaponList = new List <Weapon>(); ExtendedDictonary <Weapon, bool> weaponStatusDictionary = new ExtendedDictonary <Weapon, bool>(); foreach (var weaponFromGUI in weaponsFromGUI) { weaponList.Add(weaponFromGUI); var isUnlocked = weaponFromGUI == defaultWeapon; weaponStatusDictionary.Add(weaponFromGUI, isUnlocked); } UserInfo.Instance.OwnedWeapons = weaponStatusDictionary; weaponary = new Weaponary(); weaponary.Init(weaponList, defaultWeapon); SpawningNewOpponent(); feedButton.onClick.AddListener(FeedEnemy); progressBar.Init(enemyLife); progressBar.ProgressBarEmpty += SpawningNewOpponent; UserInfo.Instance.UserInfoUpdate += RefreshingLocksForAllWeapons; UserInfo.Instance.OwnedWeapons.DictionaryUpdate += RefreshingLocksForAllWeapons; }