Exemple #1
0
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            Character characterTarget = this.character.GetCharacter(target);

            if (characterTarget == null)
            {
                return(true);
            }

            CharacterAnimator animator = characterTarget.GetCharacterAnimator();

            if (animator == null)
            {
                return(true);
            }

            CharacterAttachments attachments = animator.GetCharacterAttachments();

            if (attachments == null)
            {
                return(true);
            }

            CharacterMelee melee = characterTarget.GetComponent <CharacterMelee>();

            if (melee != null)
            {
                playerMeleeWeapon = characterTarget.GetComponent <PlayerMeleeWeapon>();
                if (playerMeleeWeapon != null)
                {
                    if (this.showEquippedWeapon)
                    {
                        meleeWeapon = playerMeleeWeapon.meleeWeapon;

                        // requires patch to CharacterAttachments.cs
                        attachments.Hide(playerMeleeWeapon.bone);
                    }
                    else
                    {
                        attachments.Show(playerMeleeWeapon.bone);
                    }

                    CoroutinesManager.Instance.StartCoroutine(melee.Draw(meleeWeapon));
                }
                else
                {
                    Debug.LogError("[ActionSetEquippedWeapon] PlayerMeleeWeapon component not added to player", target);
                }
            }

            return(true);
        }
Exemple #2
0
    public PlayerMeleeWeapon GetMeleeWeapon(WeaponPowerupController.GameWeapons weapon)
    {
        PlayerMeleeWeapon selectedWeapon = new PlayerMeleeWeapon();

        foreach (var gameWeapon in meleeWeapons)
        {
            if (gameWeapon.meleeWeapon == weapon)
            {
                selectedWeapon = gameWeapon;
            }
        }

        return(selectedWeapon);
    }
Exemple #3
0
        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            playerMeleeWeapon = target.GetComponent <PlayerMeleeWeapon>();
            if (playerMeleeWeapon != null)
            {
                playerMeleeWeapon.meleeWeapon = this.meleeWeapon;
                playerMeleeWeapon.bone        = this.bone;
            }
            else
            {
                Debug.LogError("[ActionSetEquippedWeapon] PlayerMeleeWeapon component not added to player", target);
            }

            return(true);
        }