Пример #1
0
        private void Awake()
        {
            Animator = GetComponent <Animator>();

            SmbLoco = Animator.GetBehaviour <LocomotionCSMB>();

            SmbWeapon = Animator.GetBehaviour <WeaponCSMB>();

            SmbLookIK = Animator.GetBehaviour <LookIKCSMB>();

            SmbCover         = Animator.GetBehaviour <CoverCSMB>();
            SmbThrow         = Animator.GetBehaviour <ThrowCSMB>();
            SmbGroundedCheck = Animator.GetBehaviour <GroundedCheckSMB>();

            footSoundFx = new FootPlanting(footStepFx, GetComponent <Animator>());
            health      = GetComponent <Health>();

            playerPhysic = new PlayerPhysics(GetComponent <Rigidbody>(), this);
        }
Пример #2
0
        private void Awake()
        {
            _transform = transform;
            _rigidbody = GetComponent <Rigidbody>();
            _animator  = GetComponentInChildren <Animator>();

            ParticleSystem[] particleSystems = GetComponentsInChildren <ParticleSystem>();
            _contactParticles = particleSystems.First(x => x.name == "Contact Particles");
            _waterParticles   = particleSystems.First(x => x.name == "Water Particles");
            _dirtParticles    = particleSystems.First(x => x.name == "Dirt Particles");

            _hammer      = GetComponentsInChildren <Transform>().First(x => x.name == "Hammer Container").transform;
            _pickaxe     = GetComponentsInChildren <Transform>().First(x => x.name == "Pickaxe Container").transform;
            _wateringCan = GetComponentsInChildren <Transform>().First(x => x.name == "Can Container").transform;

            _animator.GetBehaviour <PlayerIdleEvent>().EnteredStateCallback += HandleEnterIdleAnimation;

            GetComponentInChildren <ProximityDetector>().EnteredProximity          += HandleProximityStateChange;
            GetComponentInChildren <AnimationEventListener>().NotifyAnimationEvent += HandleAnimationEvent;

            FindObjectOfType <GameController>().RegisterScriptToSuspendWhenGameEnds(this);
            FindObjectsOfType <PlayerMovement>().First(x => x != this).SwapTools += HandleToolSwap;
        }