public static bool Initialize() { List <FishType> fisht = FishType.GetFishTypes(); if (fisht.Count == 0) { var assembly = IntrospectionExtensions.GetTypeInfo(typeof(Record)).Assembly; Stream stream = assembly.GetManifestResourceStream("AlienScale.StaticResources.JSON.FirstUse.json"); //get info from json using (var reader = new System.IO.StreamReader(stream)) { var json = reader.ReadToEnd(); try { var result = JsonConvert.DeserializeObject <IEnumerable <Record> >(json); var records = result as List <Record>; foreach (var rec in records) { FishType ft = new FishType() { TypeName = rec.typename, TypeDescription = rec.typedescription }; FishType.Insert(ft); } } catch (Exception ex) { } } } return(true); }
void SpawnFish() { float spawnRandomYPos = Random.Range(-spawnRange, spawnRange); GameObject newFish = Instantiate(fishPrefab, transform.position, transform.rotation); FishType newFishType = ChooseFish(); newFish.transform.position = new Vector2(newFish.transform.position.x, newFish.transform.position.y + spawnRandomYPos); newFish.GetComponent <SpriteRenderer>().sprite = newFishType.fishSprite; newFish.GetComponent <FishBehavior>().speed = newFishType.speed; newFish.GetComponent <FishBehavior>().fishType = newFishType; newFish.transform.localScale = new Vector3(newFishType.spriteScale, newFishType.spriteScale, newFishType.spriteScale); int indexForTally = 0; for (int i = 0; i < 4; i++) { if (fishFreqs[i].fishType == newFishType) { indexForTally = i; } } FindObjectOfType <ScoreKeeper>().AddToTotal(indexForTally); Debug.Log(indexForTally); }
public void SetData(Fish fish) { weight = fish.weight; type = fish.type; found = true; name = fishNames[(int)type]; }
public override bool Run() { Vector3 mPoint = Hit.mPoint; FishingData fishingData = FishingSpot.GetFishingData(mPoint, Hit.mType); FishingSpotData fishingSpotData = fishingData as FishingSpotData; string str = (fishingSpotData == null) ? Localization.LocalizeString("Gameplay/Objects/Fishing:EmptyWater") : ((!fishingSpotData.IsActive) ? Localization.LocalizeString("Gameplay/Objects/Fishing:InactiveWater") : Localization.LocalizeString("Gameplay/Objects/Fishing:ActiveWater")); str += "\n"; List <FishType> fish = fishingData.GetFish(); List <int> chances = fishingData.GetChances(); EWCatFishingSkill skill = Actor.SkillManager.GetSkill <EWCatFishingSkill>(EWCatFishingSkill.SkillNameID); for (int i = 0; i < chances.Count; i++) { if (chances[i] > 0) { FishType fishType = fish[i]; if (fishType != FishType.None && fishType != FishType.Box) { // Only fish appropriate to skill or that sim "knows about" (has already caught) will be // displayed. This should be just like human fishing. str = str + "\n" + GetFishName(fish[i], skill); //str = str + "\n" + fish[i].ToString(); } } } Show(new Format(str, NotificationStyle.kGameMessagePositive)); return(true); }
public void FeedPanguin(bool i_isLeft, FishType i_type) { if(i_isLeft) m_leftPanguin.Eat(i_type); else m_RightPanguin.Eat(i_type); }
public void setup(FishType fishType, int size) { gameObject.name = fishType.name; this.type.text = $"{fishType.name}"; this.size.text = $"{size}"; this.rawImage.texture = fishType.image; }
void enqueue(FishType type) { var queueObject = Instantiate(QueueObjectPrefab, QueueContainer.transform); queueObject.Initialize(type); IncomingFish.Enqueue(type); }
public static Point FishSize(FishType type) { Point size = new Point(); if (type == FishType.fish1) { size.X = Images.fish1.Width; size.Y = Images.fish1.Height; } else if (type == FishType.fish2) { size.X = Images.fish2.Width; size.Y = Images.fish2.Height; } else if (type == FishType.fish3) { size.X = Images.fish3.Width; size.Y = Images.fish3.Height; } else if (type == FishType.fish4) { size.X = Images.fish4.Width; size.Y = Images.fish4.Height; } else { throw new ArgumentException("Unsupported fish type"); } size.X /= 2; size.Y /= 2; return(size); }
public Fish(Vessel vessel, double bodyDifficulty) { this.bodyDifficulty = bodyDifficulty; // Determine the fish type fishType = GetFishType(vessel.mainBody, vessel.latitude, vessel.longitude); // Determine the fish weight double mean = 0.0; double stdDev = 0.0; switch (fishType) { case FishType.Pond: mean = 2; stdDev = 0.5; break; case FishType.Freshwater: mean = 8; stdDev = 2; break; case FishType.Coastal: mean = 15; stdDev = 3; break; case FishType.Ocean: mean = 50; stdDev = 13; break; case FishType.DeepOcean: mean = 100; stdDev = 20; break; case FishType.Kraken: mean = 500; stdDev = 100; break; } double gravityModifier = vessel.mainBody.gravParameter / (vessel.mainBody.Radius * vessel.mainBody.Radius) / 9.81; weight = rnd.NextGaussianDouble(mean, stdDev) * gravityModifier; weight = Mathf.Clamp((float)weight, fishType == FishType.Pond ? 0.1f : 1.0f, float.MaxValue); // Determine the fish difficulty modifier difficulty = Mathf.Clamp((float)(Math.Log(weight, 16) + 0.5), 0.5f, float.MaxValue); // Determine the fish reward funds = rnd.NextGaussianDouble(500, 100) * (Math.Log(weight + 1.0, 1.4)) * difficulty * difficulty; Debug.Log("Generated a fish of type " + fishType + ", weight " + weight.ToString("N1") + " kg, and difficulty " + difficulty + "."); // Do an immediate fixed update call to set the inital speed/direction FixedUpdate(); }
/// <summary> /// Used to spawn a set of fish w/ a given depth mean /// </summary> public void SpawnFishSet(float _depthMean, int _howMany, FishType _type) { for (int i = 0; i < _howMany; i++) { SpawnFish(_depthMean, _type); } }
public void UpdateKill(FishType type) { switch (type) { case FishType.Dolphin: txtDolphinKillCount.SetText("Dolphin Kill: " + GameController.Instance.GetDolphinKill.ToString()); break; case FishType.HammerShark: txtHammerSharkKillCount.SetText("Ham Shark Kill: " + GameController.Instance.GetHammerSharkKill.ToString()); break; case FishType.JellyFish: txtJellyFishKillCount.SetText("Jelly Fish Kill: " + GameController.Instance.GetJellyFishKill.ToString()); break; case FishType.KoiFish: txtKoiKillCount.SetText("Koi Kill: " + GameController.Instance.GetKoiKill.ToString()); break; case FishType.Orthocone: txtOrthoconeKillCount.SetText("Orthocone Kill: " + GameController.Instance.GetOrthoconeKill.ToString()); break; case FishType.Turtle: txtTurtleKillCount.SetText("Turtle Kill: " + GameController.Instance.GetTurtleKill.ToString()); break; case FishType.KillerWhale: txtKillerWhaleKillCount.SetText("Killer Whale Kill: " + GameController.Instance.GetKillerWhaleKill.ToString()); break; } }
public Fish(string name, FishType fishType, string imageUrl) : this() { this.Name = name; this.FishType = fishType; this.ImageUrl = imageUrl; }
/// <summary> /// Spawns a fish in a random xPos within the depthDeviation distance of the depthMean passed in /// </summary> public void SpawnFish(float _depthMean, FishType _type) { // Generate a copy of the fish prefab GameObject newFish = FishPrefab; // Calculate it's position float yPos = Gaussian(0.0f, depthDeviation) - _depthMean; float xPos = Random.Range(-2.0f, 2.0f); if (yPos > 0.0f) { yPos -= 5.0f; } // Adjust type newFish.GetComponent <Fish>().type = _type; newFish.GetComponent <SpriteRenderer>().sprite = spriteIndexes[_type]; newFish.transform.position = new Vector3(xPos, yPos, 0); // Set the movement pattern to wander newFish.GetComponent <FishMovement>().movementPattern = MovementPattern.Wander; // Instantiate & adjust transform parent Instantiate(newFish, FishParent.transform); //newFish.transform.SetParent(FishParent.transform); }
public Fish(FishType fishType, double volume) { Type = fishType; Volume = volume; _rnd = new Random(); }
public void IncrementScore(FishType number) { _scores[(int)number]++; switch (number) { case FishType.Blue: BlueScoreText.text = _scores[(int)number].ToString(); break; case FishType.Green: GreenScoreText.text = _scores[(int)number].ToString(); break; case FishType.Red: RedScoreText.text = _scores[(int)number].ToString(); break; case FishType.Orange: OrangeScoreText.text = _scores[(int)number].ToString(); break; case FishType.Frog: FrogScoreText.text = _scores[(int)number].ToString(); break; } }
private static bool Before_GetFish(Farm __instance, float millisecondsAfterNibble, int bait, int waterDepth, Farmer who, double baitPotency, Vector2 bobberTile, ref SObject __result) { if (FarmPatcher.IsInPatch || !FarmPatcher.IsSmallBeachFarm(who?.currentLocation)) { return(true); } try { FarmPatcher.IsInPatch = true; FishType type = FarmPatcher.GetFishType(__instance, (int)bobberTile.X, (int)bobberTile.Y); FarmPatcher.Monitor.VerboseLog($"Fishing {type.ToString().ToLower()} tile at ({bobberTile.X / Game1.tileSize}, {bobberTile.Y / Game1.tileSize})."); if (type == FishType.Ocean) { __result = __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Beach"); return(false); } else { // match riverland farm behavior __result = Game1.random.NextDouble() < 0.3 ? __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Forest") : __instance.getFish(millisecondsAfterNibble, bait, waterDepth, who, baitPotency, bobberTile, "Town"); return(false); } } finally { FarmPatcher.IsInPatch = false; } }
void setupAnimationRequirements() { int fishType = PlayerPrefs.GetInt("FishType"); if (fishType == 0) { fishModel = FishType.Poeciliid; GameObject.Find("EditorPrefab/Root/SticklebackRig").SetActiveRecursively(false); KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent <KeyframeBar>(); Debug.Log("Does holder equal null " + holder); holder.keyedObject = (GameObject)GameObject.Find("EditorPrefab/Root/SwordtailRigCore"); holder.motionCaptureTarget = (GameObject)GameObject.Find("EditorPrefab/Root/SwordtailRigCore/MotionCaptureTarget"); target = holder.motionCaptureTarget; /* * if(PlayerPrefs.GetString("MorphPath") != "default") * { * Debug.Log("MorphPath: " + PlayerPrefs.GetString("MorphPath")); * Messenger<string>.Broadcast("OnMorph", PlayerPrefs.GetString("MorphPath")); * } * if(PlayerPrefs.GetString("TexturePath") != "default") * Messenger<string>.Broadcast("SwapTexture", PlayerPrefs.GetString("TexturePath")); */ } else if (fishType == 1) { fishModel = FishType.Stickleback; GameObject.Find("SwordtailRigCore").SetActiveRecursively(false); KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent <KeyframeBar>(); holder.keyedObject = (GameObject)GameObject.Find("EditorPrefab/Root/SticklebackRig"); holder.motionCaptureTarget = (GameObject)GameObject.Find("EditorPrefab/Root/SticklebackRig/MotionCaptureTarget"); target = holder.motionCaptureTarget; } }
public BattleFish(EntityManager entityManager, string entityName, FishType fishType, bool flipped = false) : base(entityManager, entityName) { _fishType = fishType; _flipped = flipped; _spriteAsset = FishData.FishSpriteAssets[_fishType]; }
public Sprite GetSpriteByType(FishType type) { switch (type) { case FishType.Firefish: return(FirefishSprite); case FishType.Icefish: return(IcefishSprite); case FishType.Poisonfish: return(PoisonfishSprite); case FishType.Spikefish: return(SpikefishSprite); case FishType.Bonefish: return(BonefishSprite); case FishType.Goldenfish: return(GoldenfishSprite); default: throw new ArgumentException($"unexpected FishType ${type}"); } }
public void DrawImage(Graphics g, FishType type, PointF position, Direction direction, bool isDead) { if (!isDead) { if (direction == Direction.Left) { g.DrawImage(imageLeft[type], position.X, position.Y); } else { g.DrawImage(imageRight[type], position.X, position.Y); } } else { if (!gameOver) { ChangeBack(); gameOver = true; } if (direction == Direction.Left) { g.DrawImage(deadFishLeft[type], position.X, position.Y); } else { g.DrawImage(deadFishRight[type], position.X, position.Y); } } }
public static Point FishSize(FishType type) { Point size = new Point(); if (type == FishType.fish1) { size.X = Images.fish1.Width; size.Y = Images.fish1.Height; } else if (type == FishType.fish2) { size.X = Images.fish2.Width; size.Y = Images.fish2.Height; } else if (type == FishType.fish3) { size.X = Images.fish3.Width; size.Y = Images.fish3.Height; } else if (type == FishType.fish4) { size.X = Images.fish4.Width; size.Y = Images.fish4.Height; } else { throw new ArgumentException("Unsupported fish type"); } size.X /= 2; size.Y /= 2; return size; }
public void Notify(FishType type) { foreach (var subscriber in this.subscribers) { subscriber.Update(type); } }
/// <summary> /// Creates a new Fish at the transform location with the transform as parent /// </summary> /// <param name="type"></param> /// <param name="locationToSpawn"></param> /// <returns></returns> public static FishController CreateNewFish(FishType type, Transform parent) { FishController fish = CreateNewFish(type, parent.position); fish.transform.SetParent(parent); return(fish); }
public void Notify(FishType fishType) { foreach (var subscriber in _subscribers) { subscriber.Update(fishType); } }
public void AddFish(FishType type) { switch (type) { case FishType.Firefish: Firefishes++; break; case FishType.Icefish: Icefishes++; break; case FishType.Poisonfish: Poisonfishes++; break; case FishType.Spikefish: Spikefishes++; break; case FishType.Bonefish: Bonefishes++; break; case FishType.Goldenfish: Goldenfishes++; break; default: throw new ArgumentException($"unexpected FishType ${type}"); } }
// returns a random weight within a range based on the type of fish float RandomWeight(FishType type) { switch (type) { case FishType.WooMango: return(Random.Range(7.0f, 9.6f)); case FishType.AngleLilac: return(Random.Range(3.0f, 7.0f)); case FishType.MagiCarp: return(Random.Range(1.0f, 6.0f)); case FishType.ToxicBlockhead: return(Random.Range(2.0f, 12.0f)); case FishType.Chad: return(Random.Range(70.0f, 96.0f)); case FishType.PinkFish: return(Random.Range(8.0f, 11.0f)); default: return(0.0f); } }
public void setup(FishType fishType) { gameObject.name = fishType.name; this.fishSize = Random.Range(fishType.sizeMin, fishType.sizeMax); this.type.text = $"{fishType.name}"; this.size.text = $"{fishSize}"; this.rawImage.texture = fishType.image; }
public float GetHeaviestCaught(FishType type) { if (mFishingInfo != null && mFishingInfo.TryGetValue(type, out FishInfo value)) { return(value.mHeaviestTypeWeight); } return(0f); }
public int GetNumberCaught(FishType type) { if (mFishingInfo != null && mFishingInfo.TryGetValue(type, out FishInfo value)) { return(value.mNumberCaught); } return(0); }
public ActionResult AddFishType(FishType fishType) { fishType.Available = true; ucContext.fishTypes.Add(fishType); ucContext.SaveChanges(); return(RedirectToAction("FishType", "List")); }
public bool KnowsAbout(FishType type) { if (mFishingInfo == null) { return(false); } return(mFishingInfo.ContainsKey(type)); }
public void Fill(FishType type, int count) { _fishType = type; _fishCount += count; RefreshShipHoldView(); _view.DoGrowAnim(false); }
public static GameObject GetFishPrefab(FishType type) { string path = string.Empty; path = System.IO.Path.Combine("Prefabs", "Fish"); path = System.IO.Path.Combine(path, "Fish_" + type.ToString()).Replace("\\", "/"); GameObject go = GetPrefab(path); return go; }
public void Eat(FishType i_fish) { return; if( i_fish == m_preferredFish ) m_satisfaction += 10; else m_satisfaction -= 10; m_satisfaction = Mathf.Max(m_satisfaction,0); if(m_satisfaction >= 50) Leave(); }
public static FishType GetOneOfTwoFishType(FishType type1, FishType type2) { int type = Random.Range(1, 3); // Debug.Log("Type: "+ type); switch (type) { case 1: return type1; case 2: return type2; } return 0; }
public Fish(int width, int height, PointF pos) { maxShiftX = width; maxShiftY = height; direction = Direction.Left; type = (FishType)Tools.random.Next(0, 4); position = pos; destination = position; widthSize = Tools.FishSize(type).X; heightSize = Tools.FishSize(type).Y; maximumHealth = 200.0f; health = maximumHealth; strategy = new InitialStrategy(this); }
public void SetType(FishType i_type) { switch (i_type) { case FishType.RedFish: GetComponentInChildren<MeshRenderer>().sharedMaterial = blockMaterials[0]; m_fish = new RedFish(); m_fish.Init(FishType.RedFish); break; case FishType.GreenFish: GetComponentInChildren<MeshRenderer>().sharedMaterial = blockMaterials[1]; m_fish = new GreenFish(); m_fish.Init(FishType.GreenFish); break; case FishType.BlueFish: GetComponentInChildren<MeshRenderer>().sharedMaterial = blockMaterials[2]; m_fish = new BlueFish(); m_fish.Init(FishType.BlueFish); break; case FishType.CopperFish: GetComponentInChildren<MeshRenderer>().sharedMaterial = blockMaterials[3]; m_fish = new CopperFish(); m_fish.Init(FishType.CopperFish); break; case FishType.SilverFish: GetComponentInChildren<MeshRenderer>().sharedMaterial = blockMaterials[4]; m_fish = new SilverFish(); m_fish.Init(FishType.SilverFish); break; case FishType.GoldFish: GetComponentInChildren<MeshRenderer>().sharedMaterial = blockMaterials[5]; m_fish = new GoldFish(); m_fish.Init(FishType.GoldFish); break; } }
void Awake() { Messenger.AddListener("TurnOffGui", onTurnOffGui); Messenger.AddListener("TurnOnGui", onTurnOnGui); int fishType = PlayerPrefs.GetInt("FishType"); Debug.Log("AnimationEditorState fishtype: " + fishType); if(fishType == 0) { fishModel = FishType.Poeciliid; GameObject.Find("EditorPrefab/Root/SticklebackRig").SetActiveRecursively(false); KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent<KeyframeBar>(); Debug.Log("Does holder equal null " + holder); holder.keyedObject = (GameObject)GameObject.Find("EditorPrefab/Root/SwordtailRigCore"); holder.motionCaptureTarget = (GameObject)GameObject.Find("EditorPrefab/Root/SwordtailRigCore/MotionCaptureTarget"); target = holder.motionCaptureTarget; if(PlayerPrefs.GetString("MorphPath") != "default") { Debug.Log("MorphPath: " + PlayerPrefs.GetString("MorphPath")); Messenger<string>.Broadcast("OnMorph", PlayerPrefs.GetString("MorphPath")); } if(PlayerPrefs.GetString("TexturePath") != "default") Messenger<string>.Broadcast("SwapTexture", PlayerPrefs.GetString("TexturePath")); }else if(fishType == 1) // changed "else" to "else if" by Chengde, 06132013 { fishModel = FishType.Stickleback; GameObject.Find("SwordtailRigCore").SetActiveRecursively(false); KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent<KeyframeBar>(); holder.keyedObject = (GameObject)GameObject.Find("EditorPrefab/Root/SticklebackRig"); holder.motionCaptureTarget = (GameObject)GameObject.Find("EditorPrefab/Root/SticklebackRig/MotionCaptureTarget"); target = holder.motionCaptureTarget; //pasted following two if statement by Chengde, 06132013. if(PlayerPrefs.GetString("MorphPath") != "default") { Debug.Log("MorphPath: " + PlayerPrefs.GetString("MorphPath")); Messenger<string>.Broadcast("OnMorph", PlayerPrefs.GetString("MorphPath")); } if(PlayerPrefs.GetString("TexturePath") != "default") Messenger<string>.Broadcast("SwapTexture", PlayerPrefs.GetString("TexturePath")); } //string path = PlayerPrefs.GetString("PathDir"); //loadStateData(path); }
public void DrawImage(Graphics g, FishType type, PointF position, Direction direction, bool isDead) { if (!isDead) { if (direction == Direction.Left) g.DrawImage(imageLeft[type], position.X, position.Y); else g.DrawImage(imageRight[type], position.X, position.Y); } else { if (!gameOver) { ChangeBack(); gameOver = true; } if (direction == Direction.Left) g.DrawImage(deadFishLeft[type], position.X, position.Y); else g.DrawImage(deadFishRight[type], position.X, position.Y); } }
public static FishTypeInfo GetInfo(FishType type ) { int v = ( int )type; if ( v < 0 || v >= m_Table.Length ) v = 0; return m_Table[v]; }
public Fish(FishType fishType, float weight = (float)0.0, float multiplier = (float)1.0) { Difficulty = FishDifficulty.FishDifficultyPresets[fishType]; Multiplier = multiplier; Weight = weight; }
public void InitBlocks(int count, FishType type1, FishType type2) { //Init first two blocks float random = Random.Range(0, 0.999f); if (random > 0.5f) { //DropBlock(type1); InitFishList.Add(type1); lastlastBlockType = type1; } else { //DropBlock(type2); InitFishList.Add(type2); lastlastBlockType = type2; } random = Random.Range(0, 0.999f); if (random > 0.5f) { //DropBlock(type1); InitFishList.Add(type1); lastBlockType = type1; } else { //DropBlock(type2); InitFishList.Add(type2); lastBlockType = type2; } //Init remain blocks for(int i = 2; i< count; i++) { if(lastlastBlockType == lastBlockType) { if(lastlastBlockType == type1) { //DropBlock(type2); InitFishList.Add(type2); lastBlockType = type2; } else { //DropBlock(type1); InitFishList.Add(type1); lastBlockType = type1; } } else { random = Random.Range(0, 0.999f); if (random > 0.5f) { //DropBlock(type1); InitFishList.Add(type1); lastlastBlockType = lastBlockType; lastBlockType = type1; } else { //DropBlock(type2); InitFishList.Add(type2); lastlastBlockType = lastBlockType; lastBlockType = type2; } } } }
void RankFishType(List<IceBlock> iceblocks, out FishType RankFirstType, out FishType RankSecondType) { int RedCount = 0, GreenCount = 0, BlueCount = 0; for (int i = 0; i < iceblocks.Count; i++) { switch (iceblocks[i].GetFishType()) { case FishType.RedFish: ++RedCount; break; case FishType.GreenFish: ++GreenCount; break; case FishType.BlueFish: ++BlueCount; break; } } if(RedCount>=GreenCount) { if(GreenCount>=BlueCount) { RankFirstType = FishType.RedFish; RankSecondType = FishType.GreenFish; }else { if (RedCount >= BlueCount) { RankFirstType = FishType.RedFish; RankSecondType = FishType.BlueFish; } else { RankFirstType = FishType.BlueFish; RankSecondType = FishType.RedFish; } } } else { if (GreenCount >= BlueCount) { RankFirstType = FishType.GreenFish; if(BlueCount >= RedCount) RankSecondType = FishType.BlueFish; else { RankSecondType = FishType.RedFish; } } else { RankFirstType = FishType.BlueFish; RankSecondType = FishType.GreenFish; } } }
public virtual void Init(FishType i_type) { m_foodType = i_type; }
void setupAnimationRequirements() { int fishType = PlayerPrefs.GetInt("FishType"); if(fishType == 0) { fishModel = FishType.Poeciliid; GameObject.Find("EditorPrefab/Root/SticklebackRig").SetActiveRecursively(false); KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent<KeyframeBar>(); Debug.Log("Does holder equal null " + holder); holder.keyedObject = (GameObject)GameObject.Find("EditorPrefab/Root/SwordtailRigCore"); holder.motionCaptureTarget = (GameObject)GameObject.Find("EditorPrefab/Root/SwordtailRigCore/MotionCaptureTarget"); target = holder.motionCaptureTarget; /* if(PlayerPrefs.GetString("MorphPath") != "default") { Debug.Log("MorphPath: " + PlayerPrefs.GetString("MorphPath")); Messenger<string>.Broadcast("OnMorph", PlayerPrefs.GetString("MorphPath")); } if(PlayerPrefs.GetString("TexturePath") != "default") Messenger<string>.Broadcast("SwapTexture", PlayerPrefs.GetString("TexturePath")); */ }else if(fishType == 1) { fishModel = FishType.Stickleback; GameObject.Find("SwordtailRigCore").SetActiveRecursively(false); KeyframeBar holder = GameObject.Find("KeyframeBar/KeyframeGameRegistry").GetComponent<KeyframeBar>(); holder.keyedObject = (GameObject)GameObject.Find("EditorPrefab/Root/SticklebackRig"); holder.motionCaptureTarget = (GameObject)GameObject.Find("EditorPrefab/Root/SticklebackRig/MotionCaptureTarget"); target = holder.motionCaptureTarget; } }
public void DropBlock() { FishType type = GetRandomFishType(); if(lastBlockType == lastlastBlockType) { if (lastBlockType == FishType.RedFish) type = GetOneOfTwoFishType(FishType.GreenFish, FishType.BlueFish); if (lastBlockType == FishType.GreenFish) type = GetOneOfTwoFishType(FishType.RedFish, FishType.BlueFish); if (lastBlockType == FishType.BlueFish) type = GetOneOfTwoFishType(FishType.GreenFish, FishType.RedFish); } lastlastBlockType = lastBlockType; lastBlockType = type; GameObject block; float initPosY = GetTopPosition() + 3f; if (m_iceBlocks.Count > 0) block = Instantiate(m_blockPrefab, new Vector3(m_iceBlocks[m_iceBlocks.Count - 1].transform.position.x, initPosY, blockDropPos.position.z), blockDropPos.rotation) as GameObject; else block = Instantiate(m_blockPrefab, new Vector3(blockDropPos.transform.position.x,initPosY, blockDropPos.position.z), blockDropPos.rotation) as GameObject; //GameObject block = Instantiate(m_blockPrefab, blockDropPos.position, blockDropPos.rotation) as GameObject; block.transform.SetParent(transform); IceBlock blockScript = block.GetComponent<IceBlock>(); blockScript.SetType(type); //blockScript.SetRandomType(); AddBlock(blockScript); //CheckForMatch(); }
public void DropBlocks(List<FishType> typeList) { if(InitFishList.Count == 0) { return; } float deltaY = 2f; float initPosY = GetTopPosition() + 3f; GameObject block; for(int i = 0; i< typeList.Count; i++) { if(m_iceBlocks.Count > 0) block = Instantiate(m_blockPrefab, new Vector3(m_iceBlocks[m_iceBlocks.Count - 1].transform.position.x, initPosY + i * deltaY, blockDropPos.position.z), blockDropPos.rotation) as GameObject; else block = Instantiate(m_blockPrefab, new Vector3(blockDropPos.transform.position.x, initPosY + i * deltaY, blockDropPos.position.z), blockDropPos.rotation) as GameObject; block.transform.SetParent(transform); IceBlock blockScript = block.GetComponent<IceBlock>(); blockScript.SetType(typeList[i]); AddBlock(blockScript); lastlastBlockType = lastBlockType; lastBlockType = blockScript.GetFishType(); } if (m_iceBlocks.Count >= 1) m_iceBlocks[0].m_isBottom = true; InitFishList.Clear(); }
//------------------------------------------------------------------------- public override void load(EbPropSet prop_set) { Name = prop_set.getPropString("T_Name").get(); var prop_state = prop_set.getPropInt("I_State"); State = prop_state == null ? DataState.Default : (DataState)prop_state.get(); FishAnimMove = prop_set.getPropString("T_FishAnimMove").get(); FishAnimDie = prop_set.getPropString("T_FishAnimDie").get(); FishLevel = prop_set.getPropInt("I_FishLevel").get(); FishDieChance = prop_set.getPropInt("I_FishDieChance").get(); FishSpeed = prop_set.getPropInt("I_FishSpeed").get(); FishHitPoint = prop_set.getPropInt("I_FishHitPoint").get(); FishScore = prop_set.getPropInt("I_FishScore").get(); FishPixelHeight = prop_set.getPropInt("I_FishPixelHeight").get(); FishHeight = prop_set.getPropInt("I_FishHeight").get(); FishNetCount = prop_set.getPropInt("I_FishNetCount").get(); //FishTrackPoint = prop_set.getPropString("T_FishTrackPoint").get(); FishDepth = prop_set.getPropInt("I_FishNetCount").get(); Effects = new List<TbDataEffectCompose>(); string strEffects = prop_set.getPropString("T_EffectsFishEffectCompose").get(); string[] arrayEffects = strEffects.Split(';'); foreach (string str in arrayEffects) { TbDataEffectCompose dataEffectCompose = EbDataMgr.Instance.getData<TbDataEffectCompose>(int.Parse(str)); if (null != dataEffectCompose) { Effects.Add(dataEffectCompose); } } var prop_red = prop_set.getPropInt("I_Red"); Red = prop_red == null ? IsRed.Default : (IsRed)prop_red.get(); var prop_type = prop_set.getPropInt("I_Type"); Type = prop_type == null ? FishType.Default : (FishType)prop_type.get(); var prop_displayscoretype = prop_set.getPropInt("I_FishDisplayScoreType"); FishDisplayScoreType = prop_displayscoretype == null ? _eDisplayScoreType.Default : (_eDisplayScoreType)prop_displayscoretype.get(); var prop_canhitbyfishnet = prop_set.getPropInt("I_mCanHitByFishNet"); mCanHitByFishNet = prop_canhitbyfishnet == null ? CanHitByFishNet.Default : (CanHitByFishNet)prop_canhitbyfishnet.get(); FishMinScore = prop_set.getPropInt("I_FishMinScore").get(); FishMaxScore = prop_set.getPropInt("I_FishMaxScore").get(); OutFishWeight = prop_set.getPropInt("I_OutFishWeight").get(); OutFishUpperBound = prop_set.getPropInt("I_OutFishUpperBound").get(); CycleAnimationName = prop_set.getPropString("T_CycleAnimationName").get(); CyclePixelHeight = prop_set.getPropInt("I_CyclePixelHeight").get(); CycleHeight = prop_set.getPropInt("I_CycleHeight").get(); var prop_isfullscreen = prop_set.getPropInt("I_IsFullScreenAnimation"); IsFullScreenAnimation = prop_isfullscreen == null ? IsFullScreen.Default : (IsFullScreen)prop_isfullscreen.get(); FishCompose = EbDataMgr.Instance.getData<TbDataFishCompose>(prop_set.getPropInt("I_FishCompose").get()); LockFishWeight = prop_set.getPropInt("I_LockFishWeight").get(); LockCardFishScale = prop_set.getPropInt("I_LockCardFishScale").get(); ParticleArray = new List<ParticleDataStruct>(); for (int i = 1; i <= 10; ++i) { string strParticles = prop_set.getPropString("T_ParticleArray" + i.ToString()).get(); string[] arrayStrParticles = strParticles.Split(';'); ParticleDataStruct particleDataStruct = new ParticleDataStruct(); particleDataStruct.TbDataParticle = EbDataMgr.Instance.getData<TbDataParticle>(int.Parse(arrayStrParticles[0])); particleDataStruct.ParticleProduceTime = string.IsNullOrEmpty(arrayStrParticles[1]) ? ParticleProduceTimeEnum.Default : (ParticleProduceTimeEnum)int.Parse(arrayStrParticles[1]); particleDataStruct.StartPoint = new ParticlePointStruct(); particleDataStruct.StartPoint.ParticlePointType = string.IsNullOrEmpty(arrayStrParticles[2]) ? ParticlePointStruct.ParticlePointTypeEnum.Default : (ParticlePointStruct.ParticlePointTypeEnum)int.Parse(arrayStrParticles[2]); particleDataStruct.StartPoint.x = int.Parse(arrayStrParticles[3]); particleDataStruct.StartPoint.y = int.Parse(arrayStrParticles[4]); particleDataStruct.TargetPoint = new ParticlePointStruct(); particleDataStruct.TargetPoint.ParticlePointType = string.IsNullOrEmpty(arrayStrParticles[5]) ? ParticlePointStruct.ParticlePointTypeEnum.Default : (ParticlePointStruct.ParticlePointTypeEnum)int.Parse(arrayStrParticles[5]); particleDataStruct.TargetPoint.x = int.Parse(arrayStrParticles[6]); particleDataStruct.TargetPoint.y = int.Parse(arrayStrParticles[7]); ParticleArray.Add(particleDataStruct); } FishEvenFour = EbDataMgr.Instance.getData<TbDataFishEvenFour>(prop_set.getPropInt("I_FishEvenFour").get()); FishEvenFive = EbDataMgr.Instance.getData<TbDataFishEvenFive>(prop_set.getPropInt("I_FishEvenFive").get()); var prop_fishroutecategory = prop_set.getPropInt("I_FishRouteCategory"); fishRouteCategory = prop_fishroutecategory == null ? FishRouteCategory.Default : (FishRouteCategory)prop_fishroutecategory.get(); TurnplateParticle = EbDataMgr.Instance.getData<TbDataParticle>(prop_set.getPropInt("I_TurnplateParticle").get()); dataOutFishGroup = EbDataMgr.Instance.getData<TbDataOutFishGroup>(prop_set.getPropInt("I_OutFishGroupData").get()); FishPropKey = prop_set.getPropString("T_FishPropKey").get(); FishIcon = prop_set.getPropString("T_FishIcon").get(); var prop_fishdietype = prop_set.getPropInt("I_FishDieType"); FishDieType = prop_fishdietype == null ? FishDieTypeEnum.Default : (FishDieTypeEnum)prop_fishdietype.get(); ChainFishNumber = prop_set.getPropInt("I_ChainFishNumber").get(); ChainFish = EbDataMgr.Instance.getData<TbDataFish>(prop_set.getPropInt("I_ChainFish").get()); if (null != prop_set.getPropString("T_CoinParticle")) { CoinParticleStruct coinParticleStruct = new CoinParticleStruct(); string strCointParticleDatas = prop_set.getPropString("T_CoinParticle").get(); string[] arrayStrCointParticleDatas = strCointParticleDatas.Split(';'); if (arrayStrCointParticleDatas.Length == 3) { coinParticleStruct.CointParticleData = EbDataMgr.Instance.getData<TbDataParticle>(int.Parse(arrayStrCointParticleDatas[0])); coinParticleStruct.CointCount = int.Parse(arrayStrCointParticleDatas[1]); coinParticleStruct.Radius = int.Parse(arrayStrCointParticleDatas[2]); mCoinParticle = coinParticleStruct; } } }
public void DestroyType(FishType i_type) { List<IceBlock> removeBlocks = new List<IceBlock>(); foreach(IceBlock block in m_iceBlocks) { if( block.GetFishType() == i_type ) removeBlocks.Add(block); } foreach(IceBlock block in removeBlocks) { DeleteBlock(block); } if (m_iceBlocks.Count >= 1) m_iceBlocks[0].m_isBottom = true; }