Skip to content
Permalink
3a9b3694ac
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
72 lines (55 sloc) 1.38 KB
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DestroyByContact_BOSS : MonoBehaviour
{
public float health_2 = 400;
public void Update()
{
if (health_2 < 1)
{
Destroy(gameObject);
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Asteroid")
{
return;
}
if (other.tag == "Enemy1")
{
return;
}
if (other.tag == "Ship")
{
HealthScript.healthValue = HealthScript.healthValue - 1000;
other.gameObject.SetActive(true);
Destroy(gameObject);
if (HealthScript.healthValue < 1)
{
other.gameObject.SetActive(false);
Time.timeScale = 0f;
}
}
if (other.tag == "Shot")
{
ScoreScript.scoreValue += 1;
Destroy(other.gameObject);
health_2 = health_2 - 1;
}
if (other.tag == "Shot_2")
{
ScoreScript.scoreValue += 5;
Destroy(other.gameObject);
health_2 = health_2 - 5;
}
if (other.tag == "Shot_3")
{
ScoreScript.scoreValue +=15;
Destroy(other.gameObject);
health_2 = health_2 - 15;
}
}
}