Exemplo n.º 1
0
        /// <summary>
        /// Gets and stores components for further use
        /// </summary>
        protected virtual void Initialization()
        {
            _character              = GetComponent <Character>();
            _controller             = GetComponent <CoreController>();
            _characterBasicMovement = GetComponent <CharacterHorizontalMovement>();
            //_characterGravity = GetComponent<CharacterGravity> ();
            _spriteRenderer = GetComponent <SpriteRenderer>();
            //_health = GetComponent<Health> ();
            _animator = _character._animator;
            //_sceneCamera = _character.SceneCamera;
            _inputManager       = _character.LinkedInputManager;
            _state              = _character.CharacterState;
            _movement           = _character.MovementState;
            _condition          = _character.ConditionState;
            _abilityInitialized = true;
            if (_animator != null)
            {
                InitializeAnimatorParameters();
            }

            if (_character._userProfiler != null)
            {
                _userProfiler = _character._userProfiler;
            }
        }
Exemplo n.º 2
0
    protected virtual void Initialization()
    {
        MovementState = new InfStateMachine <CharacterStates.MovementStates>(gameObject, SendStateChangeEvents);
        // returns enum as "Walking", "Idle" etc.
        ConditionState = new InfStateMachine <CharacterStates.CharacterConditions>(gameObject, SendStateChangeEvents);


        if (InitialFacingDirection == CharacterStates.FacingDirections.Left)
        {
            IsFacingRight = false;
        }
        else
        {
            IsFacingRight = true;
        }

        // we get the current input manager
        GetInputManager();
        getProfiler();
        //// we get the main camera
        //if (Camera.main == null) { return; }
        //SceneCamera = Camera.main.GetComponent<CameraController>();
        // we store our components for further use
        CharacterState      = new CharacterStates();
        _spriteRenderer     = GetComponent <SpriteRenderer>();
        _controller         = GetComponent <CoreController>();
        _characterAbilities = GetComponents <CharacterAbility>();
        //_aiBrain = GetComponent<AIBrain>();
        //_health = GetComponent<Health>();
        //_damageOnTouch = GetComponent<DamageOnTouch>();
        mGuiWriter = GetComponent <GUI_Writer>();

        if (CharacterAnimator != null)
        {
            _animator = CharacterAnimator;
        }
        else
        {
            _animator = GetComponent <Animator>();
        }

        if (_animator != null)
        {
            InitializeAnimatorParameters();
        }

        //_originalGravity = _controller.Parameters.Gravity;

        ForceSpawnDirection();
    }
Exemplo n.º 3
0
        /// <summary>
        /// Initialize this weapon.
        /// </summary>
        public virtual void Initialization()
        {
            Flipped         = false;
            _spriteRenderer = this.gameObject.GetComponent <SpriteRenderer> ();
            _comboWeapon    = this.gameObject.GetComponent <ComboWeapon>();


            SetParticleEffects(false);
            WeaponState = new InfStateMachine <WeaponStates>(gameObject, true);
            WeaponState.ChangeState(WeaponStates.WeaponIdle);
            WeaponAmmo          = GetComponent <WeaponAmmo> ();
            _animatorParameters = new List <List <string> >();
            _aimableWeapon      = GetComponent <WeaponAim>();
            InitializeAnimatorParameters();
            if (WeaponAmmo == null)
            {
                CurrentAmmoLoaded = MagazineSize;
            }
        }