private void OnAttachBalloon(Balloon pBalloon, GameObject pTack) { GameObject balloonObject = pBalloon.GameObject; Rope rope = balloonObject.transform.GetChild(0).GetComponent<Rope>(); Rigidbody2D tackBody = pTack.GetComponent<Rigidbody2D> (); AttachRopeToCharacter (balloonObject, rope, tackBody); }
public void OnTriggerBalloon(Balloon pBalloon) { if (pBalloon != null && pBalloon.GameObject == mBalloon.GameObject) { mBalloon.Physics.PopBalloon(); } }
void INumberState.Update(Microsoft.Xna.Framework.GameTime gameTime) { defaultMoveTweener.Update(gameTime); Owner.Y = (int)defaultMoveTweener.Position; //TODO: Maybe dirty, should use OnHandCollide somehow, because I query the colliding hand two times, once in number and then here var hand = (PlayerHand)Owner.GetFirstCollidingEntity("hand"); if (hand != null && (hand.Player == Owner.Owner || Owner.Owner == null) && hand.DraggingBalloon == null) { if (Configuration.GRABBING_ENABLED) { if (hand.IsGrabbing) { var balloon = new Balloon(hand.X, hand.Y, Owner.Number); hand.Screen.AddEntity(balloon); hand.Grab(balloon); } } else { hoverTime += (float)gameTime.ElapsedGameTime.TotalSeconds; } } else { hoverTime = 0; } if (hoverTime > maxHoverTime) { var balloon = new Balloon(hand.X, hand.Y, Owner.Number); hand.Screen.AddEntity(balloon); hand.Grab(balloon); } }
void Start () { _instance = this; //StartCoroutine(AnimationCore()); var uiSprite = GetComponent<UISprite>(); uiSprite.alpha = 0.0f; }
private void OnDropBalloon(Balloon pBalloon) { if (pBalloon.GameObject == mBalloon.GameObject && !pBalloon.Physics.IsAttached) { Vector2 position = transform.position; EventService.DispatchEvent(EGameEvent.ATTEMPT_ATTACH_BALLOON, pBalloon, position); } }
void Update() { //if pause is on, we cannot drag them if (!menuScript.pause) { //we use raycast to catch the drag collider if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.mainCamera.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.layer == 8) { objectGo = hit.collider.gameObject; onDrag = true; } } } //If we clicked or touched now the balloon position belongs to our cursor o finger position if (onDrag) { posMouse = Camera.mainCamera.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.mainCamera.nearClipPlane + 30)); if (objectGo != null) { ballonScript = objectGo.transform.root.gameObject.GetComponent<Balloon>(); if (ballonScript.Idballoon == "red" || ballonScript.Idballoon == "green" || ballonScript.Idballoon == "blue" || ballonScript.Idballoon == "yellow") { faceManager = objectGo.transform.root.GetComponentInChildren<FaceManager>(); } if (faceManager != null) { faceManager.gameObject.renderer.material.mainTexture = faceManager.facesList[1]; } objectGo.transform.position = posMouse; } else { onDrag = false; } } // //If we stop dragging now the balloon has his own position if (Input.GetMouseButtonUp(0)) { onDrag = false; if (objectGo != null) { ballonScript = objectGo.transform.root.gameObject.GetComponent<Balloon>(); ballonScript.aceleration = -1; if (ballonScript.Idballoon == "red" || ballonScript.Idballoon == "green" || ballonScript.Idballoon == "blue" || ballonScript.Idballoon == "yellow") { randomFace = Random.Range(0, 11); faceManager.gameObject.renderer.material.mainTexture = faceManager.facesList[randomFace]; } objectGo = null; } } // } }
// Update is called once per frame void Update() { //we use OverlapSphere to manage a radius and wich elements are we going to catch arrayList = Physics.OverlapSphere(this.transform.position, 3, headMask); //For every balloon near the Refresher, we change the color for (int i = 0; i < arrayList.Length; i++) { ballon = arrayList[i].GetComponent<Balloon>(); if (ballon.Idballoon == "red" || ballon.Idballoon == "yellow" || ballon.Idballoon == "blue" || ballon.Idballoon == "green") { if (selectColor == 0) { ballon.renderer.material.mainTexture = ballonTxt[0]; ballon.Idballoon = "red"; } if (selectColor == 1) { ballon.renderer.material.mainTexture = ballonTxt[1]; ballon.Idballoon = "blue"; } if (selectColor == 2) { ballon.renderer.material.mainTexture = ballonTxt[2]; ballon.Idballoon = "green"; } if (selectColor == 3) { ballon.renderer.material.mainTexture = ballonTxt[3]; ballon.Idballoon = "yellow"; } } } // }
protected override void AttachBalloon(Balloon pBalloon) { base.AttachBalloon (pBalloon); if (pBalloon.Type == EBalloonType.FLYING) { mIsFlying = true; } }
public override void DetachBalloon(Balloon pBalloonToDetach) { base.DetachBalloon (pBalloonToDetach); if (pBalloonToDetach.Type == EBalloonType.FLYING) { mIsFlying = false; } }
//Simple collision detection void OnTriggerEnter(Collider c) { if (c.collider.gameObject.layer == 9) { hitObject = c.collider.gameObject.GetComponent<Balloon>(); GameObject particleProv = (GameObject)GameObject.Instantiate(particle); particleProv.transform.position = hitObject.transform.position; if (hitObject.Idballoon == "red") { particleProv.renderer.material.mainTexture = particleTexture[0]; } if (hitObject.Idballoon == "blue") { particleProv.renderer.material.mainTexture = particleTexture[1]; } if (hitObject.Idballoon == "green") { particleProv.renderer.material.mainTexture = particleTexture[2]; } if (hitObject.Idballoon == "yellow") { particleProv.renderer.material.mainTexture = particleTexture[3]; } if (menuScript.survivorMode) { menuScript.scoreScript.SurvivorDestroyed(); } soundScript.PlaySound(33, false, 0.5f); Destroy(hitObject.gameObject); } }
public virtual void DestroyBalloon(Balloon pBalloon) { DetachBalloon(pBalloon); Destroy(pBalloon.gameObject); Destroy(pBalloon.Physics); EventService.DispatchEvent (EGameEvent.DROP_BALLOON, pBalloon); }
public override void DestroyBalloon(Balloon pBalloon) { base.DestroyBalloon (pBalloon); if (GetLifeBalloonCount() <= 0) { EventService.DispatchEvent(EGameEvent.GAME_OVER); } }
public override void DetachBalloon(Balloon pBalloonToDetach) { if (pBalloonToDetach.Type.Equals (EBalloonType.LIFE)) { mNumberOfLifeBalloons--; } else { mNumberOfSpecialBalloons--; } base.DetachBalloon (pBalloonToDetach); }
public void OnTriggerBalloon(Balloon pBalloon) { if (pBalloon != null && pBalloon.GameObject == mBalloon.GameObject) { mIsDeflating = true; PreventAttaching(); //Start emission of "spray" particles } }
private void DropBalloon() { if (mTouchedBalloonObject != null && mTouchedBalloon != null) { EventService.DispatchEvent(EGameEvent.DROP_BALLOON, mTouchedBalloon); mTouchedBalloonObject = null; mTouchedBalloonPhysics = null; mTouchedBalloon = null; mIsJumpCommand = false; } }
private void OnAttachBalloon(Balloon pBalloon, GameObject pTack) { if (((Balloon)pBalloon).GameObject == mBalloon.GameObject) { MoveableObject flyingObject = mBalloon.BalloonHolder.Owner.GetComponent<MoveableObject>(); if(flyingObject != null) { mIsAttachedToMoveableObject = true; AllowFlight (flyingObject); DisallowDetach(); } } }
public void TestRespondToInteraction() { Position position = new Position(23, 34); GameObject balloon = new Balloon(position, '2', Colour.Green); balloon.RespondToInteraction(); bool actual = balloon.IsDestroyed; bool expected = true; Assert.AreEqual(expected, actual); }
public void TestUpdatePosition() { Position position = new Position(17, 42); GameObject balloon = new Balloon(position, '1', Colour.Red); Position vectorChange = new Position(20, -3); balloon.UpdatePosition(vectorChange); Position actual = balloon.Position; Position expected = new Position(37, 39); Assert.AreEqual(expected, actual); }
void INumberState.Update(Microsoft.Xna.Framework.GameTime gameTime) { defaultMoveTweener.Update(gameTime); Owner.Y = (int)defaultMoveTweener.Position; //TODO: Maybe dirty, should use OnHandCollide somehow, because I query the colliding hand two times, once in number and then here var hand = (PlayerHand)Owner.GetFirstCollidingEntity("hand"); // nicht so ganz sicher warum/ob das funktioniert //if (hand != null && (hand.Player == Owner.Owner || Owner.Owner == null) && hand.DraggingBalloon == null && hand.Pressing) { if (hand != null && hand.DraggingBalloon == null && hand.Pressing) { var balloon = new Balloon((int)hand.X, (int)hand.Y, Owner.Number); hand.Screen.AddEntity(balloon); hand.Grab(balloon); } }
public BalloonDeathEmitter(Balloon balloon) : base(balloon.GetCenter().X + 25, balloon.GetCenter().Y + 25, balloon.z - 0.1f) { this.particleScale = 2f; this.particlesPerTick = 25; this.lifespanMS = 900; this.ticksPerSecond = 1; this.particleSpeedX = -2f; this.particleSpeedY = -1.33f; this.particleRandomSpeedX = 4f; this.particleRandomSpeedY = 6f; this.particleLifespanMS = 500; this.fadeAccordingToLifespan = true; this.particleGravity = 0.75f; this.particleScale = 0.15f; switch (balloon.color) { case Balloon.BalloonColor.Black: this.particleTexture = BALLOON_DEATH_PARTICLE_BLACK; break; case Balloon.BalloonColor.Blue: this.particleTexture = BALLOON_DEATH_PARTICLE_BLUE; break; case Balloon.BalloonColor.Yellow: this.particleTexture = BALLOON_DEATH_PARTICLE_YELLOW; break; case Balloon.BalloonColor.Pink: this.particleTexture = BALLOON_DEATH_PARTICLE_PINK; break; } this.balloon = balloon; this.blendState = BlendState.AlphaBlend; }
public void OnAttachBalloon(Balloon pBalloon, GameObject pTack) { if(pBalloon == mBalloon) { mDistanceJoint.enabled = true; mBalloonJoint.enabled = true; mLineRenderer.enabled = true; mIsAttached = true; mTack = pTack; } }
void balloonDestroy(object args) { Balloon balloon = (Balloon)args; _bollons.Remove(balloon); }
public override void SayHello() { Balloon.SetActive(true); text.text = "oink oink"; }
private void OnBalloonGiven(Balloon pBalloon) { AddGreyScale(mStepValue); }
public void EatLeaves() { Balloon.SetActive(true); text.text = herbivoreEatText; }
private void SetBalloonProperties(Balloon pBalloon, BalloonPhysics pPhysic, int pBalloonIndex) { pBalloon.SetBalloonHolder(this); pBalloon.SetBalloonIndex (pBalloonIndex); pPhysic.SetTack(m_Tack); }
void Start() { Application.targetFrameRate = 60; _controllerOffsetPosition = _positionOffsetRightHand; // Get a reference to the HandheldControllerBridge Monobehaviour _controllerBridge = handheldControllerBridge.GetComponent <HandheldControllerBridge>(); // OPTIONAL: How many data packages to retain. Set to 0 if you only want to have access to the most recent data package received from the controller. // _controllerBridge.SetDataStorageSize( 10 ); // OPTIONAL: Override the deafult calibration time here. // _controllerBridge.SetCalibrationDelayTime( 4f ); // OPTIONAL: override Service and Characteristic UUIDs here: // _controllerBridge.SetBLEService( "0000fe55-0000-1000-8000-00805f9b34fb" ); // _controllerBridge.SetBLECharacteristic( "00000001-1000-1000-8000-00805f9b34fb" ); ///////////////////////// // Used for calculating the achieved FPS _frameTimeLast = Time.time; _frameTimeNext = Time.time + 1f; // Configure the Canvas UIs _controllerBridgeCanvas = GameObject.Find("Canvas"); _autoConnectBtn = _controllerBridgeCanvas.transform.Find("AutoConnectButton").GetComponent <Button>(); _autoConnectBtn.onClick.AddListener(AutoConnectBtnClickedHandler); _autoConnectBtn.enabled = true; _fpsCanvas = GameObject.Find("CanvasFPS"); _autoConnectStatusLabel = _fpsCanvas.transform.Find("FPSLabel").GetComponent <Text>(); _autoConnectStatusLabel.text = "FPS: Default"; _statusLabel = _controllerBridgeCanvas.transform.Find("StatusMsg").GetComponent <Text>(); _statusLabel.text = _statusMsgStart; _scanBtn = _controllerBridgeCanvas.transform.Find("ScanButton").GetComponent <Button>(); _scanBtn.onClick.AddListener(ScanBtnClickedHandler); _scanBtn.enabled = true; _dropDownGO = _controllerBridgeCanvas.transform.Find("Dropdown").gameObject; _devicesDropdown = _dropDownGO.GetComponent <Dropdown>(); _devicesDropdown.captionText.text = _dropdownCaptionStart; _devicesDropdown.onValueChanged.AddListener(DevicesDropDownSelectedHandler); _devicesDropdown.enabled = false; _connectBtn = _controllerBridgeCanvas.transform.Find("ConnectButton").GetComponent <Button>(); _connectBtn.onClick.AddListener(ConnectBtnClickedHandler); _connectBtn.enabled = false; _disconnectBtn = _controllerBridgeCanvas.transform.Find("DisconnectButton").GetComponent <Button>(); _disconnectBtn.onClick.AddListener(DisconnectBtnClickedHandler); _disconnectBtn.enabled = true; _handheldControllerCanvas = GameObject.Find("CanvasResults"); _handheldControllerValues = _handheldControllerCanvas.GetComponentsInChildren <Text>(); int i; for (i = 0; i < 22; i++) { _handheldControllerValues[i].text = string.Format("default: {0}", i); } _balloonScripts = new List <Balloon>(); for (i = 0; i < balloonCount; i++) { GameObject tBalloon = Instantiate(Resources.Load <GameObject>("Balloon")); Balloon tBalloonScript = tBalloon.GetComponent <Balloon>(); tBalloonScript.InitializeValues(xPosMin, xPosMax, yPosMin, yPosMax, zPosMin, zPosMax, yVelMin, yVelMax); StartCoroutine(tBalloonScript.ResetBalloon(false)); tBalloonScript.CustomizeInitialAppearance(balloonScale); _balloonScripts.Add(tBalloonScript); } _controllerDisplayLaser = controllerDisplay.transform.Find("beam").gameObject; // Subscribe to the Up/Down button Actions _controllerBridge.TouchBtnDown += TouchBtnDownHandler; _controllerBridge.TouchBtnUp += TouchBtnUpHandler; _controllerBridge.MainBtnDown += MainBtnDownHandler; _controllerBridge.MainBtnUp += MainBtnUpHandler; _controllerBridge.AppBtnDown += AppBtnDownHandler; _controllerBridge.AppBtnUp += AppBtnUpHandler; _controllerBridge.AppBtnUp += ChangeCanvasDisplayHandler; _controllerBridge.HomeBtnDown += HomeBtnDownHandler; _controllerBridge.HomeBtnUp += HomeBtnUpHandler; _controllerBridge.VolPlusBtnDown += VolPlusBtnDownHandler; _controllerBridge.VolPlusBtnUp += VolPlusBtnUpHandler; _controllerBridge.VolMinusBtnDown += VolMinusBtnDownHandler; _controllerBridge.VolMinusBtnUp += VolMinusBtnUpHandler; // Subscribe to each BLE state change on _controllerBridge _controllerBridge.BLEActive += BLEActiveHandler; _controllerBridge.BLEInactive += BLEInactiveHandler; _controllerBridge.BLEConnecting += BLEConnectingHandler; _controllerBridge.BLEConnectionComplete += BLEConnectionCompleteHandler; _controllerBridge.BLEScanning += BLEScanningHandler; _controllerBridge.BLEScanComplete += BLEScanCompleteHandler; // Respond to Controller Calibration state changes _controllerBridge.DelayedCalibrationBegan += ControllerCalibrationBeganHandler; _controllerBridge.DelayedCalibrationCancelled += ControllerCalibrationCancelledHandler; _controllerBridge.CalibrationComplete += ControllerCalibrationCompleteHandler; }
public override void SayHello() { Balloon.SetActive(true); text.text = "splash"; }
public void EatMeat() { Balloon.SetActive(true); text.text = "nomnomnom thx mate"; }
/// <summary> /// creation of a balloon. Select a linear drawing curve and run the sample /// </summary> /// <remarks></remarks> public void CreateBalloon() { // Set a reference to the drawing document. // This assumes a drawing document is active. DrawingDocument oDrawDoc = (DrawingDocument)_InvApplication.ActiveDocument; // Set a reference to the active sheet. Sheet oActiveSheet = oDrawDoc.ActiveSheet; // Set a reference to the drawing curve segment. // This assumes that a drwaing curve is selected. DrawingCurveSegment oDrawingCurveSegment = oDrawDoc.SelectSet[1]; // Set a reference to the drawing curve. DrawingCurve oDrawingCurve = oDrawingCurveSegment.Parent; // Get the mid point of the selected curve // assuming that the selection curve is linear Point2d oMidPoint = oDrawingCurve.MidPoint; // Set a reference to the TransientGeometry object. TransientGeometry oTG = _InvApplication.TransientGeometry; ObjectCollection oLeaderPoints = _InvApplication.TransientObjects.CreateObjectCollection(); // Create a couple of leader points. oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 10)); oLeaderPoints.Add(oTG.CreatePoint2d(oMidPoint.X + 10, oMidPoint.Y + 5)); // Add the GeometryIntent to the leader points collection. // This is the geometry that the balloon will attach to. GeometryIntent oGeometryIntent = oActiveSheet.CreateGeometryIntent(oDrawingCurve); oLeaderPoints.Add(oGeometryIntent); // Set a reference to the parent drawing view of the selected curve DrawingView oDrawingView = oDrawingCurve.Parent; // Set a reference to the referenced model document Document oModelDoc = oDrawingView.ReferencedDocumentDescriptor.ReferencedDocument; // Check if a partslist or a balloon has already been created for this model bool IsDrawingBOMDefined = false; IsDrawingBOMDefined = oDrawDoc.DrawingBOMs.IsDrawingBOMDefined(oModelDoc.FullFileName); Balloon oBalloon = null; if (IsDrawingBOMDefined) { // Just create the balloon with the leader points // All other arguments can be ignored oBalloon = oDrawDoc.ActiveSheet.Balloons.Add(oLeaderPoints); } else { // First check if the 'structured' BOM view has been enabled in the model // Set a reference to the model's BOM object AssemblyDocument oAssDoc = (AssemblyDocument)oModelDoc; AssemblyComponentDefinition oComDef = oAssDoc.ComponentDefinition; BOM oBOM = oComDef.BOM; if (oBOM.StructuredViewEnabled) { // Level needs to be specified // Numbering options have already been defined // Get the Level ('All levels' or 'First level only') // from the model BOM view - must use the same here PartsListLevelEnum Level = default(PartsListLevelEnum); if (oBOM.StructuredViewFirstLevelOnly) { Level = PartsListLevelEnum.kStructured; } else { Level = PartsListLevelEnum.kStructuredAllLevels; } // Create the balloon by specifying just the level oBalloon = oActiveSheet.Balloons.Add(oLeaderPoints, null, Level); } else { // Level and numbering options must be specified // The corresponding model BOM view will automatically be enabled NameValueMap oNumberingScheme = _InvApplication.TransientObjects.CreateNameValueMap(); // Add the option for a comma delimiter oNumberingScheme.Add("Delimiter", ","); // Create the balloon by specifying the level and numbering scheme oBalloon = oActiveSheet.Balloons.Add(oLeaderPoints, null, PartsListLevelEnum.kStructuredAllLevels, oNumberingScheme); } } }
public void EatLeaves() { Balloon.SetActive(true); text.text = "munch munch lovely"; }
public override void SayHello() { Balloon.SetActive(true); text.text = ".........bruh.........."; }
public override void SceneLoop() { if (cameraNaturalMovement) { Camera myCamera = Camera.main; float heroesMidPoint = (heroFastRigidbody.position.x + heroStrongRigidbody.position.x) / 2; Vector3 positionTarget = new Vector3(heroesMidPoint, myCamera.transform.position.y, myCamera.transform.position.z); myCamera.transform.position = Vector3.SmoothDamp(myCamera.transform.position, positionTarget, ref vel, 0.7f); } if (heroFast.transform.position.x > heroStrong.transform.position.x) { direction = 1; } else { direction = -1; } if (!RunsOnce) { RunsOnce = true; switch (action) { case 0: RunsOnce = false; if ((Mathf.Abs(heroFastRigidbody.position.x - heroStrongRigidbody.position.x)) > 4.0f) { heroStrong.Move(direction * 0.32f); heroFast.Move(direction * -0.10f); break; } heroFast.StopWalk(); AdvanceInScene(); break; case 1: Balloon _ballonInstance = Instantiate(dialog.balloonPrefab); _ballonInstance.Init(dialog.senteces[0], AdvanceInScene); AdvanceInScene(); break; case 2: RunsOnce = false; if (TimeElapsed_ms(timeAct) > 360) { heroStrong.StopWalk(); } break; case 3: RunsOnce = false; if (TimeElapsed_ms(timeAct) > 240) { heroStrong.Move(direction * 0.10f); heroStrong.StopWalk(); StartCoroutine(WaitSecondsToAction(1)); RunsOnce = true; } break; case 4: Balloon ballonInstance = Instantiate(dialog.balloonPrefab); ballonInstance.Init(dialog.senteces[1], AdvanceInScene); break; case 5: ballonInstance = Instantiate(dialog.balloonPrefab); ballonInstance.Init(dialog.senteces[2], AdvanceInScene); break; case 6: RunsOnce = false; if (heroStrongRigidbody.position.x < (heroFastRigidbody.position.x - 2)) { heroFast.Move(direction * -0.20f); break; } heroStrong.StopWalk(); heroFast.StopWalk(); heroFast.Crouch(); AdvanceInScene(); break; case 7: RunsOnce = false; if (TimeElapsed_ms(timeAct) > 750) { AdvanceInScene(); } break; case 8: ballonInstance = Instantiate(dialog.balloonPrefab); ballonInstance.Init(dialog.senteces[3], AdvanceInScene); break; case 9: heroStrong.Move(direction * -0.05f); heroStrong.StopWalk(); ballonInstance = Instantiate(dialog.balloonPrefab); ballonInstance.Init(dialog.senteces[4], AdvanceInScene); break; case 10: heroFast.Move(direction * 0.05f); heroFast.StopWalk(); ballonInstance = Instantiate(dialog.balloonPrefab); ballonInstance.Init(dialog.senteces[5], AdvanceInScene); break; case 11: heroStrong.Move(direction * 0.05f); heroStrong.StopWalk(); ballonInstance = Instantiate(dialog.balloonPrefab); ballonInstance.Init(dialog.senteces[6], FixedUpdate); StartCoroutine(WaitSecondsToAction(1)); break; case 12: heroFast.Move(direction * -0.05f); heroFast.StopWalk(); StartCoroutine(WaitSecondsToAction(1)); break; case 13: heroFast.StandUp(); StartCoroutine(WaitSecondsToAction(1)); break; case 14: RunsOnce = false; if ((heroFastRigidbody.position.x > heroStrongRigidbody.position.x + 1) || (heroFastRigidbody.position.x < heroStrongRigidbody.position.x - 1)) { heroFast.Move(direction * -0.08f); heroStrong.Move(direction * 0.08f); } else { heroFast.StopWalk(); heroStrong.StopWalk(); // TODO: Hug animation AdvanceInScene(); } break; case 15: RunsOnce = false; Camera myCamera = Camera.main; if (TimeElapsed_ms(timeAct) < 6500) { heroFast.Move(-0.2f); heroStrong.Move(-0.3f); } else { heroFast.StopWalk(); heroStrong.StopWalk(); AdvanceInScene(); } cameraNaturalMovement = false; Vector3 positionTarget = new Vector3(myCamera.transform.position.x, myCamera.transform.position.y + 2f, myCamera.transform.position.z); myCamera.transform.position = Vector3.SmoothDamp(myCamera.transform.position, positionTarget, ref vel, 0.8f); break; case 16: StartCoroutine(WaitSecondsToAction(2)); break; default: EndScene(); break; } } }
void Update() { // Measure Unity's achieved FPS _frameCount++; if (Time.time > _frameTimeNext) { _measuredFPS = _frameCount / (Time.time - _frameTimeLast); _frameCount = 0; _frameTimeLast = Time.time; _frameTimeNext = Time.time + 1f; } DisplayControllerValues(); // When orienting, rotate handheld controller display towards the Forward direction, otherwise rotate it according to the // rotation value stored in the ControllerPlugin. // Color changes of laser are handled elsewhere when event Actions on the HandheldControllerBridge are Invoked // Only change the color in response to Actions, not continually. if (!_controllerBridge.IsCalibrationDelayActive) { controllerDisplay.transform.localRotation = _controllerBridge.GetRotation(); } else { controllerDisplay.transform.localRotation = Quaternion.identity; } // Move the on-screen controller when the headset moves controllerDisplay.transform.position = Camera.main.transform.position + _controllerOffsetPosition; // Laser hit detection/reaction _ray.origin = controllerDisplay.transform.position; Vector3 tTargetDirection = controllerDisplay.transform.forward; _ray.direction = tTargetDirection; if (Physics.Raycast(_ray, out _hit)) { if (_hit.collider.transform.parent.name == "Balloon(Clone)") { GameObject tExplosion = (GameObject)Instantiate(Resources.Load("Ef_SparksParticle_01"), _hit.collider.transform.position, _hit.collider.transform.rotation); Gradient grad = new Gradient(); Color tBalloonColor = _hit.collider.transform.GetComponentInParent <Balloon>().GetBalloonColor(); grad.SetKeys( new GradientColorKey[] { new GradientColorKey(Color.white, 0.0f), new GradientColorKey(tBalloonColor, 0.15f), new GradientColorKey(tBalloonColor, 1.0f) }, new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0), new GradientAlphaKey(1.0f, 0.75f), new GradientAlphaKey(0.0f, 1.0f) } ); ParticleSystem.ColorOverLifetimeModule tColorOverLifetime = tExplosion.GetComponent <ParticleSystem>().colorOverLifetime; tColorOverLifetime.color = new ParticleSystem.MinMaxGradient(grad); tColorOverLifetime.enabled = true; Destroy(tExplosion, 3f); Balloon tBalloon = _hit.collider.transform.GetComponentInParent <Balloon>(); // Reset with a delay so the sound plays in the current position. StartCoroutine(tBalloon.ResetBalloon()); } } }
public void OnPickupBalloon(Balloon pBalloon) { if (mBalloon == pBalloon) { mIsTouched = true; IgnoreOtherBalloonCollision(); mRigidbody2D.gravityScale = 0; mRigidbody2D.drag = 0; } }
public override void SayHello() { Balloon.SetActive(true); text.text = "roooaoaaaaar"; }
public void OnAttemptAttachBalloon(Balloon pBalloon, Vector2 pPosition) { if (CountBalloons () < m_MaxBalloonCount) { Collider2D[] touchedColliders = Physics2D.OverlapCircleAll (pPosition, 1f); Collider2D thisCollider = m_Tack.transform.parent.GetComponent<Collider2D> (); for(int i = 0; i < touchedColliders.Length; i++) { if(touchedColliders[i] == thisCollider && !pBalloon.Physics.IsAttached) { pBalloon.Physics.DetachBalloon(); AttachBalloon (pBalloon); break; } } } }
public void Update() { if ((DateTime.Now - lastCheck).TotalSeconds > refreshInterval) { lastCheck = DateTime.Now; List <Tweet> fresh = twitter.FetchTweets(); if (fresh != null && fresh.Count > 0) { foreach (Tweet t in fresh) { Alert newAlert = null; string tweetText = t.Text; Console.WriteLine(t.Text); Match match = Regex.Match(tweetText, @"([A-Za-z\s\-)]+) (\([A-Za-z\s]+\)): ([A-Za-z\t\s\']+) - ([0-9]+)m - ([0-9]+)cr[\t\s]?-?[\s]?([A-Za-z\t\s\(\)]+)?", RegexOptions.IgnoreCase); if (match.Success) { string location = match.Groups[1].Value + " " + match.Groups[2].Value; string title = match.Groups[3].Value; string duration = match.Groups[4].Value; string credits = match.Groups[5].Value; string reward = match.Groups[6].Value; Console.WriteLine(reward); newAlert = new Alert(location, title, duration, credits, reward, t.Created, GetEndTime(t.Created, duration)); } if (newAlert != null) { DateTime Expires = newAlert.Expires; DateTime Now = DateTime.Now; TimeSpan Remaining = Expires - Now; newAlert.Remaining = Remaining; if (!ProgramOptions.ShowAll && ProgramOptions.MinCredits > Int32.Parse(newAlert.Credits) && newAlert.Reward != null) { newAlert.Show = false; } if (Remaining.Minutes > 1 && newAlert.Show) { list.Add(newAlert); App.Current.Dispatcher.BeginInvoke((Action) delegate() { Balloon balloon = new Balloon(); balloon.DataContext = newAlert; taskbarIcon.ShowCustomBalloon(balloon, PopupAnimation.Slide, 99999999); viewList.Add(newAlert); if (ProgramOptions.PlaySound) { sp = new SoundPlayer(ProgramOptions.Sound); sp.Stream.Position = 0; sp.Play(); } }); } } } if (OnAlert != null) { OnAlert.Invoke(); } } } }
public virtual void DetachBalloon(Balloon pBalloonToDetach) { mBalloons.Remove (pBalloonToDetach); }
void destroyNormally(Balloon balloon) { m_score += Mathf.RoundToInt(balloon.transform.localScale.sqrMagnitude * 10); // more score for larger balloon as reward m_scoreText.GetComponent <Text>().text = m_score.ToString(); }
public override void SayHello() { Balloon.SetActive(true); text.text = "rraaarww"; }
public void EatMeat() { Balloon.SetActive(true); text.text = "loltyler1.com discount code alpha"; }
public void Respawn(Balloon balloon) { AudioManager.Instance.PlaySpawnObject(); balloon.transform.position = this.NewPosition(balloon is LightbulbBalloon); balloon.gameObject.SetActive(true); }
public override void SayHello() { Balloon.SetActive(true); text.text = "im tyler mfkn 1"; }
// Update is called once per frame void Update() { if (!_isGameStart) { return; } _shootTimer += Time.deltaTime; if (_currentBalloon == null && _shootTime <= _shootTimer) { _currentBalloon = randomGenerateBalloon(); _currentBalloon.transform.position = _shooter.position; } _shooterLerpTimer += Time.deltaTime; float prograss = _shooterLerpTimer / _shooterLerpTime; _shooter.position = Vector3.Lerp(_oriShooterPos, _shooterTargetPos, prograss); if (_currentBalloon != null) { _currentBalloon.transform.position = _shooter.position; } var currentTime = Time.time; float nearestTime = -1; var shouldWarning = false; _finishImage.enabled = false; foreach (var balloon in _bollons) { if (balloon.isFinishShooting && balloon.inFinishAreaTime > 0) { _finishImage.enabled = true; shouldWarning = true; var diff = currentTime - balloon.inFinishAreaTime; if (diff > nearestTime) { nearestTime = diff; } } if (balloon.isFinishShooting && !_finishImage.enabled) { if (balloon.transform.position.y - _finishTransform.position.y < 2) { _finishImage.enabled = true; } } } if (shouldCheckFinish()) { if (shouldWarning) { float leftTime = _finishTime - nearestTime; if (leftTime > 0f) { EventUtil.SendMessage(BallonEventType.GameoverWarning, Mathf.CeilToInt(leftTime)); } else if (_gameState != GameState.ReadyToFinish) { _gameState = GameState.ReadyToFinish; EventUtil.SendMessage(BallonEventType.ReadyToFinish); } } else { EventUtil.SendMessage(BallonEventType.CancleGameoverWarning); } } }
public override void SayHello() { Balloon.SetActive(true); text.text = "RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWR"; }
private void ParseMap(ref Map map, World world, ContentManager content, out Vector2 unoPos, out ExitPortal exit) { var layerCount = map.Layers.Count; Vector2 tempUnoPos = new Vector2(); ExitPortal tmpExitPortal = null; xTile.Layers.Layer platformLayer = map.Layers.First((x) => x.Id == "Platform Layer"); xTile.Layers.Layer moveablePlatformLayer = map.Layers.First((x) => x.Id == "Movable Platform Layer"); xTile.Layers.Layer zoneLayer = map.Layers.First((x) => x.Id == "Zones Layer"); xTile.Layers.Layer zone2Layer = map.Layers.FirstOrDefault((x) => x.Id == "Zones2 Layer"); xTile.Layers.Layer startLayer = map.Layers.First((x) => x.Id == "Start Position Layer"); xTile.Layers.Layer balloonLayer = map.Layers.First((x) => x.Id == "Balloon Layer"); xTile.Layers.Layer speedLayer = map.Layers.First((x) => x.Id == "Speed Modifier Layer"); xTile.Layers.Layer timeLayer = map.Layers.FirstOrDefault((x) => x.Id == "Time Modifier Layer"); xTile.Layers.Layer triggerLayer = map.Layers.First((x) => x.Id == "Trigger Groups"); xTile.Layers.Layer portalLayer = map.Layers.FirstOrDefault((x) => x.Id == "Portal Layer"); ParseTiles(platformLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { foreach (var aggregate in aggregates) { if (aggregate.type == "Wall" || aggregate.type == "Magnetic Wall") { Rectangle rect = aggregate.rect; walls.Add(new Walls(aggregate.color, world, (uint)rect.Width, (uint)rect.Height, new Point(rect.X, rect.Y), true)); } } }); ParseTiles(startLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { foreach (var aggregate in aggregates) { if (aggregate.type == "Uno") { float tileSize = GameManager.TILE_SIZE; Rectangle rect = aggregate.rect; tempUnoPos = new Vector2(rect.X * tileSize, rect.Y * tileSize); } } }); Dictionary <Point, TileAggregate> pointToZoneAggregate = null; ParseTiles(zoneLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { pointToZoneAggregate = pointToAggregate; }); if (zone2Layer != null) { ParseTiles(zone2Layer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { foreach (var keyPair in pointToAggregate) { pointToZoneAggregate[keyPair.Key] = keyPair.Value; } }); } Dictionary <Point, TileAggregate> pointToSpeedAggregate = null; ParseTiles(speedLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { pointToSpeedAggregate = pointToAggregate; }); Dictionary <Point, TileAggregate> pointToTimeAggregate = null; if (timeLayer != null) { ParseTiles(timeLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { pointToTimeAggregate = pointToAggregate; }); } else { pointToTimeAggregate = new Dictionary <Point, TileAggregate>(); } Dictionary <string, List <IActivateable> > activators = new Dictionary <string, List <IActivateable> >(); Dictionary <Point, TileAggregate> pointToTriggerAggregate = null; ParseTiles(triggerLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { pointToTriggerAggregate = pointToAggregate; }); ParseTiles(moveablePlatformLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { foreach (var aggregate in aggregates) { if (aggregate.type == "Wall" || aggregate.type == "Magnetic Wall") { Rectangle rect = aggregate.rect; Point origin = rect.Location; Point destination = origin; TileAggregate zone; if (pointToZoneAggregate.TryGetValue(origin, out zone)) { bool zoneIsWide = zone.rect.Width > zone.rect.Height; if (zone.rect.Location == origin) { if (zoneIsWide) { origin = new Point(zone.rect.Right - rect.Width, rect.Y); } else { origin = new Point(rect.X, zone.rect.Bottom - rect.Height); } } else { if (zoneIsWide) { origin = new Point(zone.rect.X, rect.Y); } else { origin = new Point(rect.X, zone.rect.Y); } } } TileAggregate speedAggregate; string speedName; float speed = WALL_SPEEDS[0]; if (pointToSpeedAggregate.TryGetValue(new Point(rect.X, rect.Y), out speedAggregate) && speedAggregate.type == "Speed Modifier" && speedAggregate.properties.TryGetValue("Speed", out speedName)) { switch (speedName) { default: case "Slow": speed = WALL_SPEEDS[0]; break; case "Med": speed = WALL_SPEEDS[1]; break; case "Fast": speed = WALL_SPEEDS[2]; break; } } TileAggregate timeAggregate; string timeName; float time = WALL_TIMES[1]; if (pointToTimeAggregate.TryGetValue(new Point(rect.X, rect.Y), out timeAggregate) && timeAggregate.type == "Time Modifier" && timeAggregate.properties.TryGetValue("Time", out timeName)) { switch (timeName) { case "Short": time = WALL_TIMES[0]; break; default: case "Med": time = WALL_TIMES[1]; break; case "Long": time = WALL_TIMES[2]; break; } } MovableWall wall = new MovableWall(aggregate.color, world, (uint)rect.Width, (uint)rect.Height, origin, time, destination, speed, content); walls.Add(wall); TileAggregate trigger; if (pointToTriggerAggregate.TryGetValue(rect.Location, out trigger)) { string triggerNumber = trigger.properties["Number"]; if (!activators.ContainsKey(triggerNumber)) { activators[triggerNumber] = new List <IActivateable>(); } activators[triggerNumber].Add(wall); } } } }); ParseTiles(balloonLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { foreach (var aggregate in aggregates) { if (aggregate.type == "Balloon") { Rectangle rect = aggregate.rect; float speed = 0f; int range = 0; Balloon balloon; switch (aggregate.color) { case "g": { GreenBalloon greenBalloon = new GreenBalloon(new Point(rect.X, rect.Y), content); List <IActivateable> activatables; TileAggregate trigger; if (pointToTriggerAggregate.TryGetValue(rect.Location, out trigger) && activators.TryGetValue(trigger.properties["Number"], out activatables)) { foreach (var a in activatables) { greenBalloon.AddToActivatable(a); } } balloon = greenBalloon; } break; case "b": { BlueBalloon blueBalloon = new BlueBalloon(new Point(rect.X, rect.Y), world, content, 3f); balloon = blueBalloon; } break; case "y": { speed = 1f; TileAggregate speedAggregate; string speedName; if (pointToSpeedAggregate.TryGetValue(new Point(rect.X, rect.Y), out speedAggregate) && speedAggregate.type == "Speed Modifier" && speedAggregate.properties.TryGetValue("Speed", out speedName)) { switch (speedName) { default: case "Slow": speed = BALLOON_SPEEDS[0]; break; case "Med": speed = BALLOON_SPEEDS[1]; break; case "Fast": speed = BALLOON_SPEEDS[2]; break; } } TileAggregate zone; if (pointToZoneAggregate.TryGetValue(new Point(rect.X, rect.Y), out zone) && zone.color == "r") { //Start at left side rect.X = zone.rect.X; rect.Y = zone.rect.Y; //Go for horizontal width of zone range = zone.rect.Width; } } goto default; default: balloon = new Balloon(new Point(rect.X, rect.Y), content, aggregate.color, speed, range); break; } GameManager.getInstance().AddBalloon(balloon); } } }); if (portalLayer != null) { ParseTiles(portalLayer, delegate(List <TileAggregate> aggregates, Dictionary <Point, TileAggregate> pointToAggregate) { foreach (var aggregate in aggregates) { if (aggregate.type == "Exit") { float tileSize = GameManager.TILE_SIZE; Rectangle rect = aggregate.rect; tmpExitPortal = new ExitPortal(rect.Location); } } }); } //Remove Non Static Layers if (portalLayer != null) { map.RemoveLayer(portalLayer); } map.RemoveLayer(triggerLayer); if (timeLayer != null) { map.RemoveLayer(timeLayer); } map.RemoveLayer(speedLayer); map.RemoveLayer(balloonLayer); map.RemoveLayer(startLayer); map.RemoveLayer(moveablePlatformLayer); if (zone2Layer != null) { map.RemoveLayer(zone2Layer); } map.RemoveLayer(zoneLayer); unoPos = tempUnoPos; exit = tmpExitPortal; }
public static void SetBalloon(Balloon clickedBallon, BalloonColor color) { clickedBallon.SetColor(color); }
public void EatMeat() { Balloon.SetActive(true); text.text = "nomnomnom oink thx"; }
private void Select_Type() { if (SourceType.SelectedIndex != 2 && SourceType.SelectedIndex != 3) { SWL0.Maximum = 200; SWL1.Maximum = 200; SWL2.Maximum = 200; SWL3.Maximum = 200; SWL4.Maximum = 200; SWL5.Maximum = 200; SWL6.Maximum = 200; SWL7.Maximum = 200; SrcDetails.Enabled = false; SrcDetails.Visible = false; SrcDIR.Enabled = false; SrcDIR.Visible = false; //Commit(); return; } if (SourceType.SelectedIndex == 2) { string[] L; try { L = CLF_Read.SecureAccess.Read(); if (L == null) { SourceType.SelectedIndex = 0; return; } } catch (System.Exception) { return; } if (Objects.Count != 0) { for (int i = 0; i < Objects.Count; i++) { Objects[i].Geometry.SetUserString("Model", L[0]); Objects[i].Geometry.SetUserString("FileType", L[1]); Objects[i].Geometry.SetUserString("Sensitivity", L[2]); Objects[i].Geometry.SetUserString("SWLMax", L[3]); Objects[i].Geometry.SetUserString("Balloon63", L[4]); Objects[i].Geometry.SetUserString("Balloon125", L[5]); Objects[i].Geometry.SetUserString("Balloon250", L[6]); Objects[i].Geometry.SetUserString("Balloon500", L[7]); Objects[i].Geometry.SetUserString("Balloon1000", L[8]); Objects[i].Geometry.SetUserString("Balloon2000", L[9]); Objects[i].Geometry.SetUserString("Balloon4000", L[10]); Objects[i].Geometry.SetUserString("Balloon8000", L[11]); Objects[i].Geometry.SetUserString("Bands", L[12]); Objects[i].Geometry.SetUserString("Aiming", Alt.Value.ToString() + ";" + Azi.Value.ToString() + ";" + AxialRot.Value.ToString()); Objects[i].Geometry.SetUserString("Delay", Delay_ms.Value.ToString()); SC.AddBalloon(Objects[i].Attributes.ObjectId, new Speaker_Balloon(new string[] { L[4], L[5], L[6], L[7], L[8], L[9], L[10], L[11] }, L[2], int.Parse(L[1]), Utilities.RC_PachTools.RPttoHPt(Objects[i].Geometry.GetBoundingBox(true).Min))); SrcDetails.Enabled = true; SrcDetails.Visible = true; SrcDIR.Enabled = true; SrcDIR.Visible = true; string[] strSens = L[2].Split(';'); string[] strMSwl = L[3].Split(';'); float[] SenSwl = new float[8]; float[] MSwl = new float[8]; for (int oct = 0; oct < 8; oct++) { SenSwl[oct] = float.Parse(strSens[oct]); MSwl[oct] = float.Parse(strMSwl[oct]); } SWL0.Maximum = (!float.IsInfinity(MSwl[0]) && !float.IsNaN(MSwl[0])) ? (decimal)MSwl[0] : (decimal)200; SWL1.Maximum = (!float.IsInfinity(MSwl[1]) && !float.IsNaN(MSwl[1])) ? (decimal)MSwl[1] : (decimal)200; SWL2.Maximum = (!float.IsInfinity(MSwl[2]) && !float.IsNaN(MSwl[2])) ? (decimal)MSwl[2] : (decimal)200; SWL3.Maximum = (!float.IsInfinity(MSwl[3]) && !float.IsNaN(MSwl[3])) ? (decimal)MSwl[3] : (decimal)200; SWL4.Maximum = (!float.IsInfinity(MSwl[4]) && !float.IsNaN(MSwl[4])) ? (decimal)MSwl[4] : (decimal)200; SWL5.Maximum = (!float.IsInfinity(MSwl[5]) && !float.IsNaN(MSwl[5])) ? (decimal)MSwl[5] : (decimal)200; SWL6.Maximum = (!float.IsInfinity(MSwl[6]) && !float.IsNaN(MSwl[6])) ? (decimal)MSwl[6] : (decimal)200; SWL7.Maximum = (!float.IsInfinity(MSwl[7]) && !float.IsNaN(MSwl[7])) ? (decimal)MSwl[7] : (decimal)200; SWL0.Value = (decimal)SenSwl[0]; SWL1.Value = (decimal)SenSwl[1]; SWL2.Value = (decimal)SenSwl[2]; SWL3.Value = (decimal)SenSwl[3]; SWL4.Value = (decimal)SenSwl[4]; SWL5.Value = (decimal)SenSwl[5]; SWL6.Value = (decimal)SenSwl[6]; SWL7.Value = (decimal)SenSwl[7]; Commit(); } } } else if (SourceType.SelectedIndex == 3) { System.Windows.Forms.OpenFileDialog OF = new System.Windows.Forms.OpenFileDialog(); Balloon B; String[] CODES; string[] ballooncodes = new string[8]; double[] SWLmax = new double[8]; double[] SWLnom = new double[8]; if (OF.ShowDialog() != System.Windows.Forms.DialogResult.Cancel) { CODES = Balloon.Read_Generic(OF.FileName); string[] nomcode = CODES[8].Split(';'); string[] maxcode = CODES[9].Split(';'); for (int oct = 0; oct < 8; oct++) { ballooncodes[oct] = CODES[oct]; SWLnom[oct] = double.Parse(nomcode[oct]); SWLmax[oct] = double.Parse(maxcode[oct]); } B = new Balloon(ballooncodes, Utilities.RC_PachTools.RPttoHPt(Objects[0].Geometry.GetBoundingBox(true).Min)); } else { return; } if (Objects.Count != 0) { for (int i = 0; i < Objects.Count; i++) { Objects[i].Geometry.SetUserString("Sensitivity", CODES[8]); Objects[i].Geometry.SetUserString("SWLMax", CODES[9]); Objects[i].Geometry.SetUserString("Balloon63", ballooncodes[0]); Objects[i].Geometry.SetUserString("Balloon125", ballooncodes[1]); Objects[i].Geometry.SetUserString("Balloon250", ballooncodes[2]); Objects[i].Geometry.SetUserString("Balloon500", ballooncodes[3]); Objects[i].Geometry.SetUserString("Balloon1000", ballooncodes[4]); Objects[i].Geometry.SetUserString("Balloon2000", ballooncodes[5]); Objects[i].Geometry.SetUserString("Balloon4000", ballooncodes[6]); Objects[i].Geometry.SetUserString("Balloon8000", ballooncodes[7]); Objects[i].Geometry.SetUserString("Aiming", Alt.Value.ToString() + ";" + Azi.Value.ToString() + ";" + AxialRot.Value.ToString()); Objects[i].Geometry.SetUserString("Delay", Delay_ms.Value.ToString()); SC.AddBalloon(Objects[i].Attributes.ObjectId, B); SrcDetails.Enabled = true; SrcDetails.Visible = true; SrcDIR.Enabled = true; SrcDIR.Visible = true; SWL0.Maximum = (!double.IsInfinity(SWLmax[0]) && !double.IsNaN(SWLmax[0])) ? (decimal)SWLmax[0] : (decimal)200; SWL1.Maximum = (!double.IsInfinity(SWLmax[1]) && !double.IsNaN(SWLmax[1])) ? (decimal)SWLmax[1] : (decimal)200; SWL2.Maximum = (!double.IsInfinity(SWLmax[2]) && !double.IsNaN(SWLmax[2])) ? (decimal)SWLmax[2] : (decimal)200; SWL3.Maximum = (!double.IsInfinity(SWLmax[3]) && !double.IsNaN(SWLmax[3])) ? (decimal)SWLmax[3] : (decimal)200; SWL4.Maximum = (!double.IsInfinity(SWLmax[4]) && !double.IsNaN(SWLmax[4])) ? (decimal)SWLmax[4] : (decimal)200; SWL5.Maximum = (!double.IsInfinity(SWLmax[5]) && !double.IsNaN(SWLmax[5])) ? (decimal)SWLmax[5] : (decimal)200; SWL6.Maximum = (!double.IsInfinity(SWLmax[6]) && !double.IsNaN(SWLmax[6])) ? (decimal)SWLmax[6] : (decimal)200; SWL7.Maximum = (!double.IsInfinity(SWLmax[7]) && !double.IsNaN(SWLmax[7])) ? (decimal)SWLmax[7] : (decimal)200; SWL0.Value = (decimal)SWLnom[0]; SWL1.Value = (decimal)SWLnom[1]; SWL2.Value = (decimal)SWLnom[2]; SWL3.Value = (decimal)SWLnom[3]; SWL4.Value = (decimal)SWLnom[4]; SWL5.Value = (decimal)SWLnom[5]; SWL6.Value = (decimal)SWLnom[6]; SWL7.Value = (decimal)SWLnom[7]; Commit(); } } } Load_Doc(Objects); }
public void OnDropBalloon(Balloon pBalloon) { if (pBalloon == mBalloon) { mIsTouched = false; mRigidbody2D.drag = 1; mRigidbody2D.gravityScale = mBalloon.GravityScale; StopIgnoringOtherBalloonCollision(); EventService.DispatchEvent(EGameEvent.END_PULLING); } }
public override void Initialize() { if (this.m_actualVisualizationNode && this.m_gridVisualizationNode) { this.SetRenderersInChildred(this.m_gridVisualizationNode, false); this.SetRenderersInChildred(this.m_actualVisualizationNode, true); } int num = 1; while (num < 6 && !this.m_connectedPart) { this.m_connectedPart = base.contraption.FindPartAt(this.m_coordX, this.m_coordY - num); if (this.m_connectedPart && !this.m_connectedPart.IsPartOfChassis() && this.m_connectedPart.m_partType != BasePart.PartType.Pig && this.m_connectedPart.m_partType != BasePart.PartType.Kicker) { this.m_connectedPart = null; } num++; } this.m_partType = BasePart.PartType.Balloon; base.contraption.ChangeOneShotPartAmount(BasePart.BaseType(this.m_partType), this.EffectDirection(), 1); if (this.m_numberOfBalloons > 1) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(base.gameObject); gameObject.transform.position = base.transform.position; Balloon component = gameObject.GetComponent <Balloon>(); component.m_numberOfBalloons = this.m_numberOfBalloons - 1; base.contraption.AddRuntimePart(component); gameObject.transform.parent = base.contraption.transform; } if (!base.gameObject.GetComponent <SphereCollider>()) { SphereCollider sphereCollider = base.gameObject.AddComponent <SphereCollider>(); sphereCollider.radius = 0.5f; } if (!base.rigidbody) { base.gameObject.AddComponent <Rigidbody>(); } base.rigidbody.mass = 0.1f; base.rigidbody.drag = 2f; base.rigidbody.angularDrag = 0.5f; base.rigidbody.constraints = (RigidbodyConstraints)48; if (this.m_connectedPart) { this.m_connectedPart.EnsureRigidbody(); Vector3 position = base.transform.position; float num2 = Vector3.Distance(this.m_connectedPart.transform.position, position) - 0.5f; float num3 = 0f; Vector3 b; if (this.m_connectedPart.m_partType == BasePart.PartType.Pig) { b = Vector3.zero; num3 = 0.3f; } else { b = Vector3.up * 0.5f; } base.transform.position = this.m_connectedPart.transform.position + b; this.m_springJoint = base.gameObject.AddComponent <SpringJoint>(); this.m_springJoint.connectedBody = this.m_connectedPart.rigidbody; base.contraption.AddJointToMap(this, this.m_connectedPart, this.m_springJoint); float maxDistance = UnityEngine.Random.Range(0.8f, 1.2f) * num2 + num3; this.m_springJoint.minDistance = 0f; this.m_springJoint.maxDistance = maxDistance; this.m_springJoint.anchor = Vector3.up * -0.5f; this.m_springJoint.spring = 100f; this.m_springJoint.damper = 10f; this.m_springJoint.enablePreprocessing = false; this.m_balancer = this.m_connectedPart.gameObject.GetComponent <BalloonBalancer>(); if (!this.m_balancer) { this.m_balancer = this.m_connectedPart.gameObject.AddComponent <BalloonBalancer>(); } this.m_balancer.AddBalloon(); Transform transform = base.transform; if (this.m_actualVisualizationNode) { transform = this.m_actualVisualizationNode.transform; } this.m_rope = transform.gameObject.AddComponent <RopeVisualization>(); this.m_connectedLocalPos = this.m_connectedPart.transform.InverseTransformPoint(base.transform.position); this.m_springJoint.autoConfigureConnectedAnchor = false; this.m_springJoint.connectedAnchor = this.m_connectedLocalPos; this.m_rope.m_stringMaterial = this.m_stringMaterial; this.m_rope.m_pos1Anchor = Vector3.up * -0.5f + 1.1f * Vector3.forward; this.m_rope.m_pos2Transform = this.m_connectedPart.transform; this.m_rope.m_pos2Anchor = this.m_connectedLocalPos + 1.1f * Vector3.forward; base.transform.position = position + UnityEngine.Random.Range(-1f, 1f) * Vector3.forward + UnityEngine.Random.Range(-1f, 1f) * Vector3.right * 0.5f; } }
void Start() { mBalloon = GetComponent<Balloon>(); mRigidbody2D = GetComponent<Rigidbody2D>(); mLineRenderer = GetComponent<LineRenderer>(); mBalloonJoint = GetComponent<HingeJoint2D>(); mDistanceJoint = GetComponent<DistanceJoint2D>(); mCircleCollider = GetComponent<CircleCollider2D>(); mRope = GetComponentInChildren<Rope>(); m_Parent = mBalloonHolder.transform; //EventListener.Register(EGameEvent.HAZARDOUS_COLLISION, OnHazardousCollision); mainCharacter = mTack.transform.parent; Physics2D.IgnoreCollision(mainCharacter.GetComponent<BoxCollider2D>(), mCircleCollider); EventService.Register<BalloonDelegate>(EGameEvent.PICKUP_BALLOON, OnPickupBalloon); EventService.Register<BalloonDelegate>(EGameEvent.DROP_BALLOON, OnDropBalloon); EventService.Register<AttachBalloonDelegate>(EGameEvent.ATTACH_BALLOON, OnAttachBalloon); }
public void EatLeaves() { Balloon.SetActive(true); text.text = "nom nom piep"; }
protected virtual void AttachBalloon(Balloon pBalloon) { pBalloon.SetBalloonIndex (CountBalloons ()); pBalloon.SetBalloonHolder (this); mBalloons.Add (pBalloon); pBalloon.GameObject.transform.parent = this.gameObject.transform; EventService.DispatchEvent(EGameEvent.ATTACH_BALLOON, pBalloon, m_Tack); pBalloon.Physics.IgnoreOtherBalloonCollision(); }
public override void SayHello() { Balloon.SetActive(true); text.text = "piep piep"; }
Object3D RandomPrimitive(double x, double y, double z, Brush brush1, Brush brush2) { Primitive3D obj = null; double angle1 = 180 * randy.NextDouble(); double angle2 = 180 * (1 + randy.NextDouble()); int index = count > 150 ? 2 : ++count % 10; switch (index) { case 0: //--- more cubes, please :-) case 1: obj = new Cube(); break; case 2: obj = new Balloon(z); break; case 3: obj = new Cone { IsClosed = true }; break; case 4: obj = new Cylinder { IsClosed = true }; break; case 5: obj = new Cylinder { StartDegrees = angle1, StopDegrees = angle2, IsClosed = true }; break; case 6: obj = new Disk(); break; case 7: obj = new Disk { StartDegrees = angle1, StopDegrees = angle2 }; break; case 8: obj = new Square(); break; case 9: obj = new Triangle(); break; } obj.ScaleZ = z; obj.Position = new Point3D(x, y, z); obj.DiffuseMaterial.Brush = GetRandomBrush(); if (index > 5) { //--- flat objects need a BackMaterial and are rotated obj.BackMaterial = obj.Material; obj.Rotation1 = Math3D.RotationX(angle1); obj.Rotation2 = Math3D.RotationY(angle2); } else if (index < 2)//--- cubes { obj.DiffuseMaterial.Brush = brush1; obj.Position = new Point3D(x, y, z + 0.01); //--- avoid z fighting with the ground } else if (index == 2) //--- balloon { obj.ScaleZ = obj.ScaleX * 1.2; } else if (index == 4 || index == 5)//--- cylinder { obj.DiffuseMaterial.Brush = brush2; obj.Rotation1 = new Quaternion(Math3D.UnitZ, angle1); } return(obj); }
public void EatMeat() { Balloon.SetActive(true); text.text = "nomnomnom thx wubalubadubdub"; }
// Use this for initialization void Start() { Balloon.GetComponent <TalkBalloon> ().load(); load(); }
private void BalloonDestroyed(Balloon b) { playerAttacking = b.player; balloonsGroup.Remove(b); Destroy(b.gameObject); }