public override void Explode() { object obj = Object.Instantiate(this.confettiEmitter1, this.get_transform().get_position(), this.get_transform().get_rotation()); Vector3 localScale = this.get_transform().get_localScale(); object property = UnityRuntimeServices.GetProperty(obj, "transform"); RuntimeServices.SetProperty(property, "localScale", localScale); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(obj, "transform", property) }); MonoBehaviour.print(RuntimeServices.InvokeBinaryOperator("op_Addition", "Confetti Sphere local scale = ", UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(obj, "transform"), "localScale"))); Vector3 vector = new Vector3((float)10, (float)10, (float)10); object property2 = UnityRuntimeServices.GetProperty(obj, "transform"); RuntimeServices.SetProperty(property2, "localScale", vector); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(obj, "transform", property2) }); obj = Object.Instantiate(this.confettiEmitter2, this.get_transform().get_position(), this.get_transform().get_rotation()); Vector3 localScale2 = this.get_transform().get_localScale(); object property3 = UnityRuntimeServices.GetProperty(obj, "transform"); RuntimeServices.SetProperty(property3, "localScale", localScale2); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(obj, "transform", property3) }); MonoBehaviour.print(RuntimeServices.InvokeBinaryOperator("op_Addition", "Confetti Sphere local scale = ", UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(obj, "transform"), "localScale"))); Vector3 vector2 = new Vector3((float)10, (float)10, (float)10); object property4 = UnityRuntimeServices.GetProperty(obj, "transform"); RuntimeServices.SetProperty(property4, "localScale", vector2); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(obj, "transform", property4) }); object obj2 = Object.Instantiate(this.explosionPrefab, this.get_transform().get_position(), this.get_transform().get_rotation()); object obj3 = UnityRuntimeServices.Invoke(obj2, "GetComponent", new object[] { "Detonator" }, typeof(MonoBehaviour)); RuntimeServices.SetProperty(obj3, "size", 1); AudioSource.PlayClipAtPoint(this.explosionSound, this.get_transform().get_position(), (float)1); this.SpewBeans(); checked { GameController.instance.gameEnemies = GameController.instance.gameEnemies - 1; GameController.instance.gameScore = GameController.instance.gameScore + 10; Object.Destroy(this.get_gameObject()); } }
public void RuntimeGivesUsefulMessageForMissingOperator() { try { RuntimeServices.InvokeBinaryOperator("op_BitwiseAnd", "", 42); } catch (MissingMethodException x) { Assert.AreEqual("Bitwise and is not applicable to operands 'System.String' and 'System.Int32'.", x.Message); return; } Assert.Fail("Exception expected"); }
public void SpawnExplosion() { Ray ray = Camera.get_main().ScreenPointToRay(Input.get_mousePosition()); RaycastHit raycastHit = default(RaycastHit); GameObject gameObject; if (Physics.Raycast(ray, ref raycastHit, (float)1000)) { object obj = RuntimeServices.InvokeBinaryOperator("op_Division", RuntimeServices.GetProperty(this.currentDetonator.GetComponent("Detonator"), "size"), 3); Vector3 vector = raycastHit.get_point() + Vector3.Scale(raycastHit.get_normal(), new Vector3(RuntimeServices.UnboxSingle(obj), RuntimeServices.UnboxSingle(obj), RuntimeServices.UnboxSingle(obj))); gameObject = (GameObject)Object.Instantiate(this.currentDetonator, vector, Quaternion.get_identity()); RuntimeServices.SetProperty(gameObject.GetComponent("Detonator"), "detail", this.detailLevel); } Object.Destroy(gameObject, this.explosionLife); }
public void Update() { GameObject gameObject = GameObject.Find("tt_a_ara_ttc_gagShop"); GS_RandomAnim gS_RandomAnim = (GS_RandomAnim)gameObject.GetComponentInChildren(typeof(GS_RandomAnim)); bool flag = RuntimeServices.UnboxBoolean(RuntimeServices.GetProperty(gameObject.GetComponentInChildren(typeof(GS_RandomAnim)), "Awake")); if (!flag) { if (RuntimeServices.ToBool(RuntimeServices.InvokeBinaryOperator("op_GreaterThan", RuntimeServices.GetProperty(RuntimeServices.GetProperty(this.GetComponent(typeof(Rigidbody)), "velocity"), "y"), 0.05f))) { } if (Time.get_time() - this.birthday > this.lifespan) { this.Pop(); } if (RuntimeServices.ToBool(RuntimeServices.InvokeBinaryOperator("op_LessThan", RuntimeServices.GetProperty(RuntimeServices.GetProperty(this.GetComponent(typeof(Rigidbody)), "velocity"), "y"), 0.001f))) { if (!this.startPopTimer) { this.startPopTimer = true; this.popTimer = Time.get_time(); } else if (Time.get_time() - this.popTimer > (float)5) { this.Pop(); } } else if (this.get_gameObject().get_transform().get_localScale().y <= this.maxRad) { float x = this.get_gameObject().get_transform().get_localScale().x + this.growRate; Vector3 localScale = this.get_gameObject().get_transform().get_localScale(); float num = localScale.x = x; Vector3 vector; this.get_gameObject().get_transform().set_localScale(vector = localScale); float y = this.get_gameObject().get_transform().get_localScale().y + this.growRate; Vector3 localScale2 = this.get_gameObject().get_transform().get_localScale(); float num2 = localScale2.y = y; Vector3 vector2; this.get_gameObject().get_transform().set_localScale(vector2 = localScale2); float z = this.get_gameObject().get_transform().get_localScale().z + this.growRate; Vector3 localScale3 = this.get_gameObject().get_transform().get_localScale(); float num3 = localScale3.z = z; Vector3 vector3; this.get_gameObject().get_transform().set_localScale(vector3 = localScale3); } } }
public int GetPetState() { PetState petState = (PetState)this.GetComponent(typeof(PetState)); IdleLogic idleLogic = (IdleLogic)this.GetComponent(typeof(IdleLogic)); FollowLogic followLogic = (FollowLogic)this.GetComponent(typeof(FollowLogic)); WanderLogic wanderLogic = (WanderLogic)this.GetComponent(typeof(WanderLogic)); int result = this.indexAction; this.useTimer = true; if (this.calledByPlayer != 0) { float num = Vector3.Distance(this.get_transform().get_position(), this.owner.get_transform().get_position()); if (num <= this.ownerDist && RuntimeServices.ToBool(RuntimeServices.InvokeBinaryOperator("op_LessThan", RuntimeServices.GetProperty(RuntimeServices.GetProperty(this.owner.GetComponent(typeof(CharacterController)), "velocity"), "magnitude"), 1))) { result = 0; } else if (num > this.ownerDist) { result = 2; } this.useTimer = false; } else if (this.calledByPlayer == 0 && this.indexAction == 2) { result = Random.Range(0, 2); } else if (Time.get_time() - (float)this.stateStartTime > this.stateTimeOut) { int num2 = this.indexAction; if (num2 == 0) { result = 1; } else if (num2 == 1) { result = 0; } else { result = this.indexAction; } } return(result); }
public override void SortScores() { int length = this.scoresArray.length; checked { for (int i = 0; i < length - 1; i++) { for (int j = i + 1; j < length; j++) { object lhs = this.GetScoreFromString(this.scoresArray[i]); object rhs = this.GetScoreFromString(this.scoresArray[j]); if (RuntimeServices.ToBool(RuntimeServices.InvokeBinaryOperator("op_LessThan", lhs, rhs))) { this.Swap(i, j); } } } this.UpdatePlayerPrefs(); } }
public void AddPetStateTimeout(object additional_time) { this.stateTimeOut = RuntimeServices.UnboxSingle(RuntimeServices.InvokeBinaryOperator("op_Addition", this.stateTimeOut, additional_time)); }
public override void OnCollisionEnter(Collision collisionInfo) { object component = this.GUICam.GetComponent("GameController"); if (!RuntimeServices.ToBool(RuntimeServices.Invoke(component, "GetGameOver", new object[0]))) { if (RuntimeServices.ToBool(RuntimeServices.Invoke(component, "GetReadyToPlay", new object[0]))) { object component2 = collisionInfo.get_transform().GetComponent("Asterpinata"); if (!RuntimeServices.ToBool(component2)) { component2 = collisionInfo.get_transform().GetComponent("Asteroid"); } if (!RuntimeServices.ToBool(component2)) { component2 = collisionInfo.get_transform().GetComponent("StarPinata"); } if (!RuntimeServices.EqualityOperator(component2, null)) { MonoBehaviour.print(string.Empty); MonoBehaviour.print(string.Empty); MonoBehaviour.print(string.Empty); MonoBehaviour.print(string.Empty); MonoBehaviour.print(RuntimeServices.InvokeBinaryOperator("op_Addition", RuntimeServices.InvokeBinaryOperator("op_Addition", RuntimeServices.InvokeBinaryOperator("op_Addition", "ast collision = ", UnityRuntimeServices.GetProperty(component2, "name")), ", ast.transform.position = "), UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(component2, "transform"), "position"))); Vector3 vector = default(Vector3); vector.x = this.get_transform().get_position().x + 1.39f; vector.y = this.get_transform().get_position().y - 0.244f; vector.z = this.get_transform().get_position().z + 19.81f; LayerMask layerMask = LayerMask.NameToLayer("ShipLayer"); Collider[] array = Physics.OverlapSphere(vector, 8.5f); MonoBehaviour.print("clist length = " + Extensions.get_length(array)); int i = default(int); bool flag = false; checked { for (i = 0; i < Extensions.get_length(array); i++) { MonoBehaviour.print(RuntimeServices.InvokeBinaryOperator("op_Addition", "colliders in sphere = " + array[i].get_name() + ", ast.name = ", UnityRuntimeServices.GetProperty(component2, "name"))); if (RuntimeServices.EqualityOperator(array[i].get_name(), UnityRuntimeServices.GetProperty(component2, "name"))) { flag = true; } } } MonoBehaviour.print("time elapsed since last crack = " + (Time.get_time() - this.lastTimeCracked)); if (Time.get_time() - this.lastTimeCracked >= this.crackDelay && flag) { flag = true; this.lastTimeCracked = Time.get_time(); } else { flag = false; } MonoBehaviour.print("okToCrack = " + flag); UnityRuntimeServices.Invoke(this.astroScript, "PlayDuck", new object[0], typeof(MonoBehaviour)); MonoBehaviour.print("Points colliding: " + collisionInfo.get_contacts().get_Length()); MonoBehaviour.print("SHIP: GOT hit by an asteroid named " + collisionInfo.get_transform().get_name()); object target = Object.Instantiate(this.asteroidExplosion, collisionInfo.get_transform().get_position(), collisionInfo.get_transform().get_rotation()); object target2 = UnityRuntimeServices.Invoke(target, "GetComponent", new object[] { "Detonator" }, typeof(MonoBehaviour)); RuntimeServices.SetProperty(target2, "size", 22); AudioSource.PlayClipAtPoint(this.asteroidExplosionSound, collisionInfo.get_transform().get_position()); Object.Destroy((Object)RuntimeServices.Coerce(UnityRuntimeServices.GetProperty(component2, "gameObject"), typeof(Object))); if (flag) { if (this.nHits <= 1) { AudioSource.PlayClipAtPoint(this.asteroidHitSound, collisionInfo.get_transform().get_position()); } Vector3 vector2 = default(Vector3); vector2.x = collisionInfo.get_contacts()[0].get_point().x - this.get_transform().get_position().x; vector2.y = collisionInfo.get_contacts()[0].get_point().y - this.get_transform().get_position().y; MonoBehaviour.print("locPos = " + vector2); if (vector2.x < -1.3f) { vector2.x = -1.3f; } else if (vector2.x > 1.3f) { vector2.x = 1.3f; } if (vector2.y < (float)-2) { vector2.y = (float)-2; } else if (vector2.y > 1.8f) { vector2.y = 1.8f; } checked { if (this.nHits == 0) { float x = vector2.x; Vector3 localPosition = this.windshield1.get_localPosition(); float num = localPosition.x = x; Vector3 vector3; this.windshield1.set_localPosition(vector3 = localPosition); float y = vector2.y; Vector3 localPosition2 = this.windshield1.get_localPosition(); float num2 = localPosition2.y = y; Vector3 vector4; this.windshield1.set_localPosition(vector4 = localPosition2); this.windshield1.get_renderer().set_enabled(true); MonoBehaviour.print("windshield1.localPosition.x = " + this.windshield1.get_localPosition().x + ", y= " + this.windshield1.get_localPosition().y); this.nHits++; } else if (this.nHits == 1) { float x2 = vector2.x; Vector3 localPosition3 = this.windshield2.get_localPosition(); float num3 = localPosition3.x = x2; Vector3 vector5; this.windshield2.set_localPosition(vector5 = localPosition3); float y2 = vector2.y; Vector3 localPosition4 = this.windshield2.get_localPosition(); float num4 = localPosition4.y = y2; Vector3 vector6; this.windshield2.set_localPosition(vector6 = localPosition4); this.windshield2.get_renderer().set_enabled(true); MonoBehaviour.print("windshield2.localPosition.x = " + this.windshield2.get_localPosition().x + ", y= " + this.windshield2.get_localPosition().y); this.nHits++; } else { UnityRuntimeServices.Invoke(component, "SetGameOver", new object[] { true }, typeof(MonoBehaviour)); UnityRuntimeServices.Invoke(component, "TimedGameRestart", new object[] { 5, this.get_transform().get_position() }, typeof(MonoBehaviour)); GameController.instance.gameLives = GameController.instance.gameLives - 1; GameController.instance.gameEnemies = GameController.instance.gameEnemies - 1; } } } } } } }
public override void Start() { for (int i = 0; i < this.starCount; i = checked (i + 1)) { float num = this.fieldSize * 0.5f; float num2 = this.offsetXYZ.get_Item(0) + Mathf.Lerp(-0.2f * num, 0.2f * num, Random.get_value()); float num3 = this.offsetXYZ.get_Item(1) + Mathf.Lerp(-0.2f * num, 0.2f * num, Random.get_value()); float num4 = this.offsetXYZ.get_Item(2) + Mathf.Lerp((float)0, this.fieldSize, Random.get_value()); object target = Object.Instantiate(this.starPrefab, new Vector3(num2, num3, num4), this.get_transform().get_rotation()); Transform transform = this.get_transform(); object property = UnityRuntimeServices.GetProperty(target, "transform"); RuntimeServices.SetProperty(property, "parent", transform); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(target, "transform", property) }); float num5 = num2; object property2 = UnityRuntimeServices.GetProperty(target, "transform"); object property3 = UnityRuntimeServices.GetProperty(property2, "position"); RuntimeServices.SetProperty(property3, "x", num5); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(property2, "position", property3), new UnityRuntimeServices.MemberValueTypeChange(target, "transform", property2) }); float num6 = num3; object property4 = UnityRuntimeServices.GetProperty(target, "transform"); object property5 = UnityRuntimeServices.GetProperty(property4, "position"); RuntimeServices.SetProperty(property5, "y", num6); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(property4, "position", property5), new UnityRuntimeServices.MemberValueTypeChange(target, "transform", property4) }); float num7 = num4; object property6 = UnityRuntimeServices.GetProperty(target, "transform"); object property7 = UnityRuntimeServices.GetProperty(property6, "position"); RuntimeServices.SetProperty(property7, "z", num7); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(property6, "position", property7), new UnityRuntimeServices.MemberValueTypeChange(target, "transform", property6) }); Vector3 vector = new Vector3(Random.Range(0.5f, (float)3), Random.Range(1f, 2f), 1f); object value = RuntimeServices.InvokeBinaryOperator("op_Multiply", UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(target, "transform"), "localScale"), "x"), vector.x); object property8 = UnityRuntimeServices.GetProperty(target, "transform"); object property9 = UnityRuntimeServices.GetProperty(property8, "localScale"); RuntimeServices.SetProperty(property9, "x", value); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(property8, "localScale", property9), new UnityRuntimeServices.MemberValueTypeChange(target, "transform", property8) }); object value2 = RuntimeServices.InvokeBinaryOperator("op_Multiply", UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(UnityRuntimeServices.GetProperty(target, "transform"), "localScale"), "y"), vector.y * vector.x); object property10 = UnityRuntimeServices.GetProperty(target, "transform"); object property11 = UnityRuntimeServices.GetProperty(property10, "localScale"); RuntimeServices.SetProperty(property11, "y", value2); UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[] { new UnityRuntimeServices.MemberValueTypeChange(property10, "localScale", property11), new UnityRuntimeServices.MemberValueTypeChange(target, "transform", property10) }); } }