Пример #1
0
    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;
        }
    }
Пример #2
0
 public void SetTargetDelta(Tanks.Target targetDelta)
 {
     if (ActiveTankManager())
     {
         ActiveTankManager().SetTargetDelta(targetDelta);
     }
 }
Пример #3
0
 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);
 }
Пример #4
0
 public void ApplyTargetDelta()
 {
     target     += targetDelta;
     targetDelta = new Tanks.Target(0f, 0f, 0f);
 }
Пример #5
0
 public void AddTargetDelta(Tanks.Target newTargetDelta)
 {
     targetDelta += newTargetDelta;
     DisplayTargetOnUI();
 }
Пример #6
0
 public void SetTargetDelta(Tanks.Target newTargetDelta)
 {
     targetDelta = newTargetDelta;
     DisplayTargetOnUI();
 }
Пример #7
0
 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");
 }