void UpdateServerList() { Debug.Log("ServerListUpdate"); GameObject go = GameObjectHelper.GetChildNamedGameObject(JoinGameDisplay, "Content", true); GameObjectHelper.DestroyChildren(go.transform); foreach (KeyValuePair <string, NetworkPlayManager.NetworkGame> networkGame in NetworkPlayManager.Instance.NetworkDiscoveryServers) { Debug.Log(networkGame.Key + ", " + networkGame.Value.Name); //NetworkGameSetupJoinButton networkGameSetupJoinButton = JoinGameEntry.GetComponent<NetworkGameSetupJoinButton>(); //networkGameSetupJoinButton.NetworkGame = networkGame.Value; GameObject go2 = Instantiate(JoinGameEntry); NetworkGameSetupJoinButton networkGameSetupJoinButton = go2.GetComponent <NetworkGameSetupJoinButton>(); networkGameSetupJoinButton.NetworkGame = networkGame.Value; UIHelper.SetTextOnChildGameObject(go2, "Name", networkGame.Key + ", " + networkGame.Value.Name); go2.transform.SetParent(go.transform); go2.transform.localScale = Vector3.one; } }
/// <summary> /// Add a standalone model when not combining. /// </summary> private static GameObject AddStandaloneModel( DaggerfallUnity dfUnity, ref ModelData modelData, Matrix4x4 matrix, Transform parent, bool overrideStatic = false, bool ignoreCollider = false) { // Determine static flag bool makeStatic = (dfUnity.Option_SetStaticFlags && !overrideStatic) ? true : false; // Add GameObject uint modelID = (uint)modelData.DFMesh.ObjectId; GameObject go = GameObjectHelper.CreateDaggerfallMeshGameObject(modelID, parent, makeStatic, null, ignoreCollider); go.transform.position = matrix.GetColumn(3); go.transform.rotation = GameObjectHelper.QuaternionFromMatrix(matrix); return(go); }
void UseSpellBillboardAnims(int record = 0, bool oneShot = false) { // Destroy any existing billboard game object if (myBillboard) { myBillboard.gameObject.SetActive(false); Destroy(myBillboard.gameObject); } // Add new billboard parented to this missile GameObject go = GameObjectHelper.CreateDaggerfallBillboardGameObject(GetMissileTextureArchive(), record, transform); go.transform.localPosition = Vector3.zero; go.layer = gameObject.layer; myBillboard = go.GetComponent <DaggerfallBillboard>(); myBillboard.FramesPerSecond = BillboardFramesPerSecond; myBillboard.FaceY = true; myBillboard.OneShot = oneShot; myBillboard.GetComponent <MeshRenderer>().receiveShadows = false; }
void Start() { if (!GameDamageDirector.AllowRayShoot) { GameObjectHelper.DestroyGameObject(gameObject); return; } trail = this.gameObject.GetComponent <LineRenderer>(); RaycastHit hit; GameObject explosion = null; if (Physics.Raycast(this.transform.position, this.transform.forward, out hit, Range)) { AimPoint = hit.point; if (Explosion != null) { explosion = GameObjectHelper.CreateGameObject(Explosion, AimPoint, this.transform.rotation, true); } } else { AimPoint = this.transform.forward * Range; explosion = GameObjectHelper.CreateGameObject(Explosion, AimPoint, this.transform.rotation, true); } if (explosion) { GameDamageBase dmg = explosion.GetComponent <GameDamageBase>(); if (dmg) { dmg.TargetTag = TargetTag; } } if (trail) { trail.SetPosition(0, this.transform.position); trail.SetPosition(1, AimPoint); } Destroy(this.gameObject, LifeTime); GameObjectHelper.DestroyGameObject(this.gameObject, LifeTime); }
public static Multi Create(ushort graphic) { if (_pool.Count != 0) { var m = _pool.Dequeue(); m.Graphic = m._originalGraphic = graphic; m.IsDestroyed = false; m.UpdateGraphicBySeason(); m.AllowedToDraw = !GameObjectHelper.IsNoDrawable(m.Graphic); m.AlphaHue = 0; m.FoliageIndex = 0; m.IsFromTarget = false; if (m.ItemData.Height > 5) { m._canBeTransparent = 1; } else if (m.ItemData.IsRoof || m.ItemData.IsSurface && m.ItemData.IsBackground || m.ItemData.IsWall) { m._canBeTransparent = 1; } else if (m.ItemData.Height == 5 && m.ItemData.IsSurface && !m.ItemData.IsBackground) { m._canBeTransparent = 1; } else { m._canBeTransparent = 0; } m.MultiOffsetX = m.MultiOffsetY = m.MultiOffsetZ = 0; m.IsCustom = false; m.State = 0; m.Offset = Vector3.Zero; return(m); } return(new Multi(graphic)); }
/// <summary> /// Sets the position of child bloxes and param bloxes of parent /// </summary> protected void SetChildBloxesPositionOnScreen(ABlox parentBlox, float bloxVerticalSpacing, float identSpacing, float paramSpacing, bool nestingActive = true) { BoundingBox2D parentBBox = GameObjectHelper.getBoundingBoxInWorld(parentBlox.gameObject); Vector2 parentBloxLeft = parentBBox.left; // Gets all the nodes (except the ones nested to the side and parent) List <BloxIdent> bloxIdentList = parentBlox.GetChildBloxListInVerticalOrder(); ABlox previousBlox = parentBlox; // Sets the parent blox params SetBloxParamsPositionOnScreen(parentBlox, paramSpacing, nestingActive); foreach (BloxIdent bloxIdent in bloxIdentList) { ABlox blox = bloxIdent.blox; int ident = bloxIdent.ident; Vector2 previousBloxPosition = previousBlox.transform.position; BoundingBox2D previousBloxBBox = GameObjectHelper.getBoundingBoxInWorld(previousBlox.gameObject); BoundingBox2D bloxBBox = GameObjectHelper.getBoundingBoxInWorld(blox.gameObject); float bloxWidth = GameObjectHelper.getWidthFromBBox(bloxBBox); // Determines the vertical distance of this blox to the previous one float previousBloxHeight = GameObjectHelper.getHeightFromBBox(previousBloxBBox); float verticalOffset = previousBloxHeight / 2 + bloxVerticalSpacing; Vector2 newPosition = blox.transform.position; newPosition.y = previousBloxPosition.y - verticalOffset; // Determines the horizontal offset of this blox based on its ident newPosition.x = parentBloxLeft.x + bloxWidth / 2 + ident * identSpacing; blox.transform.position = newPosition; // Sets the params bloxes positions SetBloxParamsPositionOnScreen(blox, paramSpacing, nestingActive); ABlox previousBloxInLine = blox; previousBlox = blox; } }
void StartLight() { // Do nothing if light already started if (myLight) { return; } // Using a static helper in FoeSpawner to find best scene parent // We want the light to be assigned to one of the scene parents so it will be cleaned up on scene reset Transform parent = GameObjectHelper.GetBestParent(); // Create the light object GameObject go = new GameObject(effectKey); go.transform.parent = parent; myLight = go.AddComponent <Light>(); myLight.type = LightType.Point; myLight.color = variantProperties[currentVariant].effectColor; myLight.range = 14; }
public void Active() { if (!GameDamageDirector.AllowExplosion) { GameObjectHelper.DestroyGameObject(gameObject); return; } if (Effect) { GameObject obj = GameObjectHelper.CreateGameObject(Effect, transform.position, transform.rotation, true); GameObjectHelper.DestroyGameObject(obj, 3, true); } if (Explosive) { ExplosionDamage(); } GameObjectHelper.DestroyGameObject(gameObject, 3, true); }
/// <summary> /// Tries to create a world from the map provided. /// </summary> /// <remarks> /// This should never fail, as that indicates something has gone /// terribly wrong since the map data should be vetted to make sure /// it's all valid. Any BSP failure should be reported to developers /// since they should not be happening either. /// </remarks> /// <param name="info">The world information.</param> /// <param name="map">The map to create the world from.</param> /// <param name="world">The created world (or null on failure).</param> /// <param name="worldGameObject">The game object that is made for /// applying ticking monobehaviours to (or null on failure).</param> /// <returns>True on success, false on failure.</returns> public static bool TryCreateWorld(WorldInfo info, MapData map, out World world, out GameObject worldGameObject) { worldGameObject = new GameObject($"World ({map.Name})"); try { world = new World(info, map, worldGameObject); return(true); } catch (Exception e) { Debug.Log("Warning: There may be lingering game objects that were not cleaned up!"); Debug.Log("This should not happen. Contact a developer!"); Debug.Log($"Reason: {e.Message}"); GameObjectHelper.Destroy(worldGameObject); world = null; worldGameObject = null; return(false); } }
public MultiView(Multi st) : base(st) { AllowedToDraw = !GameObjectHelper.IsNoDrawable(st.Graphic); if (st.ItemData.Height > 5) { _canBeTransparent = 1; } else if (st.ItemData.IsRoof || (st.ItemData.IsSurface && st.ItemData.IsBackground) || st.ItemData.IsWall) { _canBeTransparent = 1; } else if (st.ItemData.Height == 5 && st.ItemData.IsSurface && !st.ItemData.IsBackground) { _canBeTransparent = 1; } else { _canBeTransparent = 0; } }
/// <summary> /// Seek and import a GameObject from mods to replace a Daggerfall mesh. /// </summary> /// <param name="modelID">Daggerfall model ID.</param> /// <param name="parent">Parent to assign to GameObject.</param> /// <param name="matrix">Matrix with position and rotation of GameObject.</param> /// <returns>Returns the imported model or null if not found.</returns> public static GameObject ImportCustomGameobject(uint modelID, Transform parent, Matrix4x4 matrix) { GameObject go; if (!TryImportGameObject(modelID, true, out go)) { return(null); } go.name = GameObjectHelper.GetGoModelName(modelID) + " [Replacement]"; go.transform.parent = parent; go.transform.position = matrix.GetColumn(3); go.transform.rotation = matrix.rotation; //Multiply the scale instead of applying it, since custom 3D models doesn't necessary have (1,1,1) scale go.transform.localScale = Vector3.Scale(go.transform.localScale, matrix.lossyScale); // Finalise gameobject FinaliseMaterials(go); return(go); }
public void Refresh() { RankGameItemManager ranksManager = LevelController.Ranks(); for (int r = ranksManager.Items.Length; r > 0; r--) { Rank rank = ranksManager.GetItem(r); rank.LoadData(); GameObject pageObject = Instantiate(pagePrefab); pageObject.SetActive(false); pageObject.transform.SetParent(transform, false); Text _rankSignText = GameObjectHelper.GetChildComponentOnNamedGameObject <Text>(pageObject, "RankName", true); _rankSignText.text = LocaliseText.Get(rank.JsonData.GetString("name")); ItemsRange range = LevelController.RankPacksRange(rank); for (int i = range.From; i < range.To + 1; i++) { Pack pack = LevelController.Packs().GetItem(i); GameObject newObject = Instantiate(Prefab); newObject.GetComponent <PackItem>().Number = i; newObject.transform.SetParent(pageObject.transform, false); newObject.GetComponent <Button>().onClick.AddListener(() => { LevelsListController.Instance.OpenPackButton(pack); }); buttons.Add(newObject); } } CustomUI_ScrollRectOcclusion _occ = GetComponent <CustomUI_ScrollRectOcclusion>(); _occ.Init(); }
void OnWizardCreate() { var projpath = GetProjectPath(); var repopath = Path.GetFullPath(new Uri(Path.Combine(projpath, "..")).AbsolutePath); var rootpath = Path.Combine(repopath, "SimpleViewer"); foreach (var t in tasks) { EditorSceneManager.OpenScene(t.scene); var outputdir = Path.Combine(rootpath, t.outputdir); var filepath = Path.Combine(outputdir, t.OutputFileName); // remove old directory try { Directory.Delete(outputdir, true); } catch (DirectoryNotFoundException) { } // create new directory; Directory.CreateDirectory(outputdir); var pathHelper = ExportPathHelper.Instance; pathHelper.UpdateTargetFilePath(filepath); ExportSettings.Instance = settings; ExportSettings.Instance.destination = new DestinationSettings() { extension = t.Extension, format = t.format, rootPath = rootpath, }; var gameObjects = GameObjectHelper.GetExportGameObjects(); var exporter = new SceneExporter(gameObjects); exporter.Export(t.format); } Debug.Log("Exporting Sample Scene completed!"); }
/// <summary> /// Spawn a new pool item within range of player. /// </summary> void SpawnAvailableMobile() { // Player must be in range of location if (!playerInLocationRange) { return; } // Get a free mobile from pool int item = GetNextFreePoolItem(); if (item == -1) { return; } // Get closest point on navgrid to player position in world DFPosition playerWorldPos = new DFPosition(playerGPS.WorldX, playerGPS.WorldZ); DFPosition playerGridPos = cityNavigation.WorldToNavGridPosition(playerWorldPos); // Spawn mobile at a random position and schedule to be live DFPosition spawnPosition; if (cityNavigation.GetRandomSpawnPosition(playerGridPos, out spawnPosition, navGridSpawnRadius)) { PoolItem poolItem = populationPool[item]; // Setup spawn position DFPosition worldPosition = cityNavigation.NavGridToWorldPosition(spawnPosition); Vector3 scenePosition = cityNavigation.WorldToScenePosition(worldPosition); poolItem.npc.Motor.transform.position = scenePosition; GameObjectHelper.AlignBillboardToGround(poolItem.npc.Motor.gameObject, new Vector2(0, 2f)); // Schedule for enabling poolItem.active = true; poolItem.scheduleEnable = true; populationPool[item] = poolItem; } }
// Preferential resolution of case B in UnstickHandling() // Smoothly dips and undips height of player capsule, like a very tall person ducking through a low doorway void HeadDipHandling() { const float raySampleDistance = 0.5f; const float clearanceAdjustment = -0.28f; if (!heightChanger || playerMotor.IsCrouching) { return; } // Sample forward from very top of player's head and from eye level Ray headRay = new Ray(myTransform.position + new Vector3(0, heightChanger.FixedControllerStandingHeight / 2 + 0.25f, 0), myTransform.forward); Ray eyeRay = new Ray(GameManager.Instance.MainCamera.transform.position, myTransform.forward); RaycastHit headHit; bool headRayHit = Physics.Raycast(headRay, out headHit, raySampleDistance); bool eyeRayHit = Physics.Raycast(eyeRay, raySampleDistance); //Debug.LogFormat("Ray contact: HeadRay: {0}, EyeRay {1}", headRayHit, eyeRayHit); // If top of head hits something but eyes are clear, try dipping controller height if (headRayHit && !eyeRayHit && GameObjectHelper.IsStaticGeometry(headHit.transform.gameObject)) { // Dip controller height by clearance amount heightChanger.StandingHeightAdjustment = clearanceAdjustment; //Debug.Log("Dipping controller"); } else { // Undip player once head/eye test is clear // Technically the player will stand up again within a frame or two // But in practice it is only required to clear the initial obstacle and player will fit through // Player might experience a short "bounce" if they approach problem geometry very slowly // Adding extra logic to maintain dip while something is above player's head adds complexity and can result in pronounced "bouncing" // After testing several approaches, the most simple one still yielded the best results heightChanger.StandingHeightAdjustment = 0; //Debug.Log("Undipping controller"); } }
public override void MagicRound() { base.MagicRound(); DaggerfallEntityBehaviour entityBehaviour = GetPeeredEntityBehaviour(manager); if (!entityBehaviour) { return; } if (entityBehaviour.Entity is EnemyEntity) { EnemyEntity enemy = (EnemyEntity)entityBehaviour.Entity; if (enemy.WabbajackActive) { return; } MobileTypes enemyType = careerIDs[Random.Range(0, careerIDs.Length)]; if ((int)enemyType == enemy.CareerIndex) { enemyType = (MobileTypes)(((int)enemyType + 1) % careerIDs.Length); } Transform parentTransform = entityBehaviour.gameObject.transform.parent; // Do not disable enemy if in use by the quest system QuestResourceBehaviour questResourceBehaviour = entityBehaviour.GetComponent <QuestResourceBehaviour>(); if (questResourceBehaviour) { if (!questResourceBehaviour.IsFoeDead) { return; } } entityBehaviour.gameObject.SetActive(false); GameObject gameObject = GameObjectHelper.CreateEnemy(HardStrings.enemyNames[(int)enemyType], enemyType, entityBehaviour.transform.localPosition, parentTransform); DaggerfallEntityBehaviour newEnemyBehaviour = gameObject.GetComponent <DaggerfallEntityBehaviour>(); EnemyEntity newEnemy = (EnemyEntity)newEnemyBehaviour.Entity; newEnemy.WabbajackActive = true; newEnemy.CurrentHealth -= enemy.MaxHealth - enemy.CurrentHealth; // carry over damage to new monster } }
// Orsinium defines two blocks at [-1,-1] private void LayoutOrsinium(ref DFLocation location, bool importEnemies = true) { // Calculate monster power - this is a clamped 0-1 value based on player's level from 1-20 float monsterPower = Mathf.Clamp01(GameManager.Instance.PlayerEntity.Level / 20f); // Create dungeon layout and handle misplaced block for (int i = 0; i < summary.LocationData.Dungeon.Blocks.Length; i++) { DFLocation.DungeonBlock block = summary.LocationData.Dungeon.Blocks[i]; if (block.X == -1 && block.Z == -1 && block.BlockName == "N0000065.RDB") { continue; } GameObject go = GameObjectHelper.CreateRDBBlockGameObject( block.BlockName, DungeonTextureTable, block.IsStartingBlock, Summary.DungeonType, monsterPower, RandomMonsterVariance, (int)DateTime.Now.Ticks /*Summary.ID*/, // TODO: Add more options for seed dfUnity.Option_DungeonBlockPrefab, importEnemies); go.transform.parent = this.transform; go.transform.position = new Vector3(block.X * RDBLayout.RDBSide, 0, block.Z * RDBLayout.RDBSide); DaggerfallRDBBlock daggerfallBlock = go.GetComponent <DaggerfallRDBBlock>(); if (block.IsStartingBlock) { FindMarkers(daggerfallBlock, ref block, true); // Assign start marker and enter marker } else { FindMarkers(daggerfallBlock, ref block, false); // Only find water level and castle block info from start marker } summary.LocationData.Dungeon.Blocks[i].WaterLevel = block.WaterLevel; summary.LocationData.Dungeon.Blocks[i].CastleBlock = block.CastleBlock; } }
public static Multi Create(Graphic graphic) { if (_pool.Count != 0) { var m = _pool.Dequeue(); m.Graphic = m._originalGraphic = graphic; m.IsDestroyed = false; m._itemData = null; m.UpdateGraphicBySeason(); m._isFoliage = m.ItemData.IsFoliage; m.AllowedToDraw = !GameObjectHelper.IsNoDrawable(m.Graphic); m.AlphaHue = 0; m.IsFromTarget = false; if (m.ItemData.Height > 5) { m._canBeTransparent = 1; } else if (m.ItemData.IsRoof || m.ItemData.IsSurface && m.ItemData.IsBackground || m.ItemData.IsWall) { m._canBeTransparent = 1; } else if (m.ItemData.Height == 5 && m.ItemData.IsSurface && !m.ItemData.IsBackground) { m._canBeTransparent = 1; } else { m._canBeTransparent = 0; } m.MultiOffsetX = m.MultiOffsetY = m.MultiOffsetZ = 0; m.CharacterIsBehindFoliage = false; return(m); } return(new Multi(graphic)); }
bool CanHearTarget() { float hearingScale = 1f; // If something is between enemy and target then return false (was reduce hearingScale by half), to minimize // enemies walking against walls. // Hearing is not impeded by doors or other non-static objects RaycastHit hit; Ray ray = new Ray(transform.position, directionToTarget); if (Physics.Raycast(ray, out hit)) { //DaggerfallEntityBehaviour entity = hit.transform.gameObject.GetComponent<DaggerfallEntityBehaviour>(); if (GameObjectHelper.IsStaticGeometry(hit.transform.gameObject)) { return(false); } } // TODO: Modify this by how much noise the target is making return(distanceToTarget < (HearingRadius * hearingScale) + mobile.Summary.Enemy.HearingModifier); }
public void Show(CBBattleResultSync data) { gameObject.SetActive(true); uTools.uTweenScale.Begin(gameObject, Vector3.zero, Vector3.one, 0.2f, 0); var winner = data.ResultInfos.First(a => a.IsWin); if (winner != null) { title.text = "恭喜 {0} 获得最终胜利!".FormatStr(room.GetPlayer(winner.PlayrID).numTag); } else { title.text = "没有获胜玩家"; } GameObjectHelper.SetListContent(template, itemRoot, items, data.ResultInfos , (index, item, info) => { item.SetData(info); }); }
public void RestoreEnemyData(EnemyData_v1[] enemies) { if (enemies == null || enemies.Length == 0) { return; } for (int i = 0; i < enemies.Length; i++) { // Create target GameObject GameObject go = GameObjectHelper.InstantiatePrefab(DaggerfallUnity.Instance.Option_EnemyPrefab.gameObject, enemies[i].gameObjectName, null, Vector3.zero); go.transform.parent = GameObjectHelper.GetSpawnParentTransform(); // Set LoadID DaggerfallEnemy enemy = go.GetComponent <DaggerfallEnemy>(); enemy.LoadID = enemies[i].loadID; // Restore save data SerializableEnemy serializableEnemy = go.GetComponent <SerializableEnemy>(); serializableEnemy.RestoreSaveData(enemies[i]); } }
public void AvatarChangeButton() { DialogInstance _avatarDialogInstance = DialogManager.Instance.Show("ProfileChangeAvatarDialog"); Button galleryButton = GameObjectHelper.GetChildComponentOnNamedGameObject <Button> (_avatarDialogInstance.Content, "GalleryButton"); Button cameraButton = GameObjectHelper.GetChildComponentOnNamedGameObject <Button> (_avatarDialogInstance.Content, "CameraButton"); galleryButton.onClick.AddListener(() => { #if UNITY_EDITOR PickImageEditor(); #endif #if UNITY_IOS IOSCamera.Instance.PickImage(ISN_ImageSource.Library); #endif #if UNITY_ANDROID AndroidCamera.Instance.GetImageFromGallery(); #endif _avatarDialogInstance.Done(); }); cameraButton.onClick.AddListener(() => { #if UNITY_EDITOR PickImageEditor(); #endif #if UNITY_IOS IOSCamera.Instance.PickImage(ISN_ImageSource.Camera); #endif #if UNITY_ANDROID AndroidCamera.Instance.GetImageFromCamera(); #endif _avatarDialogInstance.Done(); }); }
private void Start() { gobCards = GameObjectHelper.FindByTagInOrder(Tags.Card); gobMoney = GameObjectHelper.FindByTagInOrder(Tags.Money); gobPlayerPanels = GameObjectHelper.FindByTagInOrder(Tags.PlayerPanel); txtRound = GameObject.Find("txtRound"); _game = new Game(); _game.StartNewRound(); txtRound.GetComponent <Text>().text = $"Round {_game.RoundCount}"; for (int i = 0; i < gobCards.Length; i++) { gobCards[i].GetComponent <Image>().sprite = Resources.Load <Sprite>("Images/" + (i + 1)); } }
public ItemView(Item item) : base(item) { if (!item.IsCorpse) { AllowedToDraw = item.Graphic > 2 && item.DisplayedGraphic > 2 && !GameObjectHelper.IsNoDrawable(item.Graphic) && !item.IsMulti; } else { if ((item.Direction & Direction.Running) != 0) { item.UsedLayer = true; item.Direction &= (Direction)0x7F; } else { item.UsedLayer = false; } item.Layer = (Layer)item.Direction; AllowedToDraw = true; } }
public void Show(Action callback = null) { this.active = true; if (callback != null) { _closeCallback = callback; } GameObjectHelper.GetChildNamedGameObject(gameObject, "Dialog", true).SetActive(true); GameManager.SafeAddListener <FacebookAppRequestMessage>(FacebookMessageHandler); if (!Debug.isDebugBuild) { Fabric.Answers.Answers.LogContentView("Invite", "Dialog"); } PreferencesFactory.SetString(Constants.KeyInviteBalloonShowedDate, UnbiasedTime.Instance.Now().ToString(CultureInfo.InvariantCulture)); HideBalloon(); }
public void Reset() { gameObject.ResetRigidBodiesVelocity(); //gameObject.ResetLocalPosition(); //gameObject.ResetLocalRotation(); Damping = initialDamping; Speed = initialSpeed; SpeedMax = initialSpeedMax; SpeedMult = initialSpeedMult; Noise = initialNoise; TargetLockDirection = initialTargetLockDirection; DistanceLock = initialDistanceLock; DurationLock = initialDurationLock; Seeker = initialSeeker; LifeTime = initialLifeTime; locked = initiallocked; timetorock = initialtimetorock; timeCount = Time.time; GameObjectHelper.DestroyGameObject(gameObject, LifeTime); }
void ShowDoubleScreen() { GameObject part1 = GameObjectHelper.GetChildNamedGameObject(dialogInstance.Content, "Part1", true); GameObjectHelper.SafeSetActive(part1, false); GameObject part2 = GameObjectHelper.GetChildNamedGameObject(dialogInstance.Content, "Part2", true); GameObjectHelper.SafeSetActive(part2, true); Text rewardsCoinsText = GameObjectHelper.GetChildComponentOnNamedGameObject <Text> (part2, "RewardsCoins", true); if (prizeIsPoints) { rewardsCoinsText.text = LocaliseText.Format("FreePrize.NumberPoints", this.PrizeItems); } if (prizeIsCoins) { rewardsCoinsText.text = LocaliseText.Format("FreePrize.NumberCoins", this.PrizeItems); } }
private static void DropAllItems() { UnequipAll(); GameObject player = GameManager.Instance.PlayerObject; List <DaggerfallUnityItem> dropList = new List <DaggerfallUnityItem>(); for (int i = 0; i < playerEntity.Items.Count; i++) { DaggerfallUnityItem item = playerEntity.Items.GetItem(i); if (item.QuestItemSymbol != null || item.IsQuestItem || item.IsSummoned || item.TemplateIndex == 132 || item.TemplateIndex == 93 || item.TemplateIndex == 94) { } else { if (item.IsEquipped) { item.currentCondition /= 2; } else { dropList.Add(item); } } } if (dropList.Count >= 1) { DaggerfallLoot equipPile = GameObjectHelper.CreateDroppedLootContainer(player, DaggerfallUnity.NextUID); equipPile.customDrop = true; equipPile.playerOwned = true; foreach (DaggerfallUnityItem item in dropList) { equipPile.Items.Transfer(item, playerEntity.Items); } DaggerfallUI.MessageBox("You tear off your clothes and armor."); } }
public void AnimateAdding(int points, Vector3 position = default(Vector3)) { bonusPoints.transform.localPosition = new Vector3(position.x, position.y, 1000); GameObject bonusCoinsText = GameObjectHelper.GetChildNamedGameObject(bonusPoints, "Point", true); bonusCoinsText.GetComponent <Text>().text = string.Format("+ {0}", points); Camera cam = bonusPoints.GetComponent <Camera>(); Vector3 pos = new Vector3(0, 0, 0); if (pointImage != null) { pos = pointImage.transform.position; cam = bonusPoints.GetComponent <Camera>(); } Vector2 o = RectTransformUtility.WorldToScreenPoint(cam, pos); Vector2 localPoint; RectTransformUtility.ScreenPointToLocalPointInRectangle(bonusPoints.transform.parent.transform as RectTransform, o, null, out localPoint); Animation anim = bonusPoints.GetComponent <Animation>(); if (anim) { GameObjectHelper.SafeSetActive(bonusPoints, true); bonusPoints.transform.DOLocalMove(new Vector3(localPoint.x, localPoint.y, 0), 0.5f).SetDelay(0.5f).SetEase(Ease.Linear); anim.Play(); } StartCoroutine(BonusCoinsCallback(points, 1.5f)); }
private void Display3dModelSelection(int selectedIdx) { if (goModel) { Object.Destroy(goModel); goModel = null; } // Position camera and set model id uint modelId = 0; if (housesForSale == null) { camera.transform.position = new Vector3(0, 12, DaggerfallBankManager.GetShipCameraDist((ShipType)selectedIdx)); modelId = DaggerfallBankManager.GetShipModelId((ShipType)selectedIdx); } else { camera.transform.position = new Vector3(0, 3, -20); BuildingSummary house = housesForSale[selectedIdx]; modelId = house.ModelID; } // Inject custom GameObject if available else create standard mesh game object for the model goModel = MeshReplacement.ImportCustomGameobject(modelId, goBankPurchase.transform, new Matrix4x4()); if (goModel == null) { goModel = GameObjectHelper.CreateDaggerfallMeshGameObject(modelId, goBankPurchase.transform); } goModel.layer = layer; // Apply current climate ClimateBases climateBase = ClimateSwaps.FromAPIClimateBase(GameManager.Instance.PlayerGPS.ClimateSettings.ClimateType); ClimateSeason season = (DaggerfallUnity.WorldTime.Now.SeasonValue == DaggerfallDateTime.Seasons.Winter) ? ClimateSeason.Winter : ClimateSeason.Summer; DaggerfallMesh dfMesh = goModel.GetComponent <DaggerfallMesh>(); dfMesh.SetClimate(climateBase, season, WindowStyle.Day); }
void Start() { Application.runInBackground = true; bat = new GameObjectHelper(GameObject.Find("Bat")); ball = new GameObjectHelper(GameObject.Find("Ball")); target = new GameObjectHelper(GameObject.Find("Target")); this.car = new GameObjectHelper(GameObject.Find("Car")); Time.timeScale = scale; ecj = new EcjJob(this); ecj.Start(); }