// Use this for initialization void Awake() { bulletSpeed = 50f; fireDelegate += fire; numOfRPGs = 2; bombNum = 3; }
void MultiFire() { GameObject[] bArray; bArray = GameObject.FindGameObjectsWithTag("bullet"); if (bArray.Length > 0) { fire = NormalFire; foreach (GameObject bullet in bArray) { Destroy(bullet); } Debug.Log(GameObject.FindGameObjectsWithTag("bullet")); maxBullets = 10; fire(); maxBullets = 5; return; } for (float i = 0; i < 8; i++) { GameObject bullet = Instantiate(bulletPrefab, transform.position, transform.rotation); bullet.transform.Rotate(0, 0, 360f / 8f * i); bullet.GetComponent <Rigidbody2D>().AddForce((bullet.transform.up * magnitude * 40.0f)); Destroy(bullet, 2.0f); } }
public static void AddLife() { fire = s.GetComponent <rocketPhysics>().MultiFire; s.GetComponent <AudioSource>().Play(); if (lives < 3) { markers[lives].SetActive(true); GameObject.Find("bonus").GetComponent <Text>().text = ""; } lives += 1; if (lives > 3) { GameObject.Find("bonus").GetComponent <Text>().text = "+" + (lives - 3); } }
// Start is called before the first frame update void Start() { fire = NormalFire; lives = 3; level = 1; Debug.Log(MyFuncs.AplusB(1, 2)); if (s == null) { s = this.gameObject; } else { Debug.LogError("tried to reinitialize rocket singleton!"); return; } // simple comment GameObject.Find("gameOver").transform.localScale = new Vector3(0, 0, 0); GameObject.Find("RestartButton").transform.localScale = new Vector3(0, 0, 0); markers = GameObject.FindGameObjectsWithTag("playerMarker"); // create the array Behaviour halo = (Behaviour)gameObject.GetComponent("Halo"); halo.enabled = true; shielded = true; Invoke("ShieldsOff", 2f); Invoke("SpawnEnemy", 3f); Invoke("SpawnExtralife", Random.Range(10f, 15f)); for (int i = 0; i < roidCount; i++) { SpawnRoid(); } roidCount *= 2; StartCoroutine("LevelScale"); }
internal static extern void CSharpResourceImpl_SetFireDelegate(IntPtr resource, FireDelegate @delegate);
public static void AddLandMines() { fire = s.GetComponent <rocketPhysics>().DropMine; s.GetComponent <AudioSource>().Play(); }
// del[] public void RegisterDelegate(FireDelegate del) { this.delegates.Add(del); }