// Use this for initialization
 void Start()
 {
     BlastZones      = new List <BlastZone>();
     Enemies         = new List <BlastEnemy>();
     controller      = GetComponent <BlastController>();
     spawnPoint      = GameObject.Find("SpawnPoint").GetComponent <Transform>();
     blastZoneParent = GameObject.Find("BlastZones").GetComponent <Transform>();
     player          = GameObject.FindGameObjectWithTag("Player").GetComponent <BlastPlayer>();
 }
Example #2
0
 private void Explode()
 {
     if (destructionBlastPrefab != null)
     {
         BlastController blastController = Instantiate(destructionBlastPrefab, transform.position, destructionBlastPrefab.transform.rotation);
         Destroy(gameObject);
     }
     else if (animator != null)
     {
         animator.SetTrigger("Explode");
     }
     else
     {
         Destroy(gameObject);
         Debug.LogWarning(gameObject.name + " has no explosion effect!");
     }
 }
Example #3
0
 // Update is called once per frame
 void Update()
 {
     timer += Time.deltaTime;
     if (setDestruct)
     {
         destroyTimer -= Time.deltaTime;
         if (destroyTimer < 0)
         {
             Destroy(this.gameObject);
         }
     }
     else if (timer > fireInterval)
     {
         shotAngle = (shotAngle + 10) % 360;
         Vector3         shotVector = new Vector3(Mathf.Cos((float)shotAngle * Mathf.PI / 180), 0, Mathf.Sin((float)shotAngle * Mathf.PI / 180));
         BlastController blast      = Instantiate(shot, transform.position + shotVector, Quaternion.identity).GetComponent <BlastController> () as BlastController;
         blast.setDir(shotVector);
         timer = 0f;
     }
 }