Ejemplo n.º 1
0
    public void InitializeWeaponSocket(WeaponHandSocket socketType, WeaponData weaponData)
    {
        Transform socket = socketType == WeaponHandSocket.Left ? leftHandSocket : rightHandSocket;

        if (weaponData.Weapon != null)
        {
            Weapon weapon = Instantiate(weaponData.Weapon) as Weapon;
            weapon.transform.SetParent(socket, false);
            weapon.ignoredlayers = 1 << gameObject.layer;

            if (socketType == WeaponHandSocket.Left)
            {
                leftHandWeaponInstance = weapon;
            }
            else
            {
                rightHandWeaponInstance = weapon;
            }

            if (onWeaponsChanged != null)
            {
                onWeaponsChanged.Invoke();
            }
        }
        else
        {
            Debug.LogWarning("No weapon defined for " + weaponData.name);
        }
    }
Ejemplo n.º 2
0
    public void ClearWeaponSocket(WeaponHandSocket socketType)
    {
        Transform socket = socketType == WeaponHandSocket.Left ? leftHandSocket : rightHandSocket;

        foreach (Transform t in socket)
        {
            Destroy(t.gameObject);
        }

        if (socketType == WeaponHandSocket.Left)
        {
            if (leftHandWeaponInstance != null)
            {
                Destroy(leftHandWeaponInstance.gameObject);
            }
            leftHandWeaponInstance = null;
        }
        else
        {
            if (rightHandWeaponInstance != null)
            {
                Destroy(rightHandWeaponInstance.gameObject);
            }
            rightHandWeaponInstance = null;
        }
    }
Ejemplo n.º 3
0
    public void EndSecondaryAttack(WeaponHandSocket side)
    {
        Weapon winstance = side == WeaponHandSocket.Left ? arsenal.LeftHandWeaponInstance : arsenal.RightHandWeaponInstance;

        if (winstance != null)
        {
            winstance.EndSecondaryAttack();
        }
    }
Ejemplo n.º 4
0
    public void BeginPrincipalAttack(WeaponHandSocket side)
    {
        Weapon winstance = side == WeaponHandSocket.Left ? arsenal.LeftHandWeaponInstance : arsenal.RightHandWeaponInstance;

        if (winstance != null)
        {
            winstance.BeginAttack();
        }
    }
Ejemplo n.º 5
0
    public void DrawWeapon(WeaponHandSocket side)
    {
        Weapon winstance;

        if (side == WeaponHandSocket.Right)
        {
            winstance = arsenal.RightHandWeaponInstance;
            if (winstance != null && arsenal.rightHandSocket != null)
            {
                winstance.transform.SetParent(arsenal.rightHandSocket, false);
            }
        }
        else
        {
            winstance = arsenal.LeftHandWeaponInstance;
            if (winstance != null && arsenal.leftHandSocket != null)
            {
                winstance.transform.SetParent(arsenal.leftHandSocket, false);
            }
        }
    }
Ejemplo n.º 6
0
    public void SheatWeapon(WeaponHandSocket side)
    {
        Weapon winstance;

        if (side == WeaponHandSocket.Right)
        {
            winstance = arsenal.RightHandWeaponInstance;
            if (winstance != null && weaponSheat != null)
            {
                winstance.transform.SetParent(weaponSheat, false);
            }
        }
        else
        {
            winstance = arsenal.LeftHandWeaponInstance;
            if (winstance != null && weaponSheat != null)
            {
                winstance.transform.SetParent(weaponSheat, false);
            }
        }
    }