private void UpdateMessage() { GetData(turretData.getData(), message); Publish(message); previousRealTime = Time.realtimeSinceStartup; }
void FixedUpdate() { if (isShooting) { if (Time.time - timer >= timeBetweenShots & intakeControl.getNumberBalls() > 0) { timer = Time.time; var x = 0.0f * Mathf.Cos(turretControl.getData()); var z = 0.0f * Mathf.Sin(turretControl.getData()); var newPosition = transform.position; newPosition.x += x; newPosition.z += z; newPosition.y += 0.3f; GameObject instance = (GameObject)Instantiate(prefab, newPosition, transform.rotation); var rigid = instance.GetComponent <Rigidbody>(); rigid.AddForce((shootingAngle.transform.rotation * Vector3.forward) * flywheelControl.getData() * shotForceMult, ForceMode.Impulse); intakeControl.subtractBall(); } } }