private Dispatcher CreateSetter(MemberInfo member) { switch (member.MemberType) { case MemberTypes.Field: { var field = (FieldInfo)member; return ((o, arguments) => RuntimeServices.SetSlice(field.GetValue(o), string.Empty, arguments)); } case MemberTypes.Property: { var property = (PropertyInfo)member; if (property.GetIndexParameters().Length > 0) { MethodInfo setter = property.GetSetMethod(true); if (null == setter) { throw MissingField(); } return(EmitMethodDispatcher(setter)); } return((o, arguments) => RuntimeServices.SetSlice(RuntimeServices.GetProperty(o, _name), string.Empty, arguments)); } default: { throw MissingField(); } } }
public void BuildingAnimStart() { GameObject gameObject = GameObject.Find("sceneLight"); GameObject gameObject2 = GameObject.Find("PowerBuilding"); GameObject gameObject3 = GameObject.Find("PetShop"); GameObject gameObject4 = GameObject.Find("ClothesShop"); GameObject gameObject5 = GameObject.Find("CogPinata"); GameObject gameObject6 = GameObject.Find("GagShop"); GameObject gameObject7 = GameObject.Find("MusicShop"); if (gameObject2) { PWR_PowerBuildingControl pWR_PowerBuildingControl = (PWR_PowerBuildingControl)gameObject2.GetComponentInChildren(typeof(PWR_PowerBuildingControl)); bool flag = RuntimeServices.UnboxBoolean(RuntimeServices.GetProperty(gameObject2.GetComponentInChildren(typeof(PWR_PowerBuildingControl)), "Awake")); if (!pWR_PowerBuildingControl) { MonoBehaviour.print("no randomAnimScript"); flag = pWR_PowerBuildingControl.IsAwake(); } gameObject2.BroadcastMessage("ToggleSleepWake"); gameObject3.BroadcastMessage("ToggleSleepWake"); gameObject4.BroadcastMessage("ToggleSleepWake"); gameObject6.BroadcastMessage("ToggleSleepWake"); gameObject5.BroadcastMessage("ToggleSleepWake"); gameObject7.BroadcastMessage("ToggleSleepWake"); } }
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 void OnTriggerEnter(Collider other) { GameObject gameObject = GameObject.Find("GagShop"); GameObject gameObject2 = GameObject.Find("CogPinata"); MonoBehaviour.print("ANVIL DROP: enter"); object componentInChildren = gameObject.GetComponentInChildren(typeof(Animation)); if (!RuntimeServices.ToBool(RuntimeServices.GetProperty(RuntimeServices.GetSlice(componentInChildren, string.Empty, new object[] { "anvilDrop" }), "enabled"))) { if (!RuntimeServices.ToBool(RuntimeServices.GetProperty(RuntimeServices.GetSlice(componentInChildren, string.Empty, new object[] { "honkHorn1" }), "enabled"))) { MonoBehaviour.print("ANVIL DROP: anims not enabled yet"); GS_RandomAnim gS_RandomAnim = (GS_RandomAnim)gameObject.GetComponentInChildren(typeof(GS_RandomAnim)); object property = RuntimeServices.GetProperty(gameObject.GetComponentInChildren(typeof(GS_RandomAnim)), "Awake"); if (RuntimeServices.ToBool(property)) { MonoBehaviour.print("ANVIL DROP: awake"); object componentInChildren2 = gameObject2.GetComponentInChildren(typeof(Animation)); if (!RuntimeServices.ToBool(RuntimeServices.GetProperty(RuntimeServices.GetSlice(componentInChildren2, string.Empty, new object[] { "anvilDrop3" }), "enabled"))) { if (!RuntimeServices.ToBool(RuntimeServices.GetProperty(RuntimeServices.GetSlice(componentInChildren2, string.Empty, new object[] { "honkHorn" }), "enabled"))) { MonoBehaviour.print("ANVIL DROP: cogAnims enabled"); gameObject.BroadcastMessage("AnvilDrop", 1); gameObject2.BroadcastMessage("AnvilDrop", 1); MonoBehaviour.print("ANVIL DROP: should be boradcasting"); } } } } } }
public void OnTriggerEnter(Collider other) { MonoBehaviour.print("PLAYER TRIGGER: entered"); GameObject gameObject = GameObject.Find("sceneLight"); GameObject gameObject2 = GameObject.Find("PowerBuilding"); GameObject gameObject3 = GameObject.Find("PetShop"); GameObject gameObject4 = GameObject.Find("ClothesShop"); if (gameObject2) { MonoBehaviour.print("the collider name is " + other.get_name()); PWR_PowerBuildingControl pWR_PowerBuildingControl = (PWR_PowerBuildingControl)gameObject2.GetComponentInChildren(typeof(PWR_PowerBuildingControl)); bool flag = RuntimeServices.UnboxBoolean(RuntimeServices.GetProperty(gameObject2.GetComponentInChildren(typeof(PWR_PowerBuildingControl)), "Awake")); if (!pWR_PowerBuildingControl) { MonoBehaviour.print("no randomAnimScript"); } flag = pWR_PowerBuildingControl.IsAwake(); if (other.get_name() == "BarrelCube" && flag) { MonoBehaviour.print("BarrelCube picked"); Transform transform = gameObject2.get_transform().Find(string.Empty); if (!transform) { MonoBehaviour.print("no target "); } } else if (other.get_name() == "BarrelCube1" && flag) { MonoBehaviour.print("BarrelCube1 picked"); } else if (other.get_name() == "BarrelCube2") { gameObject2.BroadcastMessage("ToggleSleepWake"); gameObject3.BroadcastMessage("ToggleSleepWake"); gameObject4.BroadcastMessage("ToggleSleepWake"); } } else { MonoBehaviour.print("pwrBuilding not found"); } }
public static object GetProperty(object target, string name) { if (!Initialized) { throw new AssertionFailedException("Initialized"); } try { return(RuntimeServices.GetProperty(target, name)); } catch (MissingMemberException) { if (target.GetType().IsValueType) { throw; } return(ExpandoServices.GetExpandoProperty(target, name)); } }
public void FixedUpdate() { if (this.nBubbles <= 25) { this.localAwake = RuntimeServices.UnboxBoolean(RuntimeServices.GetProperty(this.gagShop.GetComponentInChildren(typeof(GS_RandomAnim)), "Awake")); if (!this.localAwake) { float num = 0f; num = this.gagShop.get_animation().get_Item("sleepSnore2").get_normalizedTime() % (float)1; if (num > this.startBubbles && num < this.endBubbles) { int num2 = 0; Rigidbody rigidbody = (Rigidbody)Object.Instantiate(this.thisBubble, this.get_transform().get_position(), this.get_transform().get_rotation()); float num3 = (float)Random.Range(-6, 6); rigidbody.set_velocity(new Vector3((float)-20, (float)25, num3)); GameObject gameObject = GameObject.Find("gagS:def_chimney_A4"); Physics.IgnoreCollision((Collider)RuntimeServices.Coerce(rigidbody.get_collider(), typeof(Collider)), (Collider)RuntimeServices.Coerce(gameObject.get_collider(), typeof(Collider))); } } } }
public Dispatcher CreateSetter() { MemberInfo member = ResolveMember(); switch (member.MemberType) { case MemberTypes.Field: { FieldInfo field = (FieldInfo)member; return (delegate(object o, object[] arguments) { return RuntimeServices.SetSlice(field.GetValue(o), "", arguments); }); } case MemberTypes.Property: { PropertyInfo property = (PropertyInfo)member; if (property.GetIndexParameters().Length > 0) { MethodInfo setter = property.GetSetMethod(true); if (null == setter) { throw MissingField(); } return(EmitMethodDispatcher(setter)); } return(delegate(object o, object[] arguments) { return RuntimeServices.SetSlice(RuntimeServices.GetProperty(o, _name), "", arguments); }); } default: { throw MissingField(); } } }
public void OnTriggerEnter(Collider other) { GameObject gameObject = GameObject.Find("GagShop"); GameObject gameObject2 = GameObject.Find("CogPinata"); MonoBehaviour.print("HONK: honkHornTriggerEnter"); Animation animation = (Animation)gameObject.GetComponentInChildren(typeof(Animation)); if (!animation.get_Item("anvilDrop").get_enabled()) { if (!animation.get_Item("honkHorn1").get_enabled()) { MonoBehaviour.print("HONK: anims not enabled yet"); GS_RandomAnim gS_RandomAnim = (GS_RandomAnim)gameObject.GetComponentInChildren(typeof(GS_RandomAnim)); object property = RuntimeServices.GetProperty(gameObject.GetComponentInChildren(typeof(GS_RandomAnim)), "Awake"); if (RuntimeServices.ToBool(property)) { MonoBehaviour.print("HONK: Awake"); gameObject.BroadcastMessage("HonkHorn", 1); gameObject2.BroadcastMessage("HonkHorn", 1); } } } }
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 void Update() { if (Input.GetButtonDown("Fire1")) { this.startTime = Time.get_time(); this.canDrag = true; this.firstClick = true; } else if (Input.GetButtonUp("Fire1")) { this.canDrag = false; } if (this.firstClick || (this.canDrag && Time.get_time() > this.startTime + this.singleClickAllowance)) { this.firstClick = false; Ray ray = Camera.get_main().ScreenPointToRay(Input.get_mousePosition()); RaycastHit raycastHit = default(RaycastHit); if (Physics.Raycast(ray, ref raycastHit) && RuntimeServices.EqualityOperator(RuntimeServices.GetProperty(RuntimeServices.GetProperty(raycastHit.get_collider(), "gameObject"), "layer"), LayerMask.NameToLayer(this.navigationMask)) && (raycastHit.get_point() - this.get_transform().get_position()).get_magnitude() > this.stopDistance) { this.setTargetPos(raycastHit.get_point()); } } }