Example #1
0
    private void FixedUpdate()
    {
        if (pcMovement)

        {
            moveInputX        = Input.GetAxisRaw("Horizontal");
            moveInputY        = Input.GetAxisRaw("Vertical");
            movementDirection = new Vector2(moveInputX, moveInputY);
            movementDirection.Normalize();
            rb.velocity = movementDirection * speed;
        }
        if (Input.GetKeyDown(KeyCode.LeftShift))
        {
            DashingAbility();
        }
        if (Input.GetKeyDown(KeyCode.F))
        {
            StartCoroutine(chainLightning.ChainLightningSkill());
        }
        // Debug.Log(rb.velocity.magnitude);

        /* if (Input.GetKey(KeyCode.D))
         * { rb.velocity += Vector2.right * speed * Time.deltaTime; }
         * if (Input.GetKey(KeyCode.A)) {
         *
         *   rb.velocity += -Vector2.right * speed * Time.deltaTime;
         * }
         * if (Input.GetKey(KeyCode.W))
         * {
         *
         *   rb.velocity += Vector2.up * speed * Time.deltaTime;
         * }
         * if (Input.GetKey(KeyCode.S))
         * {
         *
         *   rb.velocity += Vector2.down * speed * Time.deltaTime;
         * }*/

        //rb.velocity = new Vector2(Mathf.Clamp(rb.velocity.x, -speed, speed), Mathf.Clamp(rb.velocity.y, -speed, speed));
    }
Example #2
0
 public void ChainLightning()
 {
     this.StartCoroutine(chainLightning.ChainLightningSkill());
     skillManager.skills[2].isReady         = false;
     skillManager.skills[2].currentCoolDown = 0;
 }