static void Main(string[] args) { Prototype1 d1 = null; d1 += p1; d1 += p4; d1 += p7; Prototype2 d2 = null; d2 += p2; d2 += p5; d2 += p9; Prototype3 d3 = null; d3 += p3; Prototype4 d4 = null; d4 += p8; Prototype5 d5 = null; d5 += p6; foreach (Prototype1 unD in d1.GetInvocationList()) { unD.Invoke(13, "Salut"); } Console.ReadLine(); }
void Update() { if (!aimingMode) { return; } Vector3 mousePos2D = Input.mousePosition; mousePos2D.z = -Camera.main.transform.position.z; Vector3 mousePos3D = Camera.main.ScreenToWorldPoint(mousePos2D); Vector3 mouseDelta = mousePos3D - launchPos; float maxMagnitude = this.GetComponent <SphereCollider>().radius; if (mouseDelta.magnitude > maxMagnitude) { mouseDelta.Normalize(); mouseDelta *= maxMagnitude; } Vector3 projPos = launchPos + mouseDelta; projectile.transform.position = projPos; if (Input.GetMouseButtonUp(0)) { Prototype1 protScript = Camera.main.GetComponent <Prototype1>(); // The mouse has been released aimingMode = false; projectileRigidbody.isKinematic = false; projectileRigidbody.velocity = -mouseDelta * velocityMult; FollowCam.POI = projectile; projectile = null; Prototype1.ShotFired(); } }
// Start is called before the first frame update void Start() { S = this; GameObject shotsGO = GameObject.Find("ShotsLeft"); shotsGT = shotsGT.GetComponent <Text>(); shotsGT.text = "Shots Left: " + numShots; }