public void PrintTag(object tagTransform)
 {
     if (RuntimeServices.ToBool(RuntimeServices.Invoke(tagTransform, "CompareTag", new object[]
     {
         "WayPointA"
     })))
     {
         MonoBehaviour.print("FOLLOW: picked WayPointA");
     }
     else if (RuntimeServices.ToBool(RuntimeServices.Invoke(tagTransform, "CompareTag", new object[]
     {
         "WayPointB"
     })))
     {
         MonoBehaviour.print("FOLLOW: picked WayPointB");
     }
     else if (RuntimeServices.ToBool(RuntimeServices.Invoke(tagTransform, "CompareTag", new object[]
     {
         "WayPointC"
     })))
     {
         MonoBehaviour.print("FOLLOW: picked WayPointC");
     }
     else
     {
         MonoBehaviour.print("FOLLOW: compare tag didn't return anything ");
     }
 }
Beispiel #2
0
        public static object Invoke(object target, string name, object[] args, Type scriptBaseType)
        {
            if (!Initialized)
            {
                throw new AssertionFailedException("Initialized");
            }
            object obj2 = RuntimeServices.Invoke(target, name, args);

            return((obj2 != null) ? (IsGenerator(obj2) ? (target.GetType().IsSubclassOf(scriptBaseType) ? (!IsStaticMethod(target.GetType(), name, args) ? RuntimeServices.Invoke(target, "StartCoroutine", new object[] { obj2 }) : obj2) : obj2) : obj2) : null);
        }
Beispiel #3
0
 public override void OnCollisionStay(Collision collision)
 {
     if (RuntimeServices.ToBool(RuntimeServices.Invoke(collision.get_gameObject(), "CompareTag", new object[]
     {
         "Bounce"
     })))
     {
         Vector3 vector = collision.get_transform().TransformDirection(Vector3.get_up());
         this.get_rigidbody().set_velocity(vector * (float)this.jumpSpeed);
     }
 }
Beispiel #4
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
            })
        })));
    }
Beispiel #5
0
    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;
                            }
                        }
                    }
                }
            }
        }
    }