public virtual void Hit(Collision collision) { if (collision.rigidbody) { CollideReport other = (CollideReport)collision.rigidbody.gameObject.GetComponent(typeof(CollideReport)); if (other) { this.ElectronCheck(other.atom); } } }
public virtual void OnCollisionEnter(Collision collision) { if (collision.rigidbody) { CollideReport other = (CollideReport)collision.rigidbody.gameObject.GetComponent(typeof(CollideReport)); if (other && (other.atom.e < other.atom.p)) { other.atom.e = other.atom.e + 1; if (other.atom.isPlayer) { UserAtom.e = other.atom.e; } this.transform.position = new Vector3(1000, 1000, 0); } } }
public virtual void Start() { this.fieldColorRed = new Color(1f, 15f / 255, 0f); this.fieldColorBlue = new Color(0f, 20f / 255, 1f); if (this.isPlayer) { Atom.playerInstance = this; this.p = UserAtom.p; this.n = UserAtom.n; this.e = UserAtom.e; } this.origP = this.p; this.origN = this.n; this.origE = this.e; this.trans = this.transform; var shapeModule = this.electrons.shape; shapeModule.radius = 0.5f; var mainModule = this.electrons.main; mainModule.prewarm = true; this.electrons2 = UnityEngine.Object.Instantiate(this.electrons.gameObject).GetComponent <ParticleSystem>(); this.electrons2.transform.parent = transform; this.electrons2.transform.localScale = Vector3.one; this.electrons2.transform.localPosition = Vector3.zero; this.electrons.GetComponent <Renderer>().material = electronMaterials[0]; this.electrons2.GetComponent <Renderer>().material = electronMaterials[1]; //shapeModule.position = new Vector3(0f,0f,0.5f); this.originalETrans1 = this.electrons.GetComponent <Renderer>().material.GetColor("_TintColor").a; this.originalETrans2 = this.electrons2.GetComponent <Renderer>().material.GetColor("_TintColor").a; //this.electrons.GetComponent<Renderer>().material. this.coll = (SphereCollider)this.electrons.gameObject.AddComponent(typeof(SphereCollider)); this.coll.material = (PhysicMaterial)Resources.Load("ColliderMaterial"); this.rbody.useGravity = false; CollideReport r = (CollideReport)this.rbody.gameObject.AddComponent(typeof(CollideReport)); r.atom = this; }