void PublishControlDeltas() { if (controlMode == ControlMode.None) { return; } Vector3 mouseDelta = Input.mousePosition - initialMousePosition; switch (controlMode) { case ControlMode.Rotation: float rotation = mouseDelta.x / 10f; float angle = mouseDelta.y / 10f; var rotationTargetDelta = new Tanks.Target(rotation, angle, 0f); LevelManager.instance.SetTargetDelta(rotationTargetDelta); break; case ControlMode.Power: float power = (mouseDelta.x + mouseDelta.y) / 100f; var powerTargetDelta = new Tanks.Target(0f, 0f, power); LevelManager.instance.SetTargetDelta(powerTargetDelta); break; } }
public void SetTargetDelta(Tanks.Target targetDelta) { if (ActiveTankManager()) { ActiveTankManager().SetTargetDelta(targetDelta); } }
public void DestroyTank() { Destroy(tank); tank = null; tankBarrel = null; tankMarker = null; projectileSpawnPoint = null; fireLocked = false; target = new Tanks.Target(0f, 0f, 0f); targetDelta = new Tanks.Target(0f, 0f, 0f); }
public void ApplyTargetDelta() { target += targetDelta; targetDelta = new Tanks.Target(0f, 0f, 0f); }
public void AddTargetDelta(Tanks.Target newTargetDelta) { targetDelta += newTargetDelta; DisplayTargetOnUI(); }
public void SetTargetDelta(Tanks.Target newTargetDelta) { targetDelta = newTargetDelta; DisplayTargetOnUI(); }
public void DisplayTarget(Tanks.Target target) { rotationValue.text = target.rotation.ToString("0.0"); angleValue.text = target.angle.ToString("0.0"); powerValue.text = target.power.ToString("0.000"); }