Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class EnemyHealthP : MonoBehaviour {
- public float enemyHP;
- public bool dead = false;
- private Transform myTransform;
- public Transform exploded;
- public int pointsGain;
- public int upgradePointsGain;
- public bool infectOnp = false;
- public bool reverseInfection = false;
- public bool painingInfected = false;
- public Transform self;
- public int cubixexpgain = 10;
- void Awake(){
- myTransform = transform;
- }
- void Update(){
- if(enemyHP <= 0 && !dead){
- Destroy(self.gameObject);
- Transform explosion = Instantiate (exploded, myTransform.position, myTransform.rotation) as Transform;
- ScreenHUD.score += pointsGain;
- ScreenHUD.overallScore += pointsGain;
- UpgradeWindow.upgradePoints += upgradePointsGain;
- Cubix cubix = new Cubix();
- cubix.Cubixexp += cubixexpgain;
- dead = true;
- }
- }
- void OnDestroy(){
- if(infectOnp){
- PlayerMoveM2.mdown = 6700;
- PlayerMoveM2.mup = 6700;
- PlayerMoveM2.mright = 11700;
- PlayerMoveM2.mleft = 10700;
- }
- if(reverseInfection){
- PlayerMoveM2.mdown = 6700;
- PlayerMoveM2.mup = 6700;
- PlayerMoveM2.mright = 11700;
- PlayerMoveM2.mleft = 10700;
- }
- if(painingInfected){
- PlayerMoveM2.pain = false;
- }
- }
- void OnCollisionEnter(Collision other){
- Vector3 screenPos = Camera.main.WorldToScreenPoint (myTransform.position);
- if (screenPos.x < Screen.width) {
- if(Application.loadedLevel == 0 || Application.loadedLevel == 1){
- if(other.gameObject.tag == "Bullet"){
- enemyHP -= 5;
- }
- }
- if(Application.loadedLevel == 2 || Application.loadedLevel == 3 || Application.loadedLevel == 4 || Application.loadedLevel == 5 || Application.loadedLevel == 6){
- if(other.gameObject.tag == "Bullet"){
- enemyHP -= 3.8f;
- }
- }
- if(Application.loadedLevel == 7 || Application.loadedLevel == 8 || Application.loadedLevel == 9){
- if(other.gameObject.tag == "Bullet"){
- enemyHP -= 3f;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement