void OnTriggerExit(Collider other)
 {
     if (other.gameObject.GetComponent <TankActor>().m_team1unit)
     {
         m_tank = null;
     }
 }
Beispiel #2
0
 void OnTriggerExit(Collider other)
 {
     if (other.gameObject.GetComponent <TankActor>().m_team2unit)
     {
         m_tank = null;
         markerMaterial.color = Color.green;
     }
 }
Beispiel #3
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.GetComponent <TankActor>().m_team2unit)
     {
         m_tank = other.GetComponent <TankActor>();
         markerMaterial.color = Color.red;
     }
 }
Beispiel #4
0
 public GameData(TankActor tankActor)
 {
     playerScore         = PickupManager.GetPlayerScore();
     playerHealth        = tankActor.healthComp.currentHP;
     numPickupsCollected = PickupManager.GetNumCollectedPickups();
     numPickupsLost      = PickupManager.GetNumLostPickups();
     numPickupsTotal     = PickupManager.GetNumPickupsInLevel();
     levelNum            = LevelManager.GetLevelNum();
 }
 void SetGeneral()
 {
     foreach (TankActor tank in m_squad.ToList())
     {
         if (tank.m_isGeneral)
         {
             m_currentGeneral = tank;
         }
     }
 }
Beispiel #6
0
    public void AttackEnemy(TankActor enemy)
    {
        m_turret.transform.LookAt(enemy.transform);

        m_agent.SetDestination(enemy.transform.position);

        if (Vector3.Distance(transform.position, enemy.transform.position) <= 20.0f)
        {
            m_agent.stoppingDistance = 15.0f;

            m_AttackTimer -= Time.deltaTime;

            if (m_AttackTimer <= 0.0f)
            {
                enemy.TakeDamage(20);
                m_AttackTimer = m_AttackTime;
            }
        }
    }
    private void Awake()
    {
        _panel      = GetComponent <Image>();
        _tankActor  = FindObjectOfType <TankActor>();
        _healthComp = _tankActor.GetComponent <HealthComponent>();

        if (!_panel)
        {
            Debug.LogError("Failed to get Image on " + gameObject.name.ToString() + ", creating one now...");
            _panel = gameObject.AddComponent <Image>();
        }

        if (!_tankActor)
        {
            Debug.LogError("Failed to find TankActor reference in TankHealthBox!");
        }

        _panel.fillAmount             = minFillValue;
        _healthComp.OnHealthModified += UpdateHealth;
    }
 public void setEnemy(TankActor enemy)
 {
     m_enemy = enemy;
 }
Beispiel #9
0
 public void FollowGeneral(TankActor general)
 {
     m_agent.SetDestination(general.transform.position);
 }