// FixedUpdate is called on a fixed interval for every physics frame // you'll want to use FixedUpdate for doing anything with physics void FixedUpdate() { // INPUT AXES: a virtual joystick that returns a float from -1 to 1 player.AddForce(transform.forward * speed * Input.GetAxis("Vertical")); // comment out sideways movement //player.AddForce ( transform.right * speed * Input.GetAxis ( "Horizontal")); // TURNING transform.Rotate(0f, Input.GetAxis("Horizontal") * turnSpeed, 0f); // JUMPING if (Input.GetKeyDown(KeyCode.Space) && Time.time > nextJump) { nextJump = Time.time + jumpRate; player.AddForce(transform.up * jumpHeight); } flowerScript = flowerTrigger.GetComponent <FlowerPower>(); if ((flowerScript.hasFlower == true) && (jumpAdded)) { jumpHeight = jumpHeight + jumpAdd; jumpAdded = false; } }
public void AddToPool(FlowerPower _flower) { _flower.transform.SetParent(transform); pooledFlowers.Add(_flower); _flower.gameObject.SetActive(false); placedFlowers.Remove(_flower); }
/// <summary> /// Den här metoden sköter ability3 /// </summary> /// <returns></returns> protected override Ability CastAbility3() { Ability ability = new FlowerPower(TextureBank.mageSpellList[11], pos, new Vector2(0, 0), this); Ability3CooldownTimer = ability.coolDownTime; SoundBank.SoundEffectList[11].Play(); return(ability); }
public Druid(Texture2D tex, Vector2 pos, int playerIndex, Controller Controller) : base(tex, pos, playerIndex, Controller) { HealthPoints = ValueBank.DruidHealth; MaxHealthPoints = HealthPoints; Ability1 = new Root(TextureBank.mageSpellList[13], pos, LastDirection); Ability2 = new Healharm(TextureBank.mageSpellList[3], pos, LastDirection); Ability3 = new FlowerPower(TextureBank.mageSpellList[11], pos, new Vector2(0, 0), this); }
// Update is called once per frame void Update() { flowerScript = flowerTrigger.GetComponent <FlowerPower>(); if (flowerScript.hasFlower) { Destroy(gameObject); } }
void OnTriggerEnter(Collider activator) { flowerScript = flowerTrigger.GetComponent <FlowerPower>(); if (flowerScript.hasFlower) { wallDown = true; uiText.text = "You use the flower's magic on one of the sleeping humans just in time for a third " + "human to run over and shake him awake. He instantly falls in love with her, and they run off together. " + "Once the other human wakes up, she runs out into the woods to look for the couple. " + "You get the feeling that whatever you did probably didn't help the way Oberon thought it would. " + "Lord what fools these mortals be!" + "\n\nAt least now that they're gone, the path for you to travel " + "back home through is clear!"; } else { uiText.text = "There are some humans sleeping in the middle of the forest. " + "You recognize them as the people Oberon said were having troubles with love. They look " + "like they're pretty content to you, but you should probably do what the boss says and get that flower anyway. " + "\n\nBesides, they're blocking your path back home."; } }
public static void Main(string[] args) { mAlive = true; DateTime InitStart = DateTime.Now; // Set up basic output Console.WriteLine("Initializing Snowlight..."); // Cannot be localized before config+lang is loaded // Load configuration, translation, and re-configure output from config data ConfigManager.Initialize(Constants.DataFileDirectory + "server-main.cfg"); Output.InitializeStream(true, (OutputLevel)ConfigManager.GetValue("output.verbositylevel")); Output.WriteLine("Initializing Snowlight..."); Localization.Initialize(Constants.LangFileDirectory + "lang_" + ConfigManager.GetValue("lang") + ".lang"); // Process args foreach (string arg in args) { Output.WriteLine(Localization.GetValue("core.init.cmdarg", arg)); Input.ProcessInput(arg.Split(' ')); } try { // Initialize and test database Output.WriteLine(Localization.GetValue("core.init.mysql")); SqlDatabaseManager.Initialize(); // Initialize network components Output.WriteLine(Localization.GetValue("core.init.net", ConfigManager.GetValue("net.bind.port").ToString())); mServer = new SnowTcpListener(new IPEndPoint((IPAddress)ConfigManager.GetValue("net.bind.ip"), (int)ConfigManager.GetValue("net.bind.port")), (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback( SessionManager.HandleIncomingConnection)); /*Output.WriteLine(Localization.GetValue("core.init.net", ConfigManager.GetValue("net.cmd.bind.port").ToString())); * musServer = new SnowTcpListener(new IPEndPoint((IPAddress)ConfigManager.GetValue("net.cmd.bind.ip"), (int)ConfigManager.GetValue("net.cmd.bind.port")), * (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback( * CommandListener.parse));*/ using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { Output.WriteLine(Localization.GetValue("core.init.dbcleanup")); PerformDatabaseCleanup(MySqlClient); Output.WriteLine(Localization.GetValue("core.init.game")); // Core DataRouter.Initialize(); // Sessions, characters SessionManager.Initialize(); // RandomGenerator.Initialize(); StatisticsSyncUtil.Initialize(); //Global Handler Global.Initialize(); //Login Handler Login.Initialize(); CharacterInfoLoader.Initialize(); UserCredentialsAuthenticator.Initialize(); //Bpad Handler LaptopHandler.Initialize(); //FlowerHandler FlowerPower.Initialize(); ContestHandler.Initialize(); CatalogManager.Initialize(MySqlClient); NewsCacheManager.Initialize(MySqlClient); SpaceInfoLoader.Initialize(); Navigator.Initialize(MySqlClient); LaptopHandler.Initialize(); UserCredentialsAuthenticator.Initialize(); SpaceManager.Initialize(MySqlClient); SpaceHandler.Initialize(); SilverCoinsWorker.Initialize(); } } catch (Exception e) { HandleFatalError(Localization.GetValue("core.init.error.details", new string[] { e.Message, e.StackTrace })); return; } // Init complete TimeSpan TimeSpent = DateTime.Now - InitStart; Output.WriteLine(Localization.GetValue("core.init.ok", Math.Round(TimeSpent.TotalSeconds, 2).ToString()), OutputLevel.Notification); Output.WriteLine((string)Localization.GetValue("core.init.ok.cmdinfo"), OutputLevel.Notification); Console.Write("$" + Environment.UserName.ToLower() + "@snowlight> "); Console.Beep(); Input.Listen(); // This will make the main thread process console while Program.Alive. }
public FlowerPower GetFlower(int randomIndex) { selectedFlower = pooledFlowers[randomIndex]; pooledFlowers.RemoveAt(randomIndex); return(selectedFlower); }