Наследование: MonoBehaviour
Пример #1
0
 // Start is called before the first frame update
 public virtual void Start()
 {
     characterGrab        = GetComponentInChildren <CharacterGrab>();
     characterMelee       = GetComponentInChildren <CharacterMelee>();
     characterJump        = GetComponentInChildren <CharacterJump>();
     characterLadderClimb = GetComponentInChildren <CharacterLadderClimb>();
     characterLedgeGrab   = GetComponentInChildren <CharacterLedgeGrab>();
     characterMove        = GetComponentInChildren <CharacterMovement>();
     characterState       = GetComponent <CharacterState>();
 }
Пример #2
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);
        }