static void Main(string[] args) { MyClass t = new MyClass(); NonStatic myNonStatic = new NonStatic(t.Y); myNonStatic(); myNonStatic = MyClass.X; myNonStatic(); MyWrite myDelegate = new MyWrite(WriteLine); MyReadLine read = ReadLine; string str = read(); MyWrite write = WriteLine; write("myDelegate == WriteLine()"); write(str); write = Write; write("myDelegate == Write()"); write("a"); write("a"); write("a"); write("a"); WaitKey wait = ReadKey; wait(); }
void nonStaticCollision(Vector3 p, NonStatic ns) { Vector3 dir = p - transform.position; dir = new Vector3(dir.x, dir.y / 10, dir.z).normalized; Vector3 force = velocity * mass; ns.addForce(Mathf.Abs(Vector3.Dot(force, dir)) * dir); }
void Start() { nonStaticScript = GetComponentInParent <NonStatic>(); collisionList = new List <Collider>(); }