private void PickUpFlower(Flower flower) { flower.PlaySound(); Destroy(flower.gameObject); _health.HealthPoints += 10.0f; // ... }
public override void Init (Flower _flower, int index) { if ( isInited ) return; isInited = true; base.Init(_flower, index); // find component if ( follow == null ) follow = GetComponentInChildren<Petal3DWind>(); myUpDiff = Global.GetRandomDirectionV3() * 0.1f; // chaosFunction = StartCoroutine(GenerateChaos(0.1f)); petalModelRotateToward = Global.GetRandomDirectionV3(); // the initial phase position of the petal petalModelLinkInit = Random.Range(0,Mathf.PI * 2f); // randomize some parameter petalModelRotateIntense *= Random.Range(0.5f, 2f); petalModelLinkIntense *= Random.Range(0.1f, 5f); petalModelLinkInterval *= Random.Range(0.5f, 2f); m_rigidbody = GetComponent<Rigidbody2D>(); // the up force intense is different because of diff shape upForceIntense *= Random.Range(0.5f, 2f); if ( state == PetalState.Init ) { SetColliderTrigger( false ); } }
public void addFlower(Flower f) { int check = -1; int count = 0; for(int i = 0; i < flowers.Count; i++){ //check for flower already in list if(flowers[i].fName == f.fName){ check = i; count = flowers[i].num; } } if (check > -1){ //if flower already in list, increment if (count < 5){ //max count of flowers flowers[check].num += 1; flowers[check].craftingCount += 1; } } else{ //otherwise add new flower Flower flower = new Flower(); flower.fName = f.fName; flower.description = f.description; flower.num = 1; flower.craftingCount = 1; flowers.Add(flower); } }
virtual public void Init(Flower _flower, int index) { // link the parent flower flower = _flower; //initialize the init rotation Grow(index); }
public ArrangementPageViewModel(InteriorField[,] layout, Chair chairModel, Table tableModel) { this.Rows = layout.GetLength(0); this.Columns = layout.GetLength(1); this.Arrangement = new ObservableCollection<ArrangedFieldViewModel>(); for (int y = 0; y < layout.GetLength(0); y++) for (int x = 0; x < layout.GetLength(1); x++) { this.Arrangement.Add(new ArrangedFieldViewModel((layout[y, x]))); } this.Palettes = new ObservableCollection<string>(new[] { "Light", "Dark" }); this.ChairModel = chairModel; this.TableModel = tableModel; Pathway autoPathway = new Pathway(); Flower autoFlower = new Flower(); foreach (ArrangedFieldViewModel field in this.Arrangement) { if (field?.PlaceHolder?.CanHoldObject(autoFlower) ?? false) field.ArrangeObjectCommand.Execute(autoFlower); else if (field?.PlaceHolder?.CanHoldObject(autoPathway) ?? false) field.ArrangeObjectCommand.Execute(autoPathway); } this.ClearAllCommand = new DelegateCommand((param) => this.ClearAll()); this.FillAllCommand = new DelegateCommand((param) => this.FillAll()); this.RemoveObjectCommand = new DelegateCommand(this.RemoveObject, this.CanRemoveObject); }
// grandy make and gives flower to girl public Flower GiveFlower(Girl girl) { Console.WriteLine("Пожалела старушка Женю, привела ее в свой садик и говорит:"); Console.WriteLine("- Ничего, не плачь, я тебе помогу."); Console.WriteLine("Я тебе подарю цветик-семицветик, он все устроит."); Console.WriteLine("С этими словами старушка подала девочке Жене цветок"); Console.WriteLine("- Этот цветик может исполнить все, что ты захочешь."); Console.WriteLine("Для этого надо только оторвать один из лепестков, бросить его и сказать:"); this.Spell(); // teaching girl make spell Flower flower = new Flower(girl); // giving flower return flower; }
public override void Init (Flower _flower , int index ) { base.Init(_flower,index); if (m_collider == null ) m_collider = GetComponent<Collider2D>(); m_collider.isTrigger = true; float massRate = Random.Range(0.5f, 1.2f); top2D.mass *= massRate; root.mass *= massRate; }
public Bee(int id, Point location, Hive hive, World world) { ID = id; Age = 0; this.location = location; InsideHive = true; destinationFlower = null; NectarCollected = 0; CurrentState = BeeState.Idle; this.world = world; this.hive = hive; MessageSender = hive.MessageSender; }
public void setFlower(Flower flower) { //float x, float y, float z) if (_flower) { if (_flower.isAttribuate()) { return; } } if (flower) { _flower = flower; _flower.spawnFlower(this.transform.position.x, this.transform.position.y, this.transform.position.z); } }
void OnEnable() { targ=target as Flower; try { if(targ.m_visualiser.GetComponent<Renderer>().sharedMaterial==null) { targ.m_visualiser.GetComponent<Renderer>().sharedMaterial=new Material(Shader.Find("Transparent/Diffuse")); } if(targ.basicTexture!=null) { targ.m_visualiser.GetComponent<Renderer>().sharedMaterial.mainTexture=targ.basicTexture; } } catch { } }
//restore un jardin depuis une sauvegarde public void setJardin(Jardin newJardin) { _jardin = newJardin; GameObject[] plane = GameObject.FindGameObjectsWithTag("Tile"); foreach (GameObject gameTile in plane) // Loop through List with foreach. { //clean de l'ancien jardin Tiles tuile = gameTile.GetComponent<Tiles>(); if (tuile.getFlower()) { tuile.getFlower().destroyFlower(); Debug.Log("tuile(" + tuile.x + "," + tuile.y + ") destroy flower"); } //ajout d'une fleur si jamais il y en a une à ces coordonnées Element elem = _jardin.existFlowerOnTile(tuile.x, tuile.y); if (elem != null) { Debug.Log(" elem x: " + elem.GetX() + " elem_y " + elem.GetY() + " non null!"); _flower = gameTile.AddComponent<Flower>(); _flower.setFlowerFromElem(elem); tuile.setFlower(_flower); tuile.attributeFlower(); } } }
// Use this for initialization void Start() { _jardin = new Jardin(); //initialisation d'un jardin vide mode = ToggleType.View; //le mode est en défault au départ lastMode = mode; _flower = null; _previousGameObject = null; buttonClean.onClick.AddListener(cleanJardin); }
//Modification d'une fleur, set les dropdown avec les valeurs de la fleur récupérée void ModifyFlower(GameObject tile) { //Debug.Log("modif flower"); if (Input.GetMouseButtonDown(0)) { Flower flower = tile.GetComponent<Tiles>().getFlower(); if (_flower == null) return; _flower = flower; buttonColor.value = buttonColor.options.FindIndex(a => a.text == _flower.couleur.ToString()); buttonFlower.value = buttonFlower.options.FindIndex(a => a.text == _flower.espece.ToString()); buttonSize.value = buttonSize.options.FindIndex(a => a.text == _flower.taille.ToString()); buttonConstante.value = buttonConstante.options.FindIndex(a => a.text == _flower.constante); buttonColor.RefreshShownValue(); buttonFlower.RefreshShownValue(); buttonSize.RefreshShownValue(); buttonConstante.RefreshShownValue(); //on supprime la constante des listes pour que ce ne soit pas bloquant quand on passera dans create. if (_flower.Element != null) { _jardin.Remove(_flower.Element); _flower.Element = null; } //on désattribue la fleur de sa tuile _flower.desattribuate(); setToggleActive("Create"); } }
//Création d'une fleur par récupération du contenu des dropdown //On supprime la fleur si jamais elle n'est pas attribuée à une tuile pour // pouvoir la reconstruire avec les nouvelles valeurs des dropdown void CreateFlower(GameObject tile) { if (_flower != null) if (!_flower.isAttribuate() ) { _flower.destroyFlower(); } Flower.Couleur couleur = (Flower.Couleur)Enum.Parse(typeof(Flower.Couleur), buttonColor.options.ElementAt(buttonColor.value).text); Flower.Espece espece = (Flower.Espece)Enum.Parse(typeof(Flower.Espece), buttonFlower.options.ElementAt(buttonFlower.value).text); Flower.Taille taille = (Flower.Taille)Enum.Parse(typeof(Flower.Taille), buttonSize.options.ElementAt(buttonSize.value).text); String constante = buttonConstante.options.ElementAt(buttonConstante.value).text; //check si la constante n'est pas déjà utilisée, si c'est le cas on stop la création if (_jardin.existConst(constante)) { errorText.text = "Constante déjà utilisée"; return; } //crée la fleur _flower = tile.AddComponent<Flower>(); _flower.setFlower(espece, couleur, taille, constante); hit.collider.gameObject.GetComponent<Tiles>().setFlower(_flower); }
private void AddProductButton_Click(object sender, RoutedEventArgs e) { string price = PriceTextBox.Text.Replace(" ", ""); int dot = 0; for (int i = 0; i < price.Length; i++) { if (price[i] == ',' || price[i] == '.') { dot++; } } if (dot > 1 || price == "," || price == "") { MessageBox.Show("Invalid Price Value"); } else { //MessageBox.Show($"Product Added Successfully\n Type: {selectedTypeRadioButton} \n Price: {price}"); switch (selectedTypeRadioButton) { case "tree": string height = HeightTextBox.Text.Replace(" ", ""); int dot2 = 0; for (int i = 0; i < height.Length; i++) { if (height[i] == ',' || price[i] == '.') { dot2++; } } if (dot2 > 1 || height == "," || height == "") { MessageBox.Show("Invalid Height Value"); } else { FlowerShop.Stock.Add(new Tree(float.Parse(price), float.Parse(height))); Tree _tree = (Tree)FlowerShop.Stock[FlowerShop.Stock.Count - 1]; MessageBox.Show($"Product Added Successfully\nType: {selectedTypeRadioButton}\nPrice: ${_tree.Price.ToString()}\nHeight: {_tree.Height.ToString()}"); } //Stock.Add(new Tree(float.Parse(price), float.Parse(feature))); break; case "flower": FlowerShop.Stock.Add(new Flower(float.Parse(price), color)); Flower _flower = (Flower)FlowerShop.Stock[FlowerShop.Stock.Count - 1]; MessageBox.Show($"Product Added Successfully\nType: {selectedTypeRadioButton}\nPrice: ${_flower.Price.ToString()}\nColor: {_flower.Color.ToString()}"); break; case "decoration": FlowerShop.Stock.Add(new Decoration(float.Parse(price), material)); Decoration _decoration = (Decoration)FlowerShop.Stock[FlowerShop.Stock.Count - 1]; MessageBox.Show($"Product Added Successfully\nType: {selectedTypeRadioButton}\nPrice: ${_decoration.Price.ToString()}\Material: {_decoration.Material.ToString()}"); break; default: break; } this.NavigationService.GoBack(); } }
public void Go(Random random) { Age++; BeeState oldState = CurrentState; switch (CurrentState) { case BeeState.Idle : if (Age > CarrerSpan) { CurrentState = BeeState.Retired; } else if (world.flowers.Count > 0 && hive.ConsumeHoney(HoneyConsumed)) { Flower flower = world.flowers[random.Next(world.flowers.Count)]; if (flower.Nectar >= MinimumFlowerNectar && flower.Alive) { destinationFlower = flower; CurrentState = BeeState.FlyingToFlower; } } break; case BeeState.FlyingToFlower: if (! world.flowers.Contains(destinationFlower)) { CurrentState = BeeState.ReturningToHive; } else if (InsideHive) { if (MoveTowardsLocation(hive.GetLocation("Exit"))) { InsideHive = false; location = hive.GetLocation("Entrance"); } } else if (MoveTowardsLocation(destinationFlower.Location)) { CurrentState = BeeState.GatheringNectar; } break; case BeeState.GatheringNectar: double nectar = destinationFlower.HarvestNectar(); if (nectar > 0) { NectarCollected += nectar; } else { CurrentState = BeeState.ReturningToHive; } break; case BeeState.ReturningToHive: if (!InsideHive) { if (MoveTowardsLocation(hive.GetLocation("Entrance"))) { InsideHive = true; location = hive.GetLocation("Exit"); } } else { if (MoveTowardsLocation(hive.GetLocation("HoneyFactory"))) { CurrentState = BeeState.MakingHoney; } } break; case BeeState.MakingHoney: if (NectarCollected < 0.5) { NectarCollected = 0; CurrentState = BeeState.Idle; } else { if (hive.AddHoney(0.5)) { NectarCollected -= 0.5; } else { NectarCollected = 0; } } break; case BeeState.Retired: break; } if (oldState != CurrentState && MessageSender != null) { MessageSender(ID, CurrentState.ToString()); } }
public static Block GetBlockById(byte blockId) { Block block = null; if (CustomBlockFactory != null) { block = CustomBlockFactory.GetBlockById(blockId); } if (block != null) return block; if (blockId == 0) block = new Air(); else if (blockId == 1) block = new Stone(); else if (blockId == 2) block = new Grass(); else if (blockId == 3) block = new Dirt(); else if (blockId == 4) block = new Cobblestone(); else if (blockId == 5) block = new Planks(); else if (blockId == 6) block = new Sapling(); else if (blockId == 7) block = new Bedrock(); else if (blockId == 8) block = new FlowingWater(); else if (blockId == 9) block = new StationaryWater(); else if (blockId == 10) block = new FlowingLava(); else if (blockId == 11) block = new StationaryLava(); else if (blockId == 12) block = new Sand(); else if (blockId == 13) block = new Gravel(); else if (blockId == 14) block = new GoldOre(); else if (blockId == 15) block = new IronOre(); else if (blockId == 16) block = new CoalOre(); else if (blockId == 17) block = new Log(); else if (blockId == 18) block = new Leaves(); else if (blockId == 19) block = new Sponge(); else if (blockId == 20) block = new Glass(); else if (blockId == 21) block = new LapisOre(); else if (blockId == 22) block = new LapisBlock(); else if (blockId == 23) block = new Dispenser(); else if (blockId == 24) block = new Sandstone(); else if (blockId == 25) block = new NoteBlock(); else if (blockId == 26) block = new Bed(); else if (blockId == 27) block = new GoldenRail(); else if (blockId == 28) block = new DetectorRail(); else if (blockId == 30) block = new Cobweb(); else if (blockId == 31) block = new TallGrass(); else if (blockId == 32) block = new DeadBush(); else if (blockId == 35) block = new Wool(); else if (blockId == 37) block = new YellowFlower(); else if (blockId == 38) block = new Flower(); else if (blockId == 39) block = new BrownMushroom(); else if (blockId == 40) block = new RedMushroom(); else if (blockId == 41) block = new GoldBlock(); else if (blockId == 42) block = new IronBlock(); else if (blockId == 43) block = new DoubleStoneSlab(); else if (blockId == 44) block = new StoneSlab(); else if (blockId == 45) block = new Bricks(); else if (blockId == 46) block = new Tnt(); else if (blockId == 47) block = new Bookshelf(); else if (blockId == 48) block = new MossStone(); else if (blockId == 49) block = new Obsidian(); else if (blockId == 50) block = new Torch(); else if (blockId == 51) block = new Fire(); else if (blockId == 52) block = new MonsterSpawner(); else if (blockId == 53) block = new OakWoodStairs(); else if (blockId == 54) block = new Chest(); else if (blockId == 55) block = new RedstoneWire(); else if (blockId == 56) block = new DiamondOre(); else if (blockId == 57) block = new DiamondBlock(); else if (blockId == 58) block = new CraftingTable(); else if (blockId == 59) block = new Wheat(); else if (blockId == 60) block = new Farmland(); else if (blockId == 61) block = new Furnace(); else if (blockId == 62) block = new LitFurnace(); else if (blockId == 63) block = new StandingSign(); else if (blockId == 64) block = new WoodenDoor(); else if (blockId == 65) block = new Ladder(); else if (blockId == 66) block = new Rail(); else if (blockId == 67) block = new CobblestoneStairs(); else if (blockId == 68) block = new WallSign(); else if (blockId == 69) block = new Lever(); else if (blockId == 70) block = new StonePressurePlate(); else if (blockId == 71) block = new IronDoor(); else if (blockId == 72) block = new WoodenPressurePlate(); else if (blockId == 73) block = new RedstoneOre(); else if (blockId == 74) block = new LitRedstoneOre(); else if (blockId == 75) block = new UnlitRedstoneTorch(); else if (blockId == 76) block = new RedstoneTorch(); else if (blockId == 77) block = new StoneButton(); else if (blockId == 78) block = new SnowLayer(); else if (blockId == 79) block = new Ice(); else if (blockId == 80) block = new Snow(); else if (blockId == 81) block = new Cactus(); else if (blockId == 82) block = new Clay(); else if (blockId == 83) block = new Reeds(); else if (blockId == 85) block = new Fence(); else if (blockId == 86) block = new Pumpkin(); else if (blockId == 87) block = new Netherrack(); else if (blockId == 88) block = new SoulSand(); else if (blockId == 89) block = new Glowstone(); else if (blockId == 90) block = new Portal(); else if (blockId == 91) block = new LitPumpkin(); else if (blockId == 92) block = new Cake(); else if (blockId == 93) block = new UnpoweredRepeater(); else if (blockId == 94) block = new PoweredRepeater(); else if (blockId == 95) block = new InvisibleBedrock(); else if (blockId == 96) block = new Trapdoor(); else if (blockId == 97) block = new MonsterEgg(); else if (blockId == 98) block = new StoneBrick(); else if (blockId == 99) block = new BrownMushroomBlock(); else if (blockId == 100) block = new RedMushroomBlock(); else if (blockId == 101) block = new IronBars(); else if (blockId == 102) block = new GlassPane(); else if (blockId == 103) block = new Melon(); else if (blockId == 106) block = new Vine(); else if (blockId == 107) block = new FenceGate(); else if (blockId == 108) block = new BrickStairs(); else if (blockId == 109) block = new StoneBrickStairs(); else if (blockId == 110) block = new Mycelium(); else if (blockId == 111) block = new Waterlily(); else if (blockId == 112) block = new NetherBrick(); else if (blockId == 113) block = new NetherBrickFence(); else if (blockId == 114) block = new NetherBrickStairs(); else if (blockId == 115) block = new NetherWart(); else if (blockId == 116) block = new EnchantingTable(); else if (blockId == 117) block = new BrewingStand(); else if (blockId == 120) block = new EndPortalFrame(); else if (blockId == 121) block = new EndStone(); else if (blockId == 122) block = new LitRedstoneLamp(); else if (blockId == 123) block = new RedstoneLamp(); else if (blockId == 126) block = new ActivatorRail(); else if (blockId == 127) block = new Cocoa(); else if (blockId == 128) block = new SandStoneStairs(); else if (blockId == 129) block = new EmeraldOre(); else if (blockId == 131) block = new TripwireHook(); else if (blockId == 132) block = new Tripwire(); else if (blockId == 133) block = new EmeraldBlock(); else if (blockId == 134) block = new SpruceWoodStairs(); else if (blockId == 135) block = new BirchWoodStairs(); else if (blockId == 136) block = new JungleWoodStairs(); else if (blockId == 139) block = new CobblestoneWall(); else if (blockId == 140) block = new FlowerPot(); else if (blockId == 141) block = new Carrots(); else if (blockId == 142) block = new Potatoes(); else if (blockId == 143) block = new WoodenButton(); else if (blockId == 144) block = new Skull(); else if (blockId == 145) block = new Anvil(); else if (blockId == 146) block = new TrappedChest(); else if (blockId == 147) block = new LightWeightedPressurePlate(); else if (blockId == 148) block = new HeavyWeightedPressurePlate(); else if (blockId == 151) block = new DaylightDetector(); else if (blockId == 152) block = new RedstoneBlock(); else if (blockId == 153) block = new QuartzOre(); else if (blockId == 155) block = new QuartzBlock(); else if (blockId == 156) block = new QuartzStairs(); else if (blockId == 157) block = new DoubleWoodSlab(); else if (blockId == 158) block = new WoodSlab(); else if (blockId == 159) block = new StainedHardenedClay(); else if (blockId == 161) block = new AcaciaLeaves(); else if (blockId == 162) block = new AcaciaLog(); else if (blockId == 163) block = new AcaciaStairs(); else if (blockId == 164) block = new DarkOakStairs(); else if (blockId == 167) block = new IronTrapdoor(); else if (blockId == 170) block = new HayBlock(); else if (blockId == 171) block = new Carpet(); else if (blockId == 172) block = new HardenedClay(); else if (blockId == 173) block = new CoalBlock(); else if (blockId == 174) block = new PackedIce(); else if (blockId == 175) block = new Sunflower(); else if (blockId == 178) block = new DaylightDetectorInverted(); else if (blockId == 183) block = new SpruceFenceGate(); else if (blockId == 184) block = new BirchFenceGate(); else if (blockId == 185) block = new JungleFenceGate(); else if (blockId == 186) block = new DarkOakFenceGate(); else if (blockId == 187) block = new AcaciaFenceGate(); else if (blockId == 198) block = new GrassPath(); else if (blockId == 199) block = new ItemFrame(); else if (blockId == 243) block = new Podzol(); else if (blockId == 244) block = new Beetroot(); else if (blockId == 245) block = new Stonecutter(); else if (blockId == 246) block = new GlowingObsidian(); else if (blockId == 247) block = new NetherReactorCore(); else { // Log.DebugFormat(@" // // Add this missing block to the BlockFactory // else if (blockId == {1}) block = new {0}(); // // public class {0} : Block // {{ // internal {0}() : base({1}) // {{ // }} // }} //", "Missing", blockId); block = new Block(blockId); } return block; }
public void remFlower(Flower f) { if(flowers.Find(Flower => Flower.fName == f.fName) != null){ //see if flower exists in list already flowers[flowers.FindIndex(Flower => Flower.fName == f.fName)].num -= 1; //change 1 to f.num at some point plz self } }
public void ShowFlower(Vector3 pos, string msg1, float time) { Vector3 vector3 = mainCamera.WorldToScreenPoint(pos); Flower flower = new Flower(); float num = (float)Screen.width / (float)Screen.height; vector3.x = (float)(vector3.x / scaleX * num * 0.75f - (scaleX - scale.y) / 2.5f * originalWidth); vector3.y = vector3.y / scale.y; flower.X = vector3.x - (float)(msg1.Length * 16.0f / 2.0f); flower.Y = originalHeight - vector3.y; flower.txt = msg1; flower.timeEnd = time; flowerList.Add(flower); }
public void ShowFlower(string msg1) { Vector3 vector3 = mainCamera.WorldToScreenPoint(new Vector3(15.0f, 0.0f, 16.0f)); Flower flower = new Flower(); float num = (float)Screen.width / Screen.height; vector3.x = (vector3.x / scaleX * num * 0.75f - (scaleX - scale.y) / 2.5f * originalWidth); vector3.y = vector3.y / scale.y; flower.X = vector3.x - (msg1.Length * 16 / 2); flower.Y = originalHeight - vector3.y; flower.txt = msg1; flower.timeEnd = 1.0f; flowerList.Add(flower); }
// Use this for initialization void Start() { _flower = null; }
public void Attach(Flower flower) { _flower = flower; flower.AttachTo(transform, Vector2.zero); onFlowerGathered.Invoke(_flower); }
public static void Main() { random = new Random (); ClutterRun.Init (); Stage stage = Stage.Default; stage.Fullscreen = true; stage.Color = new Clutter.Color (0x10, 0x10, 0x10, 0xff); flowers = new Flower[N_FLOWERS]; for (int i = 0; i < N_FLOWERS; i++) { flowers[i] = new Flower (); flowers[i].x = (int)(rand () % stage.Width - (PETAL_MIN + PETAL_VAR)*2); flowers[i].y = (int)(rand () % stage.Height); flowers[i].rv = rand () % 5 + 1; flowers[i].v = rand () % 10 + 2; stage.AddActor (flowers[i].ctex); flowers[i].ctex.SetPosition (flowers[i].x, flowers[i].y); } GLib.Timeout.Add (50, new GLib.TimeoutHandler (Tick)); stage.ShowAll (); stage.KeyPressEvent += HandleKeyPress; ClutterRun.Main (); }
public override void Init (Flower _flower, int index) { base.Init(_flower, index); myUpDiff = Global.V2ToV3 (Global.GetRandomDirection() * 0.33f ); chaosFunction = StartCoroutine(GenerateChaos(0.1f)); }
// take flower from Grandy public void TakeFlower(Flower flower) { this.flower = flower; // flower that Grandy give became also Girl flower Console.WriteLine("Женя вежливо поблагодарила старушку, вышла за калитку"); Console.WriteLine("И решила она позагадывать желания"); }
private FlowerF(Flower f) { this.f = f; }
public void setCanPickTrue(Flower f) { canPick = true; flower = f; }