Ejemplo n.º 1
0
    public override string GetNameFromString(object theString)
    {
        object target = UnityRuntimeServices.Invoke(theString, "Split", new object[]
        {
            ", ".get_Chars(0)
        }, typeof(MonoBehaviour));

        return((string)RuntimeServices.Coerce(RuntimeServices.GetSlice(target, string.Empty, new object[]
        {
            0
        }), typeof(string)));
    }
Ejemplo n.º 2
0
    public override int GetScoreFromString(object theString)
    {
        object target = UnityRuntimeServices.Invoke(theString, "Split", new object[]
        {
            ", ".get_Chars(0)
        }, typeof(MonoBehaviour));

        return(RuntimeServices.UnboxInt32(RuntimeServices.Invoke(typeof(UnityBuiltins), "parseInt", new object[]
        {
            RuntimeServices.GetSlice(target, string.Empty, new object[]
            {
                1
            })
        })));
    }
    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");
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
        public Dispatcher CreateGetter()
        {
            MemberInfo member = ResolveMember();

            switch (member.MemberType)
            {
            case MemberTypes.Field:
            {
                FieldInfo field = (FieldInfo)member;
                return
                    (delegate(object o, object[] arguments) { return RuntimeServices.GetSlice(field.GetValue(o), "", arguments); });
            }

            case MemberTypes.Property:
            {
                MethodInfo getter = ((PropertyInfo)member).GetGetMethod(true);
                if (null == getter)
                {
                    throw MissingField();
                }

                if (getter.GetParameters().Length > 0)
                {
                    return(EmitMethodDispatcher(getter));
                }

                // TODO: remove the reflection invocation getter.Invoke from the path

                // otherwise its a simple property and the slice
                // should be applied to the return value
                return
                    (delegate(object o, object[] arguments) { return RuntimeServices.GetSlice(getter.Invoke(o, null), "", arguments); });
            }

            default:
            {
                throw MissingField();
            }
            }
        }
    public override void Update()
    {
        if (!this.isControllable)
        {
            Input.ResetInputAxes();
        }
        if (Input.GetButtonDown("Jump"))
        {
            this.lastJumpButtonTime = Time.get_time();
        }
        this.UpdateSmoothedMovementDirection();
        this.ApplyGravity();
        this.ApplyJumping();
        Vector3 vector = this.moveDirection * this.moveSpeed + new Vector3((float)0, this.verticalSpeed, (float)0) + this.inAirVelocity;

        vector *= Time.get_deltaTime();
        CharacterController characterController = (CharacterController)this.GetComponent(typeof(CharacterController));

        this.collisionFlags = characterController.Move(vector);
        if (RuntimeServices.ToBool(this._animation))
        {
            if (this._characterState == CharacterState.Jumping)
            {
                if (!this.jumpingReachedApex)
                {
                    RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                    {
                        this.jumpPoseAnimation.get_name()
                    }), "speed", this.jumpAnimationSpeed);
                    RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                    {
                        this.jumpPoseAnimation.get_name()
                    }), "wrapMode", 8);
                    UnityRuntimeServices.Invoke(this._animation, "CrossFade", new object[]
                    {
                        this.jumpPoseAnimation.get_name()
                    }, typeof(MonoBehaviour));
                }
                else
                {
                    RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                    {
                        this.jumpPoseAnimation.get_name()
                    }), "speed", -this.landAnimationSpeed);
                    RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                    {
                        this.jumpPoseAnimation.get_name()
                    }), "wrapMode", 8);
                    UnityRuntimeServices.Invoke(this._animation, "CrossFade", new object[]
                    {
                        this.jumpPoseAnimation.get_name()
                    }, typeof(MonoBehaviour));
                }
            }
            else if (characterController.get_velocity().get_sqrMagnitude() < 0.1f)
            {
                UnityRuntimeServices.Invoke(this._animation, "CrossFade", new object[]
                {
                    this.idleAnimation.get_name()
                }, typeof(MonoBehaviour));
            }
            else if (this._characterState == CharacterState.Running)
            {
                RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                {
                    this.runAnimation.get_name()
                }), "speed", Mathf.Clamp(characterController.get_velocity().get_magnitude(), (float)0, this.runMaxAnimationSpeed));
                UnityRuntimeServices.Invoke(this._animation, "CrossFade", new object[]
                {
                    this.runAnimation.get_name()
                }, typeof(MonoBehaviour));
            }
            else if (this._characterState == CharacterState.Trotting)
            {
                RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                {
                    this.walkAnimation.get_name()
                }), "speed", Mathf.Clamp(characterController.get_velocity().get_magnitude(), (float)0, this.trotMaxAnimationSpeed));
                UnityRuntimeServices.Invoke(this._animation, "CrossFade", new object[]
                {
                    this.walkAnimation.get_name()
                }, typeof(MonoBehaviour));
            }
            else if (this._characterState == CharacterState.Walking)
            {
                RuntimeServices.SetProperty(RuntimeServices.GetSlice(this, "_animation", new object[]
                {
                    this.walkAnimation.get_name()
                }), "speed", Mathf.Clamp(characterController.get_velocity().get_magnitude(), (float)0, this.walkMaxAnimationSpeed));
                UnityRuntimeServices.Invoke(this._animation, "CrossFade", new object[]
                {
                    this.walkAnimation.get_name()
                }, typeof(MonoBehaviour));
            }
        }
        if (this.IsGrounded())
        {
            this.get_transform().set_rotation(Quaternion.LookRotation(this.moveDirection));
        }
        else
        {
            Vector3 vector2 = vector;
            vector2.y = (float)0;
            if (vector2.get_sqrMagnitude() > 0.001f)
            {
                this.get_transform().set_rotation(Quaternion.LookRotation(vector2));
            }
        }
        if (this.IsGrounded())
        {
            this.lastGroundedTime = Time.get_time();
            this.inAirVelocity    = Vector3.get_zero();
            if (this.jumping)
            {
                this.jumping = false;
                this.SendMessage("DidLand", 1);
            }
        }
    }