Пример #1
0
 // Start is called before the first frame update
 void Start()
 {
     // get components for each variable for inspector
     mover   = GetComponent <TankMover>();
     shooter = GetComponent <TankShooter>();
     health  = GetComponent <TankHealth>();
 }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     // get requried compoents
     mover = GetComponent <TankMover> ();
     pawn  = GetComponent <TankData> ();
     shoot = GetComponent <TankShooter> ();
 }
Пример #3
0
 // Use this for initialization
 void Start()
 {
     mover   = GetComponent <TankMover>();
     shooter = GetComponent <TankShooter>();
     health  = GetComponent <TankHealth>();
     Bullet  = GetComponent <Bullet>();
 }
Пример #4
0
 // Use this for initialization
 private void Start()
 {
     // Component reference assignments dependant on other scripts
     tankTf  = tankData.tankTf;
     mover   = tankData.tankMover;
     vision  = controller.vision;
     hearing = controller.hearing;
 }
Пример #5
0
    /* Private Variables */


    private void Awake()
    {
        // Component reference assignments
        tankTf         = this.gameObject.GetComponent <Transform>();
        tankMover      = this.gameObject.GetComponent <TankMover>();
        tankShooter    = this.gameObject.GetComponent <TankShooter>();
        tankCc         = this.gameObject.GetComponent <CharacterController>();
        tankHealthMan  = this.gameObject.GetComponent <TankHealthManager>();
        tankScorer     = this.gameObject.GetComponent <TankScorer>();
        tankNoisemaker = this.gameObject.GetComponent <TankNoisemaker>();
    }
Пример #6
0
 /// <summary>
 /// Sets up this InputController's references to the new tank
 /// </summary>
 /// <param name="newTankData">The TankData component of the new tank being controlled by this InputController.</param>
 public void SetTankComponentReferences(TankData newTankData)
 {
     tankData    = newTankData;
     tankShooter = newTankData.tankShooter;
     tankMover   = newTankData.tankMover;
     if (playerNumber == PlayerNumber.Player1)
     {
         tankData.tankCamera.cullingMask = GameManager.gm.p1UILayer;
     }
     else if (playerNumber == PlayerNumber.Player2)
     {
         tankData.tankCamera.cullingMask = GameManager.gm.p2UILayer;
     }
 }
Пример #7
0
        private void Start()
        {
            _tankMover       = GetComponent <TankMover>();
            _playerTransform = FindObjectOfType <PlayerInput>().transform;
            var updatePositionSubscription = AIHelper.GetTimerStreamWithRandomStart(_positionUpdateFrequency)
                                             .Subscribe(_ => _navMeshAgent.destination = GetRandomPosition());

            GetComponent <UnitHealth>().HealthPercentageStream.Subscribe(_ => { }, () =>
            {
                Destroy(_navMeshAgent.gameObject);
                enabled = false;
                updatePositionSubscription.Dispose();
            });
            _navMeshAgent.speed = _tankMover.MovementSpeed;

            gameObject.OnDestroyAsObservable().Subscribe(_ => updatePositionSubscription.Dispose());
        }
Пример #8
0
    // Use this for initialization
    void Start()
    {
        // Load my components
        tf        = gameObject.GetComponent <Transform> ();
        mover     = GetComponent <TankMover>();    // Set type
        shooter   = GetComponent <Shooter>();      // Set type
        objectTag = GetComponent <Tag>();

        // Set the next shot time to [now] plus timeBetweenShots
        nextShotTime = Time.time + fireRate;

        if (this.objectTag.isAITank == true)
        {
            numLives = GameManager.instance.tankAINumLives;
        }

        score = 0;
    }
Пример #9
0
 // Start is called before the first frame update
 void Start()
 {
     mover = GetComponent <TankMover>();
 }
Пример #10
0
 private void Awake()
 {
     tf    = GetComponent <Transform>();
     mover = GetComponent <TankMover>();
 }
Пример #11
0
 // Start is called before the first frame update
 void Start()
 {
     fireRateModifier = Mathf.Max(fireRateModifier, 1);
     mover            = GetComponent <TankMover>();
 }
Пример #12
0
    [HideInInspector] public TankShooter shooter; // For TankShooter

    void Start()
    {
        // Fill the variables with the proper componets
        mover   = GetComponent <TankMover> ();
        shooter = GetComponent <TankShooter> ();
    }