コード例 #1
0
 public override void HandleCollectableInput(vCollectableStandalone collectableStandAlone)
 {
     if (isLocalPlayer)
     {
         CmdHandleCollectableInput(collectableStandAlone.weapon);
     }
 }
コード例 #2
0
    public override void HandleCollectableInput(vCollectableStandalone collectableStandAlone)
    {
        if (shooterManager && collectableStandAlone != null && collectableStandAlone.weapon != null)
        {
            var weapon = collectableStandAlone.weapon.GetComponent <vShooterWeapon>();
            if (weapon)
            {
                var p = GetEquipPoint(rightHandler, collectableStandAlone.targetEquipPoint);
                if (p)
                {
                    collectableStandAlone.weapon.transform.SetParent(p);
                    collectableStandAlone.weapon.transform.localPosition    = Vector3.zero;
                    collectableStandAlone.weapon.transform.localEulerAngles = Vector3.zero;
                    if (rightWeapon && rightWeapon != weapon.gameObject)
                    {
                        RemoveRightWeapon();
                    }
                    shooterManager.SetRightWeapon(weapon.gameObject);
                    collectableStandAlone.OnEquip.Invoke();
                    rightWeapon = weapon.gameObject;
                    UpdateRightDisplay(collectableStandAlone);
                    if (leftWeapon)
                    {
                        RemoveLeftWeapon();
                    }
                }
            }
        }

        base.HandleCollectableInput(collectableStandAlone);
    }
コード例 #3
0
 public override void HandleCollectableInput(vCollectableStandalone collectableStandAlone)
 {
     if (shooterManager && collectableStandAlone != null && collectableStandAlone.weapon != null)
     {
         EquipShooterWeapon(collectableStandAlone);
     }
     base.HandleCollectableInput(collectableStandAlone);
 }
コード例 #4
0
        protected virtual void EquipMeleeWeapon(vCollectableStandalone collectable)
        {
            var weapon = collectable.weapon.GetComponent <vMeleeWeapon>();

            if (!weapon)
            {
                return;
            }

            if (weapon.meleeType != vMeleeType.OnlyDefense)
            {
                var p = GetEquipPoint(rightHandler, collectable.targetEquipPoint);
                if (!p)
                {
                    return;
                }
                collectable.weapon.transform.SetParent(p);
                collectable.weapon.transform.localPosition    = Vector3.zero;
                collectable.weapon.transform.localEulerAngles = Vector3.zero;
                if (rightWeapon && rightWeapon.gameObject != collectable.gameObject)
                {
                    RemoveRightWeapon();
                }
                if (collectable.twoHandWeapon || leftWeapon && leftWeapon.twoHandWeapon)
                {
                    RemoveLeftWeapon();
                }
                meleeManager.SetRightWeapon(weapon.gameObject);
                collectable.OnEquip.Invoke();
                rightWeapon = collectable;

                UpdateRightDisplay(collectable);
            }
            if (weapon.meleeType != vMeleeType.OnlyAttack && weapon.meleeType != vMeleeType.AttackAndDefense)
            {
                var p = GetEquipPoint(leftHandler, collectable.targetEquipPoint);
                if (!p)
                {
                    return;
                }
                collectable.weapon.transform.SetParent(p);
                collectable.weapon.transform.localPosition    = Vector3.zero;
                collectable.weapon.transform.localEulerAngles = Vector3.zero;
                if (leftWeapon && leftWeapon.gameObject != collectable.gameObject)
                {
                    RemoveLeftWeapon();
                }
                if (collectable.twoHandWeapon || rightWeapon && rightWeapon.twoHandWeapon)
                {
                    RemoveRightWeapon();
                }
                meleeManager.SetLeftWeapon(weapon.gameObject);
                collectable.OnEquip.Invoke();
                leftWeapon = collectable;
                UpdateLeftDisplay(collectable);
            }
        }
コード例 #5
0
 public virtual void HandleCollectableInput(vCollectableStandalone collectableStandAlone)
 {
     if (!meleeManager)
     {
         return;
     }
     if (collectableStandAlone != null && collectableStandAlone.weapon != null)
     {
         EquipMeleeWeapon(collectableStandAlone);
     }
 }
コード例 #6
0
        /// <summary>
        /// Condition to drop the shooter weapon when equipping a shield
        /// </summary>
        /// <param name="collectableStandAlone"></param>
        private void RemoveShooterWeaponWhenEquippingDefense(vCollectableStandalone collectableStandAlone)
        {
            var meleeWeapon = collectableStandAlone.weapon.GetComponent <vMeleeWeapon>();

            if (!meleeWeapon)
            {
                return;
            }
            if (meleeWeapon.meleeType == vMeleeType.OnlyDefense)
            {
                if (shooterManager.CurrentWeapon)
                {
                    RemoveRightWeapon();
                }
            }
        }
コード例 #7
0
ファイル: vCollectMeleeControl.cs プロジェクト: kelz67/ZORO
 protected virtual void UpdateRightDisplay(vCollectableStandalone collectable = null)
 {
     if (!currentDisplay)
     {
         return;
     }
     if (collectable)
     {
         currentDisplay.SetRightWeaponIcon(collectable.weaponIcon);
         currentDisplay.SetRightWeaponText(collectable.weaponText);
     }
     else
     {
         currentDisplay.RemoveRightWeaponIcon();
         currentDisplay.RemoveRightWeaponText();
     }
 }
コード例 #8
0
    IEnumerator DelayedEquip(float delay)
    {
        yield return(new WaitForSeconds(delay));

        if (rootBone.childCount > 0)
        {
            GameObject weapon = rootBone.GetChild(0).gameObject;
            if (weapon != null && weapon.tag == "Weapon")
            {
                vCollectableStandalone collectable = weapon.GetComponentInChildren <vCollectableStandalone>();
                equippedWeaponType = weapon.GetComponent <WeaponType>().GetWeaponType();
                meleeControl.HandleCollectableInput(collectable);
            }
            else
            {
                // Unarmed Deals Damage
                equippedWeaponType = FarmWeaponType.Damage;
            }
        }
    }
コード例 #9
0
    public GameObject SetItem(int weaponViewId, EquipSide side, GameObject calledFrom)
    {
        PhotonView weapon = null;

        if (weaponViewId != -1)
        {
            weapon = PhotonNetwork.GetPhotonView(weaponViewId);

            if (weapon)
            {
                vCollectableStandalone collectableStandalone = weapon.GetComponentInChildren <vCollectableStandalone>();
                if (collectableStandalone != null)
                {
                    if (collectableStandalone.targetEquipPoint != "")
                    {
                        if (!customHandlers.Contains(collectableStandalone.targetEquipPoint))
                        {
                            customHandlers.Add(collectableStandalone.targetEquipPoint);
                        }
                    }
                }

                if (weapon.GetComponent <vShooterWeapon>())
                {
                    SetWeapon(weapon.gameObject, calledFrom, side, WeaponType.shooter, collectableStandalone.targetEquipPoint);
                }
                else
                {
                    SetWeapon(weapon.gameObject, calledFrom, side, WeaponType.melee, collectableStandalone.targetEquipPoint);
                }
                return(weapon.gameObject);
            }
        }

        return(null);
    }
コード例 #10
0
        protected override void InternalHandleCollectableInput(vCollectableStandalone collectableStandAlone)
        {
            if (shooterManager && collectableStandAlone != null && collectableStandAlone.weapon != null)
            {
                var weapon = collectableStandAlone.weapon.GetComponent <vShooterWeapon>();
                if (weapon)
                {
                    Transform p = null;
                    if (weapon.isLeftWeapon)
                    {
                        p = GetEquipPoint(leftHandler, collectableStandAlone.targetEquipPoint);
                        if (p)
                        {
                            collectableStandAlone.weapon.transform.SetParent(p);
                            collectableStandAlone.weapon.transform.localPosition    = Vector3.zero;
                            collectableStandAlone.weapon.transform.localEulerAngles = Vector3.zero;

                            if (leftWeapon && leftWeapon != weapon.gameObject)
                            {
                                RemoveLeftWeapon();
                            }

                            shooterManager.SetLeftWeapon(weapon.gameObject);
                            collectableStandAlone.OnEquip.Invoke();

                            if (isServer)
                            {
                                SetAuthority(collectableStandAlone.weapon.GetComponent <NetworkIdentity>(), gameObject.GetComponent <NetworkIdentity>());
                            }

                            leftWeapon = weapon.gameObject;
                            UpdateLeftDisplay(collectableStandAlone);

                            if (rightWeapon)
                            {
                                RemoveRightWeapon();
                            }
                        }
                        else
                        {
                            throw new System.Exception("Invalid equipment point");
                        }
                    }
                    else
                    {
                        p = GetEquipPoint(rightHandler, collectableStandAlone.targetEquipPoint);
                        if (p)
                        {
                            collectableStandAlone.weapon.transform.SetParent(p);
                            collectableStandAlone.weapon.transform.localPosition    = Vector3.zero;
                            collectableStandAlone.weapon.transform.localEulerAngles = Vector3.zero;

                            if (rightWeapon && rightWeapon != weapon.gameObject)
                            {
                                RemoveRightWeapon();
                            }

                            shooterManager.SetRightWeapon(weapon.gameObject);
                            collectableStandAlone.OnEquip.Invoke();

                            if (isServer)
                            {
                                SetAuthority(collectableStandAlone.weapon.GetComponent <NetworkIdentity>(), gameObject.GetComponent <NetworkIdentity>());
                            }

                            rightWeapon = weapon.gameObject;
                            UpdateRightDisplay(collectableStandAlone);

                            if (leftWeapon)
                            {
                                RemoveLeftWeapon();
                            }
                        }
                        else
                        {
                            throw new System.Exception("Invalid equipment point");
                        }
                    }
                }
                else
                {
                    throw new System.Exception("Invalid collectable");
                }
            }
            else
            {
                throw new System.Exception("Invalid collectable");
            }

            base.InternalHandleCollectableInput(collectableStandAlone);
        }
コード例 #11
0
 public virtual void HandleCollectableInput(vCollectableStandalone collectableStandAlone)
 {
 }
コード例 #12
0
        protected virtual void EquipShooterWeapon(vCollectableStandalone collectable)
        {
            var weapon = collectable.weapon.GetComponent <vShooterWeapon>();

            if (!weapon)
            {
                return;
            }
            Transform p = null;

            if (weapon.isLeftWeapon)
            {
                p = GetEquipPoint(leftHandler, collectable.targetEquipPoint);
                if (p)
                {
                    collectable.weapon.transform.SetParent(p);
                    collectable.weapon.transform.localPosition    = Vector3.zero;
                    collectable.weapon.transform.localEulerAngles = Vector3.zero;

                    if (leftWeapon && leftWeapon.gameObject != collectable.gameObject)
                    {
                        RemoveLeftWeapon();
                    }

                    shooterManager.SetLeftWeapon(weapon.gameObject);
                    collectable.OnEquip.Invoke();
                    leftWeapon = collectable;
                    UpdateLeftDisplay(collectable);

                    if (rightWeapon)
                    {
                        RemoveRightWeapon();
                    }
                }
            }
            else
            {
                p = GetEquipPoint(rightHandler, collectable.targetEquipPoint);
                if (p)
                {
                    collectable.weapon.transform.SetParent(p);
                    collectable.weapon.transform.localPosition    = Vector3.zero;
                    collectable.weapon.transform.localEulerAngles = Vector3.zero;

                    if (rightWeapon && rightWeapon.gameObject != collectable.gameObject)
                    {
                        RemoveRightWeapon();
                    }

                    shooterManager.SetRightWeapon(weapon.gameObject);
                    collectable.OnEquip.Invoke();
                    rightWeapon = collectable;
                    UpdateRightDisplay(collectable);

                    if (leftWeapon)
                    {
                        RemoveLeftWeapon();
                    }
                }
            }
        }