ObjectInteraction.Alias C# (CSharp) Method

Alias() public static method

public static Alias ( int id ) : int
id int
return int
    public static int Alias(int id)
    {
        switch(id)
                {
                case 160:
                        return 161;
                case 161:
                        return 160;
                default:
                        return id;
                }
    }

Usage Example

Ejemplo n.º 1
0
    /// <summary>
    /// Begins the combat state of the player. Sets AttackCharging.
    /// Animates the weapon becoming ready.
    /// For ranged weaponry it checks for the weapon ammo.
    /// </summary>
    public override void CombatBegin()
    {
        chargeRate = 10f * (GetWeaponSpeed());

        if (IsMelee())
        {///If melee sets the proper weapon drawn back animation.
            CurrentStrike                   = GetStrikeType();
            CurrentStrikeAnimation          = GetStrikeOffset();
            UWHUD.instance.wpa.SetAnimation = GetWeaponOffset() + CurrentStrikeAnimation + GetHandOffset() + 0; //charge
        }
        else
        {
            ///If ranged check for ammo as defined by the Weapon
            /// If ammo if found give the player a targeting crosshair
            currentAmmo = UWCharacter.Instance.playerInventory.findObjInteractionByID(currWeaponRanged.AmmoType());
            if ((currentAmmo == null) && (ObjectInteraction.Alias(currWeaponRanged.AmmoType()) != currWeaponRanged.AmmoType()))
            {//Ammo type has an alias. try and find that instead.
                currentAmmo = UWCharacter.Instance.playerInventory.findObjInteractionByID(ObjectInteraction.Alias(currWeaponRanged.AmmoType()));
            }
            if (currentAmmo == null)
            {//No ammo.
                UWHUD.instance.MessageScroll.Add("Sorry, you have no " + StringController.instance.GetObjectNounUW(currWeaponRanged.AmmoType()));
                return;
            }
            else
            {
                //Change the crosshair
                UWHUD.instance.CursorIcon = UWHUD.instance.CursorIconTarget;
            }
        }
        ///Starts the counter
        AttackCharging = true;
        Charge         = 0;
    }