Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Dmg : MonoBehaviour
- {
- //The Object we want to modify (One gun for each Bullet Emitter)
- public GameObject Gun1;
- public GameObject Gun2;
- //The name of the Script we want to modify, (OSA stands for Other Script Access)(One OSA for each Gun)
- private Weapon OSA1;
- private Weapon OSA2;
- //How much extra damage the ship gets after pickup
- public int DmgMult;
- // Use this for initialization
- void Start()
- {
- OSA1 = Gun1.GetComponent<Weapon>();
- OSA2 = Gun2.GetComponent<Weapon>();
- }
- // OnTriggerEnter is where we dictate what happens to the object when it interacts with a rigidbody
- private void OnTriggerEnter(Collider other)
- {
- OSA1.Dmg = OSA1.Dmg * DmgMult;
- OSA2.Dmg = OSA2.Dmg * DmgMult;
- gameObject.SetActive(false);
- }
- // Update is called once per frame
- void Update()
- {
- transform.Rotate(new Vector3(0, -90, 0) * Time.deltaTime);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment