コード例 #1
0
    //TODO make this a method of Item
    private static void EvaluateAnimWeaponID()
    {
        int      swordID = ItemID.GetID <Sword>().ID;
        int      bowID   = ItemID.GetID <Bow>().ID;
        Animator anim    = GameObject.FindGameObjectWithTag("Player").GetComponent <Animator>();

        int weaponID = ItemID.GetID(CurrentWeapon);

        if (anim != null && Instance.currentWepID != weaponID)
        {
            if (weaponID == swordID)
            {
                anim.runtimeAnimatorController = Resources.Load("Player/Animations/Player Sword Anim Controller") as RuntimeAnimatorController;
            }
            else if (weaponID == bowID)
            {
                anim.runtimeAnimatorController = Resources.Load("Player/Animations/Player Bow Anim Controller") as RuntimeAnimatorController;
            }
            else
            {
                anim.runtimeAnimatorController = Resources.Load("Player/Animations/Player Anim Controller") as RuntimeAnimatorController;
            }
        }
        Instance.currentWepID = ItemID.GetID(CurrentWeapon.GetType());
    }