예제 #1
0
    // Update is called once per frame
    void Update()
    {
        if (right && left)
        {
            if (contral.GetStatenum() == 1)
            {
                contral.Setstatenum(0);
            }
        }
        else if (left)//输入为左,即为负
        {
            if (contral.GetStatenum() <= 1)
            {
                move.Turn(false);       //向左转向 ,即为负  角色向左走
                contral.Setstatenum(1); //如果不是移动状态设置为移动状态
            }
            if (contral.GetStatenum() <= 2)
            {
                move.moves(false);//如果不是技能状态,就可以移动    但是此状态下无法转向
            }
        }
        else if (right)//输入为右,即为正  角色向右走
        {
            if (contral.GetStatenum() <= 1)
            {
                move.Turn(true);        //向右转向
                contral.Setstatenum(1); //如果不是移动状态设置为移动状态
            }
            if (contral.GetStatenum() <= 2)
            {
                move.moves(true);//如果不是技能状态,就可以移动    但是此状态下无法转向
            }
        }
        else //停止状态
        {
            if (contral.GetStatenum() == 1)
            {
                contral.Setstatenum(0);
            }
        }

        right = false;
        left  = false;
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        if (dashes > 0)
        {
            dashes -= Time.deltaTime;

            if (right)
            {
                movenospeed(speed * Time.deltaTime, 0, transform);
            }
            else
            {
                movenospeed(-speed * Time.deltaTime, 0, transform);
            }


            if (dashes < 0)
            {
                contral.Setstatenum(1);
                animator.SetBool("dashing", false);
            }
        }
    }
예제 #3
0
    public void dash(Charactercontral a)
    {//冲刺
        Heathscrips health = gameObject.GetComponent <Heathscrips>();

        if (a.GetStatenum() < 2 && (health == null || health.cando()))
        {
            animator.SetBool("dashing", true);
            move.setX(0);
            move.setY(0);
            contral = a;
            dashes  = dashtime;     //dash的时间设置为dashtime
            contral.Setstatenum(3); //技能状态
            right = move.Turn();


            if (health != null)
            {
                health.consumeqi(6);
            }
        }
    }