예제 #1
0
        //common
        private IEnumerator AttackSequence()
        {
            Vector2 lookDir = (CameraReference.Instance.camera.ScreenToWorldPoint(Input.mousePosition) - Player.Instance.gameObject.transform.position).normalized;

            Animator anim = Player.Instance.GetComponent <Animator>();

            anim.SetTrigger("Attack");
            if (comboReset.IsReady)
            {
                anim.SetInteger("Combo", 0);
            }
            else if (anim.GetInteger("Combo") == 0)
            {
                anim.SetInteger("Combo", 1);
            }
            else
            {
                anim.SetInteger("Combo", 0);
            }
            comboReset.Use(1f);
            anim.SetFloat("xInput", lookDir.x);
            anim.SetFloat("yInput", lookDir.y);

            Path lungePath = LinePath(lungeConverter, lookDir);

            Player.Instance.playerMove.SetPath(Boomerang.Mult(Player.Instance.playerMove.defaultSpeed, lungePath), .25f);

            yield return(new WaitForSeconds(.1f));

            HitScan();
            yield return(new WaitForSeconds(.1f));

            HitScan();
        }
예제 #2
0
    void Update()
    {
        //pause guard
        if (PauseController.Paused)
        {
            return;
        }

        xAxis = Input.GetAxis("Horizontal");
        yAxis = Input.GetAxis("Vertical");
        dodge = Input.GetButtonDown("Jump");

        //Check Raw inputs, keyboard only
        xAxisRaw = Input.GetAxisRaw("Horizontal");
        yAxisRaw = Input.GetAxisRaw("Vertical");

        if (dodge && jumpCooldown.IsReady)
        {
            //Store last control input for anim facing dir
            if (xAxisRaw != 0 || yAxisRaw != 0)
            {
                anim.SetFloat("xInput", xAxisRaw);
                anim.SetFloat("yInput", yAxisRaw);
                facingDir.Set(xAxisRaw, yAxisRaw);
            }

            SetPath(Boomerang.Mult(defaultSpeed * diveCoef, RollPath(facingDir.normalized)), diveDur);
            player.damageInvuln.Use();
            jumpCooldown.Use();

            //Anim parameter updates
            anim.SetTrigger("Dodge");
        }
        //Set looking vals
        Vector2 lookDir = (CameraReference.Instance.camera.ScreenToWorldPoint(Input.mousePosition) - Player.Instance.gameObject.transform.position).normalized;

        anim.SetFloat("aimX", lookDir.x);
        anim.SetFloat("aimY", lookDir.y);
    }