Exemple #1
0
 public void Update()
 {
     if (RuntimeServices.EqualityOperator(Status.menuMode, "on"))
     {
         DepthOfFieldEffect depthOfFieldEffect = (DepthOfFieldEffect)this.GetComponent(typeof(DepthOfFieldEffect));
         float deltaTime = Time.get_deltaTime();
         if (Input.GetKey("1"))
         {
             depthOfFieldEffect.focalDistance -= (float)5 * deltaTime;
         }
         if (Input.GetKey("2"))
         {
             depthOfFieldEffect.focalDistance += (float)5 * deltaTime;
         }
         if (Input.GetKey("3"))
         {
             depthOfFieldEffect.focalRange -= (float)50 * deltaTime;
         }
         if (Input.GetKey("4"))
         {
             depthOfFieldEffect.focalRange += (float)50 * deltaTime;
         }
         depthOfFieldEffect.focalDistance = Mathf.Clamp(depthOfFieldEffect.focalDistance, 1f, 50f);
         depthOfFieldEffect.focalRange    = Mathf.Clamp(depthOfFieldEffect.focalRange, 1f, 1000f);
     }
 }
Exemple #2
0
 // Token: 0x060003CF RID: 975 RVA: 0x0004C2F8 File Offset: 0x0004A4F8
 public virtual void Update()
 {
     if (!this.HomeYandere.CanMove)
     {
         if (!this.Loaded)
         {
             this.StartCoroutine_Auto(this.PhotoGallery.GetPhotos());
             this.Loaded = true;
         }
         if (!this.PhotoGallery.Adjusting && !this.PhotoGallery.Viewing && !this.PhotoGallery.LoadingScreen.active && Input.GetButtonDown("B"))
         {
             this.HomeCamera.Destination           = this.HomeCamera.Destinations[0];
             this.HomeCamera.Target                = this.HomeCamera.Targets[0];
             this.HomeCamera.CorkboardLabel.active = true;
             this.PhotoGallery.enabled             = false;
             this.HomeYandere.CanMove              = true;
             this.HomeYandere.active               = true;
             this.HomeWindow.Show = false;
             this.enabled         = false;
             this.Loaded          = false;
             if (RuntimeServices.EqualityOperator(UnityRuntimeServices.GetProperty(this.HomeCamera, "DisablePost"), false))
             {
             }
         }
     }
 }
 public override void Reset()
 {
     if (RuntimeServices.EqualityOperator(this.get_collider(), null))
     {
         this.get_gameObject().AddComponent(typeof(BoxCollider));
     }
     RuntimeServices.SetProperty(this.get_collider(), "isTrigger", true);
 }
        public static bool IsArrayArgumentExplicitlyProvided(IParameter[] parameters, ExpressionCollection args)
        {
            IType expressionType = TypeSystemServices.GetExpressionType(args[-1]);
            IType type           = parameters[parameters.Length + -1].Type;

            if (!RuntimeServices.EqualityOperator(expressionType, type))
            {
            }
            return((parameters.Length == args.Count) ? RuntimeServices.EqualityOperator(expressionType, EmptyArrayType.Default) : false);
        }
Exemple #5
0
 public void OnGUI()
 {
     if (RuntimeServices.EqualityOperator(Status.menuMode, "on"))
     {
         DepthOfFieldEffect depthOfFieldEffect = (DepthOfFieldEffect)this.GetComponent(typeof(DepthOfFieldEffect));
         GUILayout.BeginArea(new Rect((float)10, (float)280, (float)250, (float)100), GUI.get_skin().get_window());
         GUILayout.Label("[focal distance]: 1,2:\n Focal distance = " + depthOfFieldEffect.focalDistance.ToString("f1"), new GUILayoutOption[0]);
         GUILayout.Label("[focal range]: 3,4:\n Focal range = " + depthOfFieldEffect.focalRange.ToString("f1"), new GUILayoutOption[0]);
         GUILayout.EndArea();
     }
 }
Exemple #6
0
 public override void OnCollisionEnter(Collision col)
 {
     checked
     {
         if (RuntimeServices.EqualityOperator(UnityRuntimeServices.GetProperty(col.get_gameObject(), "tag"), "free"))
         {
             Debug.Log("I'm FREE!  Thank You Kind Toon!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
             this.numHits++;
             Score.score++;
         }
     }
 }
 // Token: 0x06000255 RID: 597 RVA: 0x00037D08 File Offset: 0x00035F08
 public virtual ActionElementMap GetActionElementMapToUse(Controller controller, string theAction, bool positiveAxis)
 {
     if (!RuntimeServices.EqualityOperator(controller, null))
     {
         ControllerMap      map = this.player.controllers.maps.GetMap(controller.type, controller.id, "Default", "Default");
         ActionElementMap[] elementMapsWithAction = map.GetElementMapsWithAction(theAction);
         int i = 0;
         ActionElementMap[] array = elementMapsWithAction;
         int length = array.Length;
         while (i < length)
         {
             if (array[i].axisContribution == ((!positiveAxis) ? Pole.Negative : Pole.Positive))
             {
                 return(array[i]);
             }
             i++;
         }
         map = this.player.controllers.maps.GetMap(controller.type, controller.id, "Motorcycle", "Default");
         if (!RuntimeServices.EqualityOperator(map, null))
         {
             elementMapsWithAction = map.GetElementMapsWithAction(theAction);
             int j = 0;
             ActionElementMap[] array2 = elementMapsWithAction;
             int length2 = array2.Length;
             while (j < length2)
             {
                 if (array2[j].axisContribution == ((!positiveAxis) ? Pole.Negative : Pole.Positive))
                 {
                     return(array2[j]);
                 }
                 j++;
             }
         }
         map = this.player.controllers.maps.GetMap(controller.type, controller.id, "UI Nav", "Default");
         if (!RuntimeServices.EqualityOperator(map, null))
         {
             elementMapsWithAction = map.GetElementMapsWithAction(theAction);
             int k = 0;
             ActionElementMap[] array3 = elementMapsWithAction;
             int length3 = array3.Length;
             while (k < length3)
             {
                 if (array3[k].axisContribution == ((!positiveAxis) ? Pole.Negative : Pole.Positive))
                 {
                     return(array3[k]);
                 }
                 k++;
             }
         }
     }
     return(null);
 }
Exemple #8
0
 public override void OnCollisionEnter(Collision collision)
 {
     checked
     {
         this.state++;
         if (this.state > 0)
         {
             this.grounded = true;
         }
         if (RuntimeServices.EqualityOperator(UnityRuntimeServices.GetProperty(collision.get_gameObject(), "tag"), "notTray"))
         {
             Object.Destroy(this.get_gameObject());
         }
     }
 }
Exemple #9
0
 public override void Update()
 {
     this.idleWeight = Mathf.Lerp(this.idleWeight, Mathf.InverseLerp(this.minWalkSpeed, this.maxIdleSpeed, this.speed), Time.deltaTime * 10);
     this.animationComponent[this.idle.name].weight = this.idleWeight;
     if (this.speed > 0)
     {
         float           positiveInfinity = float.PositiveInfinity;
         int             index            = 0;
         MoveAnimation[] moveAnimations   = this.moveAnimations;
         int             length           = moveAnimations.Length;
         while (index < length)
         {
             float num2 = Mathf.Abs(Mathf.DeltaAngle(this.angle, moveAnimations[index].angle));
             float num3 = Mathf.Abs((float)(this.speed - moveAnimations[index].speed));
             float num4 = num2 + num3;
             if (RuntimeServices.EqualityOperator(moveAnimations[index], this.bestAnimation))
             {
                 num4 *= 0.9f;
             }
             if (num4 < positiveInfinity)
             {
                 this.bestAnimation = moveAnimations[index];
                 positiveInfinity   = num4;
             }
             index++;
         }
         this.animationComponent.CrossFade(this.bestAnimation.clip.name);
     }
     else
     {
         this.bestAnimation = null;
     }
     if ((this.lowerBodyForward != this.lowerBodyForwardTarget) && (this.idleWeight >= 0.9f))
     {
         this.animationComponent.CrossFade(this.turn.name, 0.05f);
     }
     if ((this.bestAnimation > null) && (this.idleWeight < 0.9f))
     {
         float num5 = Mathf.Repeat((this.animationComponent[this.bestAnimation.clip.name].normalizedTime * 2) + 0.1f, (float)1);
         if ((num5 < this.lastAnimTime) && (Time.time > (this.lastFootstepTime + 0.1f)))
         {
             this.footstepSignals.SendSignals(this);
             this.lastFootstepTime = Time.time;
         }
         this.lastAnimTime = num5;
     }
 }
 public override void OnCollisionEnter(Collision collision)
 {
     checked
     {
         this.bounceCount++;
         if (RuntimeServices.EqualityOperator(UnityRuntimeServices.GetProperty(collision.get_gameObject(), "tag"), "notTray"))
         {
             this.Kill();
         }
         if (this.bounceCount > this.numOfBounces)
         {
             ContactPoint contactPoint = collision.get_contacts()[0];
             Quaternion   quaternion   = Quaternion.FromToRotation(Vector3.get_up(), contactPoint.get_normal());
             Object.Instantiate(this.explosion, contactPoint.get_point(), quaternion);
             this.Kill();
         }
     }
 }
    // Token: 0x06000254 RID: 596 RVA: 0x00037BF4 File Offset: 0x00035DF4
    public virtual Controller GetControllerToUse(bool isKeyboard, bool getMouse)
    {
        Controller controller;

        if (!getMouse)
        {
            controller = this.player.controllers.GetLastActiveController((!isKeyboard) ? ControllerType.Joystick : ControllerType.Keyboard);
            if (RuntimeServices.EqualityOperator(controller, null))
            {
                controller = this.player.controllers.GetController((!isKeyboard) ? ControllerType.Joystick : ControllerType.Keyboard, 0);
            }
        }
        else
        {
            controller = this.player.controllers.GetLastActiveController(ControllerType.Mouse);
            if (RuntimeServices.EqualityOperator(controller, null))
            {
                controller = this.player.controllers.GetController(ControllerType.Mouse, 0);
            }
        }
        if (!isKeyboard && !RuntimeServices.EqualityOperator(controller, null))
        {
            if (controller.name.Contains("Nintendo"))
            {
                if (controller.name.Contains("Pro"))
                {
                    this.gamepadStyle = 1;
                }
                else
                {
                    this.gamepadStyle = 0;
                }
            }
            else if (controller.name.Contains("Sony"))
            {
                this.gamepadStyle = 2;
            }
            else
            {
                this.gamepadStyle = 3;
            }
        }
        return(controller);
    }
 public override void CreateComputeResources()
 {
     if (RuntimeServices.EqualityOperator(this.cbDrawArgs, null))
     {
         this.cbDrawArgs = new ComputeBuffer(1, 16, ComputeBufferType.DrawIndirect);
         int[] data = new int[]
         {
             0,
             1,
             0,
             0
         };
         this.cbDrawArgs.SetData(data);
     }
     if (RuntimeServices.EqualityOperator(this.cbPoints, null))
     {
         this.cbPoints = new ComputeBuffer(90000, 28, ComputeBufferType.Append);
     }
 }
Exemple #13
0
    public static GameObject Spawn(GameObject prefab, Vector3 position, Quaternion rotation)
    {
        ObjectCache lhs = null;
        GameObject  nextObjectInCache;

        if (spawner != null)
        {
            for (int i = 0; i < Extensions.get_length(spawner.caches); i++)
            {
                if (spawner.caches[i].prefab == prefab)
                {
                    lhs = spawner.caches[i];
                }
            }
            nextObjectInCache = lhs.GetNextObjectInCache();
            nextObjectInCache.transform.position = position;
            nextObjectInCache.transform.rotation = rotation;
            nextObjectInCache.SetActive(true);
        }
        return(!RuntimeServices.EqualityOperator(lhs, null) ? nextObjectInCache : (((GameObject)UnityEngine.Object.Instantiate(prefab, position, rotation)) as GameObject));
    }
    // Token: 0x06000256 RID: 598 RVA: 0x00037EB4 File Offset: 0x000360B4
    public virtual string GetInputButtonName(string theAction, bool positiveAxis, bool isKeyboard)
    {
        Controller controllerToUse = this.GetControllerToUse(isKeyboard, false);
        string     result;

        if (!RuntimeServices.EqualityOperator(controllerToUse, null))
        {
            ActionElementMap actionElementMapToUse = this.GetActionElementMapToUse(controllerToUse, theAction, positiveAxis);
            if (RuntimeServices.EqualityOperator(actionElementMapToUse, null))
            {
                if (isKeyboard)
                {
                    controllerToUse = this.GetControllerToUse(isKeyboard, true);
                    if (RuntimeServices.EqualityOperator(controllerToUse, null))
                    {
                        result = this.GetTranslation("inMissing");
                    }
                    else
                    {
                        actionElementMapToUse = this.GetActionElementMapToUse(controllerToUse, theAction, positiveAxis);
                        result = ((!RuntimeServices.EqualityOperator(actionElementMapToUse, null)) ? actionElementMapToUse.elementIdentifierName : "  ");
                    }
                }
                else
                {
                    result = "  ";
                }
            }
            else
            {
                result = actionElementMapToUse.elementIdentifierName;
            }
        }
        else
        {
            result = ((!isKeyboard) ? this.GetTranslation("inNoPad") : this.GetTranslation("inNoKeyb"));
        }
        return(result);
    }
 // Token: 0x0600001F RID: 31 RVA: 0x00003F5C File Offset: 0x0000215C
 public virtual void SetFixedFbx(XmlDocument _xDoc, GameObject _obj, string _model, string _anim, int _lod)
 {
     if (!RuntimeServices.EqualityOperator(_xDoc, null))
     {
         if (!(_obj == null))
         {
             string  xpath   = "Root/Texture[@Lod=''or@Lod='" + _lod + "'][Info[@Model=''or@Model='" + _model + "'][@Ani=''or@Ani='" + _anim + "']]";
             XmlNode xmlNode = _xDoc.SelectSingleNode(xpath);
             if (xmlNode != null)
             {
                 string innerText  = xmlNode.Attributes["Material"].InnerText;
                 string innerText2 = xmlNode.Attributes["Property"].InnerText;
                 string innerText3 = xmlNode.Attributes["File"].InnerText;
                 MonoBehaviour.print("Change Texture To " + innerText + " : " + innerText2 + " : " + innerText3);
                 int        i = 0;
                 Material[] sharedMaterials = this.SM.renderer.sharedMaterials;
                 int        length          = sharedMaterials.Length;
                 while (i < length)
                 {
                     if (sharedMaterials[i] && sharedMaterials[i].name == innerText)
                     {
                         Texture2D texture = (Texture2D)Resources.Load(innerText3, typeof(Texture2D));
                         sharedMaterials[i].SetTexture(innerText2, texture);
                     }
                     i++;
                 }
             }
             xpath = "Root/Animation[@Lod=''or@Lod='" + _lod + "'][Info[@Model=''or@Model='" + _model + "'][@Ani=''or@Ani='" + _anim + "']]";
             XmlNode xmlNode2 = _xDoc.SelectSingleNode(xpath);
             if (xmlNode2 != null)
             {
                 string innerText4 = xmlNode2.Attributes["File"].InnerText;
                 this.curAnimName = innerText4;
                 MonoBehaviour.print("Change Animation To " + this.curAnimName);
                 _obj.animation.Play(this.curAnimName);
             }
         }
     }
 }
Exemple #16
0
 public static void DrawLine(Vector2 start, Vector2 end, Color color, float width)
 {
     if (!RuntimeServices.EqualityOperator(Event.current, null))
     {
         if (Event.current.type == EventType.Repaint)
         {
             Drawing_tc1.point_class point_class = new Drawing_tc1.point_class(start, end);
             Drawing_tc1.CreateMaterial();
             Drawing_tc1.lineMaterial.SetPass(0);
             Vector3 vector  = default(Vector3);
             Vector3 vector2 = default(Vector3);
             if (width == (float)1)
             {
                 GL.Begin(1);
                 GL.Color(color);
                 vector  = new Vector3(start.x, start.y, (float)0);
                 vector2 = new Vector3(end.x, end.y, (float)0);
                 GL.Vertex(vector);
                 GL.Vertex(vector2);
             }
             else
             {
                 GL.Begin(7);
                 GL.Color(color);
                 vector  = new Vector3(end.y, start.x, (float)0);
                 vector2 = new Vector3(start.y, end.x, (float)0);
                 Vector3 b  = (vector - vector2).normalized * width / 2f;
                 Vector3 a  = new Vector3(start.x, start.y, (float)0);
                 Vector3 a2 = new Vector3(end.x, end.y, (float)0);
                 GL.Vertex(a - b);
                 GL.Vertex(a + b);
                 GL.Vertex(a2 + b);
                 GL.Vertex(a2 - b);
             }
             GL.End();
         }
     }
 }
Exemple #17
0
 public override 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(UnityRuntimeServices.GetProperty(UnityRuntimeServices.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());
         }
     }
 }
Exemple #18
0
    public override void OnCollisionEnter(Collision collisionInfo)
    {
        object component = collisionInfo.get_transform().GetComponent("Asteroid");

        if (RuntimeServices.EqualityOperator(component, null))
        {
            component = collisionInfo.get_transform().GetComponent("Asterpinata");
        }
        if (!RuntimeServices.EqualityOperator(component, null))
        {
            Object.Destroy((Object)RuntimeServices.Coerce(collisionInfo.get_gameObject(), typeof(Object)));
        }
        else
        {
            Rigidbody rigidbody = collisionInfo.get_rigidbody();
            if (rigidbody)
            {
                Vector3 vector = default(Vector3);
                vector = new Vector3((float)0, (float)0, (float)1);
                rigidbody.AddForce(vector * this.pushBackForce, 1);
            }
        }
    }
Exemple #19
0
 public override void OnGUI()
 {
     if (this.playerPosition == null)
     {
         object obj = Object.FindObjectOfType(typeof(Ship));
         if (RuntimeServices.EqualityOperator(obj, null))
         {
             return;
         }
         this.playerPosition = (Transform)RuntimeServices.Coerce(UnityRuntimeServices.GetProperty(obj, "transform"), typeof(Transform));
     }
     if (this.powerUpPosition == null && Radar.lookForPowerUp)
     {
         object obj2 = Object.FindObjectOfType(typeof(PowerUp));
         if (!RuntimeServices.EqualityOperator(obj2, null))
         {
             this.powerUpPosition = (Transform)RuntimeServices.Coerce(UnityRuntimeServices.GetProperty(obj2, "transform"), typeof(Transform));
         }
     }
     GUI.DrawTexture(new Rect(this.mapCenter.x - this.mapSize / (float)2, this.mapCenter.y - this.mapSize / (float)2, this.mapSize, this.mapSize), this.radarTexture);
     this.DrawPlayer();
     this.DrawEnemies();
     this.DrawPowerUp();
 }
Exemple #20
0
 public static bool IsEnabledOn(Module module, string pragma) =>
 RuntimeServices.EqualityOperator(true, module[pragma]);
    // Token: 0x06000252 RID: 594 RVA: 0x000373A0 File Offset: 0x000355A0
    public virtual GameObject GetInputSymbolFromButtonName(string inputButtonName, bool isKeyboard)
    {
        object obj = null;

        if (!isKeyboard)
        {
            string text;
            if (inputButtonName == "Right Stick")
            {
                text = "rstick";
            }
            else if (inputButtonName == "Right Stick Left")
            {
                text = "rstick_left";
            }
            else if (inputButtonName == "Right Stick Right")
            {
                text = "rstick_right";
            }
            else if (inputButtonName == "Right Stick Up")
            {
                text = "rstick_up";
            }
            else if (inputButtonName == "Right Stick Down")
            {
                text = "rstick_down";
            }
            else if (inputButtonName == "Right Stick Button")
            {
                text = "r3";
            }
            else if (inputButtonName == "Left Stick")
            {
                text = "lstick";
            }
            else if (inputButtonName == "Left Stick Left")
            {
                text = "lstick_left";
            }
            else if (inputButtonName == "Left Stick Right")
            {
                text = "lstick_right";
            }
            else if (inputButtonName == "Left Stick Up")
            {
                text = "lstick_up";
            }
            else if (inputButtonName == "Left Stick Down")
            {
                text = "lstick_down";
            }
            else if (inputButtonName == "Left Stick Button")
            {
                text = "l3";
            }
            else if ((this.gamepadStyle <= 1 && inputButtonName == "B") || (this.gamepadStyle > 1 && inputButtonName == "A") || inputButtonName == "Cross")
            {
                text = "b1";
            }
            else if ((this.gamepadStyle <= 1 && inputButtonName == "A") || (this.gamepadStyle > 1 && inputButtonName == "B") || inputButtonName == "Circle")
            {
                text = "b2";
            }
            else if ((this.gamepadStyle <= 1 && inputButtonName == "Y") || (this.gamepadStyle > 1 && inputButtonName == "X") || inputButtonName == "Square")
            {
                text = "b3";
            }
            else if ((this.gamepadStyle <= 1 && inputButtonName == "X") || (this.gamepadStyle > 1 && inputButtonName == "Y") || inputButtonName == "Triangle")
            {
                text = "b4";
            }
            else if (inputButtonName == "D-Pad Left")
            {
                text = "dpad_left";
            }
            else if (inputButtonName == "D-Pad Right")
            {
                text = "dpad_right";
            }
            else if (inputButtonName == "D-Pad Up")
            {
                text = "dpad_up";
            }
            else if (inputButtonName == "D-Pad Down")
            {
                text = "dpad_down";
            }
            else if (inputButtonName == "L" || inputButtonName == "Left Shoulder" || inputButtonName == "L1")
            {
                text = "l1";
            }
            else if (inputButtonName == "ZL" || inputButtonName == "Left Trigger" || inputButtonName == "L2")
            {
                text = "l2";
            }
            else if (inputButtonName == "R" || inputButtonName == "Right Shoulder" || inputButtonName == "R1")
            {
                text = "r1";
            }
            else if (inputButtonName == "ZR" || inputButtonName == "Right Trigger" || inputButtonName == "R2")
            {
                text = "r2";
            }
            else if (inputButtonName == "Plus" || inputButtonName == "Start" || inputButtonName == "Options")
            {
                text = "start";
            }
            else if (inputButtonName == "Minus" || inputButtonName == "Back" || inputButtonName == "Share")
            {
                text = "select";
            }
            else if (inputButtonName == "SL" || inputButtonName == "Left SL" || inputButtonName == "Right SL")
            {
                text = "sl";
            }
            else if (inputButtonName == "SR" || inputButtonName == "Left SR" || inputButtonName == "Right SR")
            {
                text = "sr";
            }
            else if (inputButtonName == "Touchpad Button")
            {
                text = "touchpad";
            }
            else
            {
                text = "NONE";
            }
            if (text != "NONE")
            {
                if (this.gamepadStyle == 0)
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/NX/" + text));
                }
                else if (this.gamepadStyle == 1)
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/NX_Pro/" + text));
                }
                else if (this.gamepadStyle == 2)
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/PS/" + text));
                }
                else
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/XB/" + text));
                }
            }
        }
        if ((isKeyboard || RuntimeServices.EqualityOperator(obj, null)) && inputButtonName != null)
        {
            bool flag  = inputButtonName.Contains("Mouse");
            bool flag2 = flag;
            if (flag)
            {
                if (inputButtonName == "Mouse")
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/Mouse"));
                }
                else if (inputButtonName == "Left Mouse Button")
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/MouseLeftClick"));
                }
                else if (inputButtonName == "Right Mouse Button")
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/MouseRightClick"));
                }
                else if (inputButtonName == "Mouse Button 3")
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/MouseScroll"));
                }
                else if (inputButtonName == "Mouse Wheel Up")
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/MouseScrollUp"));
                }
                else if (inputButtonName == "Mouse Wheel Down")
                {
                    obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/MouseScrollDown"));
                }
                else
                {
                    flag = false;
                }
            }
            if (!flag)
            {
                obj = UnityEngine.Object.Instantiate(Resources.Load("HUD/ButtonPrompts/KBM/Key"));
                GameObject    gameObject    = obj as GameObject;
                RectTransform rectTransform = (RectTransform)gameObject.GetComponent(typeof(RectTransform));
                Text          text2         = (Text)rectTransform.Find("KeyText").GetComponent(typeof(Text));
                string        text3;
                if (inputButtonName == "  ")
                {
                    text3 = this.GetTranslation("inNoMap");
                }
                else if (inputButtonName.Length > 2 && inputButtonName != "F10" && inputButtonName != "F11" && inputButtonName != "F12" && inputButtonName != "ESC" && !flag2)
                {
                    text3 = this.GetTranslation(inputButtonName);
                }
                else
                {
                    text3 = inputButtonName;
                }
                text2.text = text3;
                if (text3.Length > 3 || LocalizationManager.CurrentLanguageCode == "zh-CN" || LocalizationManager.CurrentLanguageCode == "zh-TW")
                {
                    float   x         = Mathf.Clamp(text2.preferredWidth + (float)((!(inputButtonName == "Space")) ? 20 : 40), 27.5f, (float)300);
                    Vector2 sizeDelta = rectTransform.sizeDelta;
                    float   num       = sizeDelta.x = x;
                    Vector2 vector    = rectTransform.sizeDelta = sizeDelta;
                }
                if (text3.Length > 1)
                {
                    text2.fontSize = 10;
                }
            }
        }
        return(obj as GameObject);
    }
Exemple #22
0
 public bool IsVoid(Expression e) =>
 RuntimeServices.EqualityOperator(TypeSystemServices.GetExpressionType(e), this.TypeSystemServices.VoidType);
Exemple #23
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;
                            }
                        }
                    }
                }
            }
        }
    }