Пример #1
0
 public void Fire()
 {
     foreach (var cannon in _cannons)
     {
         if (_fuelTank.Remaining() <= 0f)
         {
             return;
         }
         cannon.Fire(tag);
         _fuelTank.DecrementFuel(cannon.Cost());
     }
 }
Пример #2
0
    void FixedUpdate()
    {
        float   planeHeight   = transform.position.y;
        Vector2 upOnScreen    = new Vector2(Screen.width * 0.5f, 0);
        Vector2 rightOnScreen = new Vector2(Screen.width, Screen.height * 0.5f);
        var     upOnWorld     = ScreenSpaceToPlaneSpace(upOnScreen, planeHeight);
        var     rightOnWorld  = ScreenSpaceToPlaneSpace(rightOnScreen, planeHeight);

        _input = -(upOnWorld - transform.position).normalized * Input.GetAxis("Vertical") + (rightOnWorld - transform.position).normalized * Input.GetAxis("Horizontal");
        _engine.targetPower = _input.magnitude;
        var targetPosition = _input * 50f;

        targetPosition.y = gameSpace.heights[currentHeightIndex] - transform.position.y;
        _fuelTank.DecrementFuel((targetPosition.magnitude) * (1f + _fuelTank.Remaining() / 1000f) * fuelConsumption * Time.deltaTime);
        _shipMovement.manualForce = targetPosition / (1f + _fuelTank.Remaining() / 1000f);
    }
 // Update is called once per frame
 void Update()
 {
     _fuelTank.DecrementFuel((1f + _fuelTank.Remaining() / 1000f) * _floatingConsumption * Time.deltaTime);
     // ChangeTargetAgentPosition(_agentTargetPosition);
 }