Example #1
0
    private void Start()
    {
        animator     = GetComponent <Animator>();
        rigidbody2d  = gameObject.GetComponentInParent <Rigidbody2D>();
        boxCollider  = GetComponent <BoxCollider2D>();
        PlayerSprite = GetComponent <SpriteRenderer>();


        state.canInput         = true;
        state.canJump          = true;
        state.canSlide         = true;
        state.canTurn          = true;
        state.canAttackAgain   = true;
        state.isOnGround       = true;
        state.isAttacking      = false;
        state.canBeHurt        = true;
        state.isAlive          = true;
        state.isUnderAttacking = false;

        moveX     = 0;
        SpdMul    = 1f;
        direction = new Vector2(rigidbody2d.transform.localScale.x, 0);

        MyInpulse = GetComponent <Cinemachine.CinemachineCollisionImpulseSource>();

        //初始化生命值系统
        InitHealth();
    }
Example #2
0
 private void Start()
 {
     MyInpulse   = GetComponent <Cinemachine.CinemachineCollisionImpulseSource>();
     audioSource = GetComponent <AudioSource>();
 }
Example #3
0
 protected virtual void Start()
 {
     _movement = GetComponent <Movement>();
     MyInpulse = GetComponent <Cinemachine.CinemachineCollisionImpulseSource>();
     _player   = GetComponent <Player>();
 }