Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        mouse_pos    = Input.mousePosition;
        object_pos   = Camera.main.WorldToScreenPoint(transform.position);
        mouse_pos.x -= object_pos.x;
        mouse_pos.y -= object_pos.y;

        angle = Mathf.Atan2(mouse_pos.y, mouse_pos.x) * Mathf.Rad2Deg - 90;

        transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));

        if (Input.GetButton("Fire1"))
        {
            fireBehavior.Fire(gun);
        }

        time = Time.time;

        if (Input.GetKeyDown(KeyCode.LeftShift) && time > dashCoolDownEndTime)
        {
            impulse.GenerateImpulse();
            dashEndTime         = time + dashTime;
            dashCoolDownEndTime = time + dashCoolDownTime;
        }
    }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     fireBehavior.Fire(gun);
 }