Example #1
0
    void Update()
    {
        if (gameStartIndicator.isGamePlaying() && Time.deltaTime != 0)
        {
            if (!inputs.inputContinuous())
            {
                rotControl.changePower();
                gameObject.transform.rotation = Quaternion.Euler(new Vector3(0, 0, rotControl.getCurrent()));
            }

            if (ammunition.hasAmmo())
            {
                if (inputs.inputUp())
                {
                    fire();
                    resetCannon();
                }

                if (inputs.inputContinuous())
                {
                    velControl.changePower();
                }
                inputs.informAI(velControl.getCurrentPercent(), rotControl.getCurrentPercent());
            }
        }
    }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (movable != null)
     {
         percent  = pow.getCurrentPercent();
         position = totalDistance * (percent / 100) - totalDistance / 2;
         movable.GetComponent <Transform> ().localPosition = new Vector3(position, GetComponentInChildren <Transform> ().localPosition.y);
     }
     otherActions();
 }