Beispiel #1
0
        //void OnEnable()
        //{
        //    SceneManager.sceneLoaded += OnSceneLoaded;
        //}
        //void OnSceneLoaded(Scene scene, LoadSceneMode mode)
        //{
        //    enabled = false;
        //    StartCoroutine(ResetEnabled());
        //}
        //void OnDisable()
        //{
        //    SceneManager.sceneLoaded -= OnSceneLoaded;
        //}

        void Start()
        {
            //enabled = false;
            animator       = GetComponent <Animator>();
            spriteRenderer = GetComponent <SpriteRenderer>();

            shaderGUItext        = Shader.Find("GUI/Text Shader");
            shaderSpritesDefault = Shader.Find("Sprites/Default");

            playerPhysics  = transform.parent;
            playerMovement = playerPhysics.GetComponent <PlayerMovement>();
            playerInput    = playerPhysics.GetComponent <PlayerInput>();
            playerStatus   = GetComponent <PlayerStatus>();

            arrowSpawner = arrowSpawnerObject.GetComponent <ArrowSpawner>();

            #region State Instances
            idle            = new IdleState(this);
            crouch          = new CrouchState(this);
            run             = new RunState(this);
            jump            = new JumpState(this);
            fall            = new FallState(this);
            roll            = new RollState(this);
            attack          = new AttackState(this);
            bowAttack       = new BowAttackState(this);
            land            = new LandState(this);
            airAttack       = new AirAttackState(this);
            crouchBowAttack = new CrouchBowAttackState(this);
            airBowAttack    = new AirBowAttackState(this);
            hurt            = new HurtState(this);
            climbLadder     = new ClimbLadderState(this);
            pushBlock       = new PushBlockState(this);
            blownUp         = new BlownUpState(this);
            talking         = new TalkingState(this);
            #endregion

            stateMachine = new PlayerStateMachine(idle);
        }
Beispiel #2
0
 void Start()
 {
     arrowSpawner = transform.parent.GetComponent <ArrowSpawner>();
 }