// Update is called once per frame void Update() { if (Input.GetButton("Laser") && ready) { charging = true; ready = false; if (Input.GetAxisRaw("Horizontal") == -1) { fireDirection = 4; } if (Input.GetAxisRaw("Horizontal") == 1) { fireDirection = 2; } if (Input.GetAxisRaw("Vertical") == -1) { status.setShootDown(true); fireDirection = 3; } if (Input.GetAxisRaw("Vertical") == 1) { fireDirection = 1; } } else { if (charging) { charging = false; firing = true; } } if (status.getGrounded()) { status.setKnocked(false); ready = true; } }
// Start is called before the first frame update void Start() { status = FindObjectOfType <PlayerStatuses>(); if (status.getShootDown()) { Debug.Log("Inside if statement"); GetComponent <Rigidbody2D>().velocity = transform.right * -laserSpeed; } else if (transform.localScale.x > 0) { GetComponent <Rigidbody2D>().velocity = transform.right * laserSpeed; } else if (transform.localScale.x < 0) { GetComponent <Rigidbody2D>().velocity = transform.right * -laserSpeed; } status.setShootDown(false); }