Beispiel #1
0
 void FixedUpdate()
 {
     if (Time.time - spawnTime > 3)
     {
         Destroy(gameObject);
         bulletCore = null;
     }
     if (aimEnemy == null)
     {
         return;
     }
     else
     {
         myRigidbody.velocity = (aimEnemy.transform.position - transform.position).normalized * speed;
     }
     if ((aimEnemy.transform.position - transform.position).magnitude < 0.1)
     {
         aimEnemy.GetComponent <EnemyControl>().GetHit(bulletCore.belongTower.ATK);
         Destroy(gameObject);
         bulletCore = null;
     }
 }
Beispiel #2
0
 private void Awake()
 {
     spawnTime  = Time.time;
     bulletCore = new TowerBulletCore();
 }