Exemplo n.º 1
0
 public override void Awake()
 {
     if (!this.cameraTransform && Camera.get_main())
     {
         this.cameraTransform = Camera.get_main().get_transform();
     }
     if (!this.cameraTransform)
     {
         Debug.Log("Please assign a camera to the ThirdPersonCamera script.");
         this.set_enabled(false);
     }
     this._target = this.get_transform();
     if (this._target)
     {
         this.controller = (ThirdPersonController)this._target.GetComponent(typeof(ThirdPersonController));
     }
     if (this.controller)
     {
         CharacterController characterController = (CharacterController)RuntimeServices.Coerce(this._target.get_collider(), typeof(CharacterController));
         this.centerOffset = characterController.get_bounds().get_center() - this._target.get_position();
         this.headOffset   = this.centerOffset;
         this.headOffset.y = characterController.get_bounds().get_max().y - this._target.get_position().y;
     }
     else
     {
         Debug.Log("Please assign a target to the camera that has a ThirdPersonController script attached.");
     }
     this.Cut(this._target, this.centerOffset);
 }
Exemplo n.º 2
0
    public override void endFire()
    {
        this.fireStarted = false;
        if (this.burnP.GetComponent <ParticleEmitter>())
        {
            this.burnP.GetComponent <ParticleEmitter>().emit = false;
        }
        IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(this.burnP);

        while (enumerator.MoveNext())
        {
            object arg_5E_0;
            object expr_44 = arg_5E_0 = enumerator.Current;
            if (!(expr_44 is Transform))
            {
                arg_5E_0 = RuntimeServices.Coerce(expr_44, typeof(Transform));
            }
            Transform transform = (Transform)arg_5E_0;
            if (transform.GetComponent <ParticleEmitter>())
            {
                transform.GetComponent <ParticleEmitter>().emit = false;
                UnityRuntimeServices.Update(enumerator, transform);
            }
        }
        UnityEngine.Object.Destroy(this);
    }
        private Dispatcher EmitFieldDispatcher(FieldInfo field, SetOrGet gos)
        {
#if NO_SYSTEM_REFLECTION_EMIT
            switch (gos)
            {
            case SetOrGet.Get:
                return((target, args) => field.GetValue(target));

            case SetOrGet.Set:
                return((target, args) =>
                {
                    var value = args[0];
                    field.SetValue(target, RuntimeServices.Coerce(value, field.FieldType));
                    return value;
                });

            default:
                throw new ArgumentException();
            }
#else
            return(SetOrGet.Get == gos
                                ? new Emitters.GetFieldEmitter(field).Emit()
                                : new Emitters.SetFieldEmitter(field, GetArgumentTypes()[0]).Emit());
#endif
        }
Exemplo n.º 4
0
    public void OnDrawGizmosSelected()
    {
        if (AutoWayPoint.waypoints.get_length() == 0)
        {
            this.RebuildWaypointList();
        }
        IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(this.connected);

        while (enumerator.MoveNext())
        {
            AutoWayPoint autoWayPoint = (AutoWayPoint)RuntimeServices.Coerce(enumerator.Current, typeof(AutoWayPoint));
            if (Physics.Linecast(this.get_transform().get_position(), autoWayPoint.get_transform().get_position()))
            {
                Gizmos.set_color(Color.get_red());
                Gizmos.DrawLine(this.get_transform().get_position(), autoWayPoint.get_transform().get_position());
                UnityRuntimeServices.Update(enumerator, autoWayPoint);
            }
            else
            {
                Gizmos.set_color(Color.get_green());
                Gizmos.DrawLine(this.get_transform().get_position(), autoWayPoint.get_transform().get_position());
                UnityRuntimeServices.Update(enumerator, autoWayPoint);
            }
        }
    }
        public InternalField GetEvaluationContextField(Node node)
        {
            object obj1 = node["EvaluationContextField"];

            if (!(obj1 is InternalField))
            {
            }
            return((InternalField)RuntimeServices.Coerce(obj1, typeof(InternalField)));
        }
Exemplo n.º 6
0
        public static ClassDefinition GetScriptClass(CompilerContext context)
        {
            object obj1 = context["ScriptClass"];

            if (!(obj1 is ClassDefinition))
            {
            }
            return((ClassDefinition)RuntimeServices.Coerce(obj1, typeof(ClassDefinition)));
        }
Exemplo n.º 7
0
 public override void Update()
 {
     if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(this.GetComponent <Animation>());
         while (enumerator.MoveNext())
         {
             object arg_40_0;
             object expr_26 = arg_40_0 = enumerator.Current;
             if (!(expr_26 is AnimationState))
             {
                 arg_40_0 = RuntimeServices.Coerce(expr_26, typeof(AnimationState));
             }
             AnimationState animationState = (AnimationState)arg_40_0;
             animationState.speed += 0.2f;
             UnityRuntimeServices.Update(enumerator, animationState);
         }
     }
     else if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         IEnumerator enumerator2 = UnityRuntimeServices.GetEnumerator(this.GetComponent <Animation>());
         while (enumerator2.MoveNext())
         {
             object arg_AF_0;
             object expr_95 = arg_AF_0 = enumerator2.Current;
             if (!(expr_95 is AnimationState))
             {
                 arg_AF_0 = RuntimeServices.Coerce(expr_95, typeof(AnimationState));
             }
             AnimationState animationState2 = (AnimationState)arg_AF_0;
             animationState2.speed -= 0.2f;
             UnityRuntimeServices.Update(enumerator2, animationState2);
         }
     }
     if (this.currentClip == 0)
     {
         this.GetComponent <Animation>().CrossFade("walk", 0.2f);
     }
     else if (this.currentClip == 1)
     {
         this.GetComponent <Animation>().CrossFade("run", 0.2f);
     }
     else if (this.currentClip == 2)
     {
         this.GetComponent <Animation>().CrossFade("lookOut", 0.2f);
     }
     if (!this.GetComponent <Animation>().isPlaying)
     {
         this.currentClip++;
         if (this.currentClip == 3)
         {
             this.currentClip = 0;
         }
     }
 }
Exemplo n.º 8
0
 public override void UpdatePlayerPrefs()
 {
     checked
     {
         for (int i = 0; i < 10; i++)
         {
             PlayerPrefs.SetString("Highscore" + i, (string)RuntimeServices.Coerce(this.scoresArray[i], typeof(string)));
             Debug.Log(this.scoresArray[i]);
         }
     }
 }
Exemplo n.º 9
0
        private static Array CreateVarArgsArray(object[] arguments, int minimumArgumentCount, Type varArgsParameterType)
        {
            var length = arguments.Length - minimumArgumentCount;
            var result = Array.CreateInstance(varArgsParameterType, length);

            for (int i = 0; i < result.Length; ++i)
            {
                result.SetValue(RuntimeServices.Coerce(arguments[minimumArgumentCount + i], varArgsParameterType), i);
            }
            return(result);
        }
Exemplo n.º 10
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)));
    }
Exemplo n.º 11
0
    public override void ToggleVisibility()
    {
        object      componentsInChildren = this.get_gameObject().GetComponentsInChildren(typeof(Renderer));
        IEnumerator enumerator           = UnityRuntimeServices.GetEnumerator(componentsInChildren);

        while (enumerator.MoveNext())
        {
            Renderer renderer = (Renderer)RuntimeServices.Coerce(enumerator.get_Current(), typeof(Renderer));
            renderer.set_enabled(!renderer.get_enabled());
            UnityRuntimeServices.Update(enumerator, renderer);
        }
    }
Exemplo n.º 12
0
        public EvaluationScript ActivateScript(Type scriptType)
        {
            object[] args = new object[] { this._context };
            object   obj1 = Activator.CreateInstance(scriptType, args);

            if (!(obj1 is EvaluationScript))
            {
            }
            EvaluationScript script = (EvaluationScript)RuntimeServices.Coerce(obj1, typeof(EvaluationScript));

            this._context.AddScript(script);
            return(script);
        }
Exemplo n.º 13
0
 public override void StopBoosters()
 {
     if (this.instanBoostersExists)
     {
         ParticleEmitter particleEmitter = (ParticleEmitter)RuntimeServices.Coerce(UnityRuntimeServices.Invoke(this.instanBoosters, "GetComponent", new object[]
         {
             "ParticleEmitter"
         }, typeof(MonoBehaviour)), typeof(ParticleEmitter));
         particleEmitter.set_emit(false);
         Object.Destroy((Object)RuntimeServices.Coerce(this.instanBoosters, typeof(Object)), (float)2);
         this.instanBoostersExists = false;
     }
 }
Exemplo n.º 14
0
        public Type GetCachedScript(EvaluationScriptCacheKey key)
        {
            EvaluationDomain domain = this;

            lock (domain)
            {
                object obj1 = this._cache[key];
                if (!(obj1 is Type))
                {
                }
                return((Type)RuntimeServices.Coerce(obj1, typeof(Type)));
            }
        }
Exemplo n.º 15
0
    public void RebuildWaypointList()
    {
        object[] array = Object.FindObjectsOfType(typeof(AutoWayPoint));
        AutoWayPoint.waypoints = new Array(array);
        IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(AutoWayPoint.waypoints);

        while (enumerator.MoveNext())
        {
            AutoWayPoint autoWayPoint = (AutoWayPoint)RuntimeServices.Coerce(enumerator.Current, typeof(AutoWayPoint));
            autoWayPoint.RecalculateConnectedWaypoints();
            UnityRuntimeServices.Update(enumerator, autoWayPoint);
        }
    }
Exemplo n.º 16
0
        public TypeReference TypeFor(Node node)
        {
            object arg_21_0;
            object expr_07 = arg_21_0 = Resolve(node);

            if (!(expr_07 is IType))
            {
                arg_21_0 = RuntimeServices.Coerce(expr_07, typeof(IType));
            }
            IType type = (IType)arg_21_0;

            return(My <BooCodeBuilder> .Instance.CreateTypeReference(type));
        }
 // Token: 0x06000016 RID: 22 RVA: 0x00003A60 File Offset: 0x00001C60
 public virtual void ModelChange(string _name)
 {
     if (!string.IsNullOrEmpty(_name))
     {
         MonoBehaviour.print("ModelChange : " + _name);
         this.curModelName = Path.GetFileNameWithoutExtension(_name);
         GameObject original = (GameObject)Resources.Load(_name, typeof(GameObject));
         UnityEngine.Object.Destroy(this.obj);
         Debug.Log(_name);
         this.obj                    = (((GameObject)UnityEngine.Object.Instantiate(original)) as GameObject);
         this.SM                     = (((SkinnedMeshRenderer)this.obj.GetComponentInChildren(typeof(SkinnedMeshRenderer))) as SkinnedMeshRenderer);
         this.SM.quality             = SkinQuality.Bone4;
         this.SM.updateWhenOffscreen = true;
         int        num             = 0;
         int        i               = 0;
         Material[] sharedMaterials = this.SM.renderer.sharedMaterials;
         int        length          = sharedMaterials.Length;
         while (i < length)
         {
             if (sharedMaterials[i].name == "face02_M")
             {
                 this.SM.renderer.materials[num] = this.faceMat_M;
             }
             else if (sharedMaterials[i].name == "face02_L")
             {
                 this.SM.renderer.materials[num] = this.faceMat_L;
             }
             num++;
             i++;
         }
         IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(this.animTest.animation);
         while (enumerator.MoveNext())
         {
             object obj = enumerator.Current;
             object obj3;
             object obj2 = obj3 = obj;
             if (!(obj2 is AnimationState))
             {
                 obj3 = RuntimeServices.Coerce(obj2, typeof(AnimationState));
             }
             AnimationState animationState = (AnimationState)obj3;
             this.obj.animation.AddClip(animationState.clip, animationState.name);
             UnityRuntimeServices.Update(enumerator, animationState);
         }
         this.viewCam.ModelTarget(this.GetBone(this.obj, this.boneName));
         this.SetAnimation(string.Empty + this.animationList[this.curAnim]);
         this.SetAnimationSpeed(this.animSpeed);
     }
 }
Exemplo n.º 18
0
        public static IEnumerator GetEnumerator(object obj)
        {
            IEnumerator enumerator;

            if (IsValueTypeArray(obj) || (obj is UnityScript.Lang.Array))
            {
                if (!(obj is IList))
                {
                }
                return((obj != null) ? new ListUpdateableEnumerator((IList)RuntimeServices.Coerce(obj, typeof(IList))) : EmptyEnumerator);
            }
            IEnumerable enumerable = obj as IEnumerable;

            return((enumerable == null) ? (((enumerator = obj as IEnumerator) == null) ? RuntimeServices.GetEnumerable(obj).GetEnumerator() : enumerator) : enumerable.GetEnumerator());
        }
Exemplo n.º 19
0
 public Array(params object[] items)
 {
     if ((items.Length == 1) && (items[0] is IEnumerable))
     {
         object obj1 = items[0];
         if (!(obj1 is IEnumerable))
         {
         }
         this.AddRange((IEnumerable) RuntimeServices.Coerce(obj1, typeof(IEnumerable)));
     }
     else
     {
         this.AddRange(items);
     }
 }
Exemplo n.º 20
0
    public void RecalculateConnectedWaypoints()
    {
        this.connected = new Array();
        IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(AutoWayPoint.waypoints);

        while (enumerator.MoveNext())
        {
            AutoWayPoint autoWayPoint = (AutoWayPoint)RuntimeServices.Coerce(enumerator.Current, typeof(AutoWayPoint));
            if (!(autoWayPoint == this))
            {
                if (!Physics.CheckCapsule(this.get_transform().get_position(), autoWayPoint.get_transform().get_position(), AutoWayPoint.kLineOfSightCapsuleRadius))
                {
                    this.connected.Add(autoWayPoint);
                    UnityRuntimeServices.Update(enumerator, autoWayPoint);
                }
            }
        }
    }
    // Token: 0x06000017 RID: 23 RVA: 0x00003C64 File Offset: 0x00001E64
    public virtual void SetAnimationSpeed(float _speed)
    {
        IEnumerator enumerator = UnityRuntimeServices.GetEnumerator(this.obj.animation);

        while (enumerator.MoveNext())
        {
            object obj = enumerator.Current;
            object obj3;
            object obj2 = obj3 = obj;
            if (!(obj2 is AnimationState))
            {
                obj3 = RuntimeServices.Coerce(obj2, typeof(AnimationState));
            }
            AnimationState animationState = (AnimationState)obj3;
            animationState.speed = _speed;
            UnityRuntimeServices.Update(enumerator, animationState);
        }
    }
Exemplo n.º 22
0
        private Dispatcher EmitPropertyDispatcher(PropertyInfo property, SetOrGet gos)
        {
            Type[]     argumentTypes = GetArgumentTypes();
            MethodInfo accessor      = Accessor(property, gos);

            if (null == accessor)
            {
                throw MissingField();
            }
            CandidateMethod found = ResolveMethod(argumentTypes, new MethodInfo[] { accessor });

            if (null == found)
            {
                throw MissingField();
            }

#if NO_SYSTEM_REFLECTION_EMIT
            switch (gos)
            {
            case SetOrGet.Get:
                return((target, args) => property.GetValue(target, args));

            case SetOrGet.Set:
                return((target, args) =>
                {
                    var value = args[args.Length - 1];
                    var remainingArgs = new object[args.Length - 1];
                    Array.Copy(args, remainingArgs, remainingArgs.Length);
                    property.SetValue(target, RuntimeServices.Coerce(value, property.PropertyType), remainingArgs);
                    return value;
                });

            default:
                throw new ArgumentException();
            }
#else
            if (SetOrGet.Get == gos)
            {
                return(new Emitters.MethodDispatcherEmitter(_type, found, argumentTypes).Emit());
            }
            return(new Emitters.SetPropertyEmitter(_type, found, argumentTypes).Emit());
#endif
        }
Exemplo n.º 23
0
        static Dispatcher ReflectionBasedFieldDispatcherFor(FieldInfo field, SetOrGet gos)
        {
            switch (gos)
            {
            case SetOrGet.Get:
                return((target, args) => field.GetValue(target));

            case SetOrGet.Set:
                return((target, args) =>
                {
                    var value = args[0];
                    field.SetValue(target, RuntimeServices.Coerce(value, field.FieldType));
                    return value;
                });

            default:
                throw new ArgumentException();
            }
        }
Exemplo n.º 24
0
 private UnityScript.Lang.Array ConcatImpl(ICollection value, IEnumerable items)
 {
     if (items == null)
     {
         throw new ArgumentNullException("items");
     }
     UnityScript.Lang.Array array = new UnityScript.Lang.Array(this.InnerList);
     array.InnerList.AddRange(value);
     IEnumerator enumerator = items.GetEnumerator();
     while (enumerator.MoveNext())
     {
         object current = enumerator.Current;
         if (!(current is ICollection))
         {
         }
         ICollection c = (ICollection) RuntimeServices.Coerce(current, typeof(ICollection));
         array.InnerList.AddRange(c);
     }
     return array;
 }
Exemplo n.º 25
0
    public static AutoWayPoint FindClosest(Vector3 pos)
    {
        AutoWayPoint result     = null;
        float        num        = 100000f;
        IEnumerator  enumerator = UnityRuntimeServices.GetEnumerator(AutoWayPoint.waypoints);

        while (enumerator.MoveNext())
        {
            AutoWayPoint autoWayPoint = (AutoWayPoint)RuntimeServices.Coerce(enumerator.Current, typeof(AutoWayPoint));
            float        num2         = Vector3.Distance(autoWayPoint.get_transform().get_position(), pos);
            UnityRuntimeServices.Update(enumerator, autoWayPoint);
            if (num2 < num)
            {
                num    = num2;
                result = autoWayPoint;
                UnityRuntimeServices.Update(enumerator, autoWayPoint);
            }
        }
        return(result);
    }
Exemplo n.º 26
0
        private static CodeTypeReference GetType(string name)
        {
            object result;

            if (BooCodeDomConverter._primitives.ContainsKey(name))
            {
                object obj = ((Hashtable)BooCodeDomConverter._primitives)[name];
                if (!(obj is string))
                {
                    obj = RuntimeServices.Coerce(obj, typeof(string));
                }
                result = new CodeTypeReference((string)obj);
            }
            else
            {
                name   = name.Replace("[of ", "[");
                result = new CodeTypeReference(name);
            }
            return((CodeTypeReference)result);
        }
Exemplo n.º 27
0
 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)));
             }
         }
     }
 }
Exemplo n.º 28
0
        private void WriteCommaSeparatedList(object nodes)
        {
            bool        flag       = true;
            IEnumerator enumerator = RuntimeServices.GetEnumerable(nodes).GetEnumerator();

            while (enumerator.MoveNext())
            {
                object arg_33_0;
                object expr_19 = arg_33_0 = enumerator.Current;
                if (!(expr_19 is Node))
                {
                    arg_33_0 = RuntimeServices.Coerce(expr_19, typeof(Node));
                }
                Node node = (Node)arg_33_0;
                if (!flag)
                {
                    Write(", ");
                }
                flag = false;
                Write(node);
            }
        }
Exemplo n.º 29
0
    public AutoWayPoint PickNextWaypoint(AutoWayPoint currentWaypoint)
    {
        Vector3      vector     = this.get_transform().TransformDirection(Vector3.get_forward());
        AutoWayPoint result     = currentWaypoint;
        float        num        = 10f * (float)-1;
        IEnumerator  enumerator = UnityRuntimeServices.GetEnumerator(currentWaypoint.connected);

        while (enumerator.MoveNext())
        {
            AutoWayPoint autoWayPoint = (AutoWayPoint)RuntimeServices.Coerce(enumerator.Current, typeof(AutoWayPoint));
            Vector3      vector2      = Vector3.Normalize(autoWayPoint.get_transform().get_position() - this.get_transform().get_position());
            UnityRuntimeServices.Update(enumerator, autoWayPoint);
            float num2 = Vector3.Dot(vector2, vector);
            if (num2 > num && autoWayPoint != currentWaypoint)
            {
                num    = num2;
                result = autoWayPoint;
                UnityRuntimeServices.Update(enumerator, autoWayPoint);
            }
        }
        return(result);
    }
Exemplo n.º 30
0
 public override void Attack()
 {
     this.get_transform().LookAt(this.player.get_transform());
     this.get_animation().CrossFade("attack");
     if (Time.get_time() > this.nextFire)
     {
         this.nextFire = Time.get_time() + this.fireRate;
         object target = Object.Instantiate(this.fireBall, this.hand.get_position(), this.hand.get_rotation());
         Physics.IgnoreCollision((Collider)RuntimeServices.Coerce(UnityRuntimeServices.GetProperty(target, "collider"), typeof(Collider)), (Collider)RuntimeServices.Coerce(this.get_collider(), typeof(Collider)));
         Vector3 vector   = this.get_transform().TransformDirection(Vector3.get_forward() * (float)20);
         object  property = UnityRuntimeServices.GetProperty(target, "rigidbody");
         RuntimeServices.SetProperty(property, "velocity", vector);
         UnityRuntimeServices.PropagateValueTypeChanges(new UnityRuntimeServices.ValueTypeChange[]
         {
             new UnityRuntimeServices.MemberValueTypeChange(target, "rigidbody", property)
         });
         object target2 = UnityRuntimeServices.Invoke(UnityRuntimeServices.GetProperty(target, "gameObject"), "AddComponent", new object[]
         {
             "BulletScript"
         }, typeof(MonoBehaviour));
         RuntimeServices.SetProperty(target2, "playerShooting", this.get_gameObject());
     }
 }