LegitTeddyBears

Dmg

May 28th, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Dmg : MonoBehaviour
  6. {
  7.     //The Object we want to modify (One gun for each Bullet Emitter)
  8.     public GameObject Gun1;
  9.     public GameObject Gun2;
  10.     //The name of the Script we want to modify, (OSA stands for Other Script Access)(One OSA for each Gun)
  11.     private Weapon OSA1;
  12.     private Weapon OSA2;
  13.     //How much extra damage the ship gets after pickup
  14.     public int DmgMult;
  15.  
  16.  
  17.     // Use this for initialization
  18.     void Start()
  19.     {
  20.         OSA1 = Gun1.GetComponent<Weapon>();
  21.         OSA2 = Gun2.GetComponent<Weapon>();
  22.     }
  23.  
  24.     // OnTriggerEnter is where we dictate what happens to the object when it interacts with a rigidbody
  25.     private void OnTriggerEnter(Collider other)
  26.     {
  27.         OSA1.Dmg = OSA1.Dmg * DmgMult;
  28.         OSA2.Dmg = OSA2.Dmg * DmgMult;
  29.         gameObject.SetActive(false);
  30.     }
  31.  
  32.     // Update is called once per frame
  33.     void Update()
  34.     {
  35.         transform.Rotate(new Vector3(0, -90, 0) * Time.deltaTime);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment