Exemplo n.º 1
0
    public virtual void Start()
    {
        if (wpnHand == null)
        {
            Debug.Log(gameObject.name + " has no defined weapn hand even though it is a Combatant.");
            return;
        }

        // Load last equipped weapon (or default)
        int wpnCode = PlayerPrefs.GetInt(saveName + WeaponItem.WpnTag, defaultWeapon.GetHashCode());

        curWeapon = Inventory.Get_At(wpnCode) as WeaponItem;
        try
        {
            curWeapon.Equip(wpnHand);
        }
        catch (System.NullReferenceException)
        {
            Debug.Log(gameObject.name + " could not equip item");
        }

        exp = PlayerPrefs.GetInt(saveName + EXP_TAG, 0);
        Enemy.OnEnemyDiedHandler += OnEnemyDied;
    }