示例#1
0
 void Update()
 {
     Dead();
     myController.OnUpdate();
     if (myCurrentStrategy != null)
     {
         myCurrentStrategy.Advance();
     }
 }
示例#2
0
    void Update()
    {
        //Movimiento
        if (_movementType != null)
        {
            _movementType.Advance();
        }

        //Lifetime
        _timeToDie -= Time.deltaTime;

        if (_timeToDie <= 0)
        {
            BulletSpawner.Instance.ReturnBullet(this);
        }
    }
示例#3
0
    void Update()
    {
        if (Input.GetButtonDown("Jump") && isJumping == false)
        {
            currentState = jump;
            isJumping    = true;
            isWalking    = false;
            ground       = 1;
        }
        else
        if (Input.GetAxis("Vertical") != 0 && Input.GetKey(KeyCode.LeftShift) ||
            Input.GetAxis("Horizontal") != 0 && Input.GetKey(KeyCode.LeftShift))
        {
            isWalking    = true;
            currentState = run;
        }
        else
        if (Input.GetAxis("Vertical") != 0 || Input.GetAxis("Horizontal") != 0)
        {
            isWalking    = true;
            currentState = walk;
        }
        else
        {
            isWalking    = false;
            currentState = null;
        }


        if (currentState != null)
        {
            currentState.Advance();
        }


        if (isGrounded)
        {
            Grounding();
        }
        else
        {
            isWalking = true;
        }
    }