Inheritance: GameItem
Exemple #1
0
 public AnimationClip[] GetMountedAnimationClip(ref WeaponItem weapon, ref SecondItem second, ref ShieldItem shield, ref BodyItem body, ref HeadItem head, ref BackpackItem backpack)
 {
     if (weapon.type != WeaponItem.Type.None && weapon.animationCode == 5)
     {
         return(mountedSpearConfiguration);
     }
     else if (second.type != SecondItem.Type.None && second.animationCode == 2)
     {
         return(mountedArcheryConfiguration);
     }
     else if (weapon.type != WeaponItem.Type.None && weapon.animationCode == 3)
     {
         return(mountedCrossbowConfiguration);
     }
     else
     {
         return(mountedDefaultConfiguration);
     }
 }
Exemple #2
0
 // Get animation configuration regarding of the equipement
 public AnimationClip[] GetAnimationClip(ref WeaponItem weapon, ref SecondItem second, ref ShieldItem shield, ref BodyItem body, ref HeadItem head, ref BackpackItem backpack)
 {
     if (weapon.type != WeaponItem.Type.None && weapon.animationCode == 5)
     {
         return(spearConfiguration);
     }
     else if (second.type != SecondItem.Type.None && second.animationCode == 2)
     {
         return(archeryConfiguration);
     }
     else if (weapon.type != WeaponItem.Type.None && weapon.animationCode == 3)
     {
         return(crossbowConfiguration);
     }
     else if (shield.type != ShieldItem.Type.None)
     {
         return(shieldedConfiguration);
     }
     else if (weapon.type != WeaponItem.Type.None && weapon.animationCode == 4)
     {
         return(twoHandedConfiguration);
     }
     else if (weapon.type != WeaponItem.Type.None && second.animationCode == 6)
     {
         return(staffConfiguration);
     }
     else if (weapon.type != WeaponItem.Type.None && weapon.animationCode == 7)
     {
         return(polearmConfiguration);
     }
     else
     {
         return(defaultConfiguration);
     }
 }
Exemple #3
0
 //Sets current HeadItem 'helmet'
 public void SetHelmet(HeadItem helmet)
 {
     this.helmet = helmet;
 }
Exemple #4
0
    private bool Equip(InteractionType.Type type, GameObject interactor)
    {
        bool success = false;

        if (type == InteractionType.Type.pickableWeapon)
        {
            WeaponItem item = interactor.GetComponent <WeaponItem>();
            if (item && weapon.Equip(item.type))
            {
                if (item.forbidSecond || secondHand.equipedItem.forbidWeapon)
                {
                    secondHand.Equip(SecondItem.Type.None);
                }
                if (item.forbidShield)
                {
                    shield.Equip(ShieldItem.Type.None);
                }
                success = true;
            }
        }
        else if (type == InteractionType.Type.pickableBackpack)
        {
            BackpackItem item = interactor.GetComponent <BackpackItem>();
            if (item && backpack.Equip(item.type))
            {
                success = true;
            }
        }
        else if (type == InteractionType.Type.pickableHead)
        {
            HeadItem item = interactor.GetComponent <HeadItem>();
            if (item && head.Equip(item.type))
            {
                success = true;
            }
        }
        else if (type == InteractionType.Type.pickableSecond)
        {
            SecondItem item = interactor.GetComponent <SecondItem>();
            if (item && secondHand.Equip(item.type))
            {
                if (item.forbidWeapon || weapon.equipedItem.forbidSecond)
                {
                    weapon.Equip(WeaponItem.Type.None);
                }
                if (item.forbidShield)
                {
                    shield.Equip(ShieldItem.Type.None);
                }
                success = true;
            }
        }
        else if (type == InteractionType.Type.pickableShield)
        {
            ShieldItem item = interactor.GetComponent <ShieldItem>();
            if (item && shield.Equip(item.type))
            {
                if (weapon.equipedItem.forbidShield)
                {
                    weapon.Equip(WeaponItem.Type.None);
                }
                if (secondHand.equipedItem.forbidShield)
                {
                    secondHand.Equip(SecondItem.Type.None);
                }
                success = true;
            }
        }
        else if (type == InteractionType.Type.pickableBody)
        {
            bool     mounted = horse ? horse.equipedItem.type != HorseItem.Type.None : false;
            BodyItem item    = interactor.GetComponent <BodyItem>();
            if (item && body.Equip(item.type, mounted))
            {
                success = true;
            }
        }
        else
        {
            Debug.LogWarning("no interaction defined for this type " + type.ToString());
            return(false);
        }
        return(success);
    }
Exemple #5
0
 public float GetArmor(HeadItem alternative)
 {
     return(alternative.armor + body.equipedItem.armor + shield.equipedItem.armor + (horse ? horse.equipedItem.armor : 0));
 }