public static Bird CreateBird(BirdSpecies Species) { Bird animalObj = null;//Birdtype unknown at this time. //Lets determine users choice of animal. switch (Species) { case BirdSpecies.Crow: animalObj = new Crow(); break; case BirdSpecies.Eagle: animalObj = new Eagle(); break; case BirdSpecies.Penguin: animalObj = new Penguin(); break; default: Debug.Assert(false, "Not implemented"); break; } //Set animal category animalObj.Category = CategoryType.Bird; return(animalObj);//Return created instance of object. }
static void Main(string[] args) { Arctic arcticHabitat = new Arctic(); Rainforest rainforestHabitat = new Rainforest(); arcticHabitat.inhabitants = new List <Animal>(); Penguin larry = new Penguin(); larry.species = new EudyptesChrysolophus(); larry.name = "Larry"; Penguin betty = new Penguin(); betty.species = new EudyptesChrysolophus(); betty.name = "Betty"; arcticHabitat.inhabitants.Add(larry); arcticHabitat.inhabitants.Add(betty); foreach (Animal a in arcticHabitat.inhabitants) { Console.WriteLine(a.name); Console.WriteLine("{0} the {1} in the genus {2}. To find out more visit {3}.", a.name, a.species.commonName, a.species.genus.scientificName, a.species.url); } Console.ReadLine(); }
public void UnlockAvatar(Content.Avatars avatar) { switch (avatar) { case Content.Avatars.Dragon: unlockedAvatar = new Dragon(); if (!AvailableAvatars.Contains(unlockedAvatar)) { AvailableAvatars.Add(unlockedAvatar); } break; case Content.Avatars.Penguin: unlockedAvatar = new Penguin(); if (!AvailableAvatars.Contains(unlockedAvatar)) { AvailableAvatars.Add(unlockedAvatar); } break; case Content.Avatars.PiggyBank: unlockedAvatar = new PiggyBank(); if (!AvailableAvatars.Contains(unlockedAvatar)) { AvailableAvatars.Add(unlockedAvatar); } break; } if (AvailableAvatars.Count == 1) { ChangeAvatar(avatar); } }
public override void Start() { base.Start(); woodpecker = FindObjectOfType <Woodpecker>(); hummingbird = FindObjectOfType <Hummingbird>(); penguin = FindObjectOfType <Penguin>(); }
public static Bird CreateBird(BirdSpecies Species) { Bird animalObj = null;//Birdtype unknown at this time. //Lets determine users choice of animal. switch (Species) { case BirdSpecies.Crow: animalObj = new Crow(); break; case BirdSpecies.Eagle: animalObj = new Eagle(); break; case BirdSpecies.Penguin: animalObj = new Penguin(); break; default: Debug.Assert(false, "Not implemented"); break; } //Set animal category animalObj.Category = CategoryType.Bird; return animalObj;//Return created instance of object. }
public void Initialize() { mg_BeanCounter active = MinigameManager.GetActive <mg_BeanCounter>(); if (!active.Resources.HasLoadedGameSounds) { active.Resources.LoadGameSounds(); } m_background = active.Resources.GetInstancedResource(mg_bc_EResourceList.GAME_ASSET_BACKGROUND); MinigameSpriteHelper.SetSpriteLayer(m_background, -100); Vector3 localScale = m_background.transform.localScale; MinigameSpriteHelper.FitSpriteToScreen(active.MainCamera, m_background, _preserveAspect: false); MinigameSpriteHelper.AssignParent(m_background, base.gameObject); base.gameObject.transform.localScale = m_background.transform.localScale; m_background.transform.localScale = localScale; GameObject gameObject = base.gameObject.transform.Find("mg_bc_penguin").gameObject; Penguin = gameObject.GetComponent <mg_bc_Penguin>(); Penguin.GameLogic = this; GameObject gameObject2 = base.gameObject.transform.Find("mg_bc_dropzone").gameObject; DropZone = gameObject2.GetComponent <mg_bc_DropZone>(); GameObject gameObject3 = base.gameObject.transform.Find("mg_bc_truck").gameObject; Truck = gameObject3.GetComponent <mg_bc_Truck>(); Truck.CanSpawnLives = Penguin.Lives.Value < 4; GameObject gameObject4 = base.gameObject.transform.Find("mg_bc_left_edge").gameObject; GameObject gameObject5 = base.gameObject.transform.Find("mg_bc_right_edge").gameObject; Penguin.SetMovementLimits(gameObject4.transform.localPosition.x, gameObject5.transform.localPosition.x); ScoreController.Initialize(Truck); }
static void Run(string[] args) { var penguin = new Penguin(); penguin.Swim(); penguin.Walk(); }
public void CompleteLogin(MySqlDataReader reader, Penguin client, dynamic body) { var details = reader.GetDictFromReader(); //"101|OP1-{AB-ERTS-972H}-09-K|valid22|f54fb87b5b1e6120e28c5bbf1a6ca862|NULL|45|2" var nick = ((string)body.login.nick.Value).Split(char.Parse("|")); client.swid = nick[1]; client.username = client.nickname = ((string)nick[2]).preetify(); string password = nick[3]; if (client.username.ToLower() != details["Username"].ToLower() || password != details["ConfirmationHash"] || client.swid != details["SWID"] || password == "") { client.send("e", "101", "#2"); Airtower.disposeClient(false, client.getSocket()); return; } var pword = body.login.pword.Value.Split(char.Parse("#")); if (pword[0] != String.Format("{0}{1}", (password + GetPenguinRandomKey(client)).md5().swap(16), password) || pword[1] != details["LoginKey"] || pword[0] == "" || pword[1] == "") { client.send("e", "101", "#3"); Airtower.disposeClient(false, client.getSocket()); return; } client.send("l", "$loggedin"); return; }
public void CheckIfCanSpawn() { int lastEnemyDistance = 0; Vector2 spawnPoint = GameState.Instance.GetVar <Vector2>("spawn_point"); Penguin penguin = GameState.Instance.GetVar <Penguin>("penguin"); spawnPoint.X = penguin.GetPosition().X + GameState.Instance.GetCurrentScene().GetWindowWidth(); if (LastSpawnedEnemy != null) { lastEnemyDistance = (int)spawnPoint.X - (int)LastSpawnedEnemy.GetPosition().X; } double spawnChance = this.SpawnRandom.NextDouble(); if (LastSpawnedEnemy == null || lastEnemyDistance >= MAX_ENEMY_DISTANCE || (lastEnemyDistance >= MIN_ENEMY_DISTANCE && spawnChance < SPAWN_RATE)) { double walrusChance = this.SpawnRandom.NextDouble(); if (walrusChance < WALRUS_RATE) { Walrus walrus = new Walrus(spawnPoint); GameState.Instance.GetCurrentScene().AddEntity(walrus); LastSpawnedEnemy = walrus; } else { spawnPoint.Y = spawnPoint.Y - 90; Seagull seagull = new Seagull(spawnPoint); GameState.Instance.GetCurrentScene().AddEntity(seagull); LastSpawnedEnemy = seagull; } } }
private void OnRemovePenguin(Penguin penguin) { if (_targetPenguin == penguin) { SwitchTarget(); } }
public static void Main(string[] args) { var system = ActorSystem.Create("Joke"); var reporter = system.ActorOf(Reporter.Props()); IActorRef[] penguins = new IActorRef[10]; int i = 1; for (; i <= 9; i++) { penguins[i - 1] = system.ActorOf(Penguin.Props($"Penguin {i}")); } penguins[i - 1] = system.ActorOf(DongDong.Props()); foreach (IActorRef penguin in penguins) { penguin.Tell(Interest.Instance, reporter); } Console.ReadLine(); //system.WhenTerminated.Wait(); Console.WriteLine("End !!!"); }
public void HandlePenguinBanned(MySqlDataReader reader, Penguin client, AutoResetEvent evnt) { if (!reader.HasRows) { client.banned = false; evnt.Set(); return; } var details = reader.GetDictFromReader(); long timestamp = long.Parse(details["till"]); long currentTmsp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds; if (timestamp > currentTmsp) { client.banned = true; string hoursban = (Math.Round((timestamp - currentTmsp) / 3600.0)).ToString(); client.send("e", "601", hoursban); Airtower.disposeClient(false, client.getSocket()); } else { client.banned = false; MySQLStatement stmt = new MySQLStatement("UPDATE `banned` SET `till` = '0' AND `b_by`='' AND `reason`='' WHERE `ID` = @id", new Dictionary <string, dynamic> { { "@id", client.id } }); Server.Utils.MySQL.MySQL.getCurrentMySQLObject().MySQLCallback(stmt); } evnt.Set(); }
public void populateViews(Penguin p) { penguin = p; cController = Camera.main.gameObject.GetComponent <CurrencyController>(); fController = Camera.main.gameObject.GetComponent <FactoryController>(); sliderComponent = penguinProgress.GetComponent <PenguinProgressSlider>(); updateViews(); penguinImage.onClick.AddListener(() => { if (!isBeingManaged) { if (!progressComplete) { startProcess(); } else { collectIncome(); sliderComponent.finishTimer(); } } }); penguinLevelUp.onClick.AddListener(() => { if (cController.canAfford(penguin.getCost())) { cController.spend(penguin.getCost()); penguin.incrementLevel(); } }); populationComplete = true; }
static void Main(string[] args) { Bird bird1 = new Sparrow(); bird1.PerformFly(); bird1.PerformSound(); Bird bird2 = new Duck(); bird2.PerformFly(); bird2.PerformSound(); Bird bird3 = new Canary(); bird3.PerformFly(); bird3.PerformSound(); bird3.SetFlyBehavior(new FlyNoWay()); bird3.SetSoundBehavior(new Mute()); bird3.PerformFly(); bird3.PerformSound(); Bird bird4 = new Penguin(); bird4.PerformFly(); bird4.PerformSound(); Console.WriteLine("End of program"); Console.ReadKey(); }
public Inventory(Penguin penguin = null, params string[] items) : this(penguin) { int count = items.Length; var Cache = (CacheHandler)Shell.getCurrentShell().DEPENDENCIES[CacheHandler.CLASS_LINKAGE_NAME]; for (int i = 0; i < count; i++) { int _out; Item item_; if (!int.TryParse(items[i], out _out)) { throw new InvalidCastException(String.Format("Item {0} on given array is not an integer!", i)); } if (!Cache.ItemExists(_out)) { throw new KeyNotFoundException(String.Format("Item {0} doesn't exists or not found!", i)); } if (this.items.Contains(item_ = Cache.GetItem(_out)[0])) { continue; } this.items.Add(item_); } }
public OCPService() { Mallarrd m = new Mallarrd(new Swimming(), new QuackingDuck(), new Flying()); m.Fly(); m.Quack(); m.Swim(); m.Waddle(); Rubber r = new Rubber(new Swimming(), new SqueakingDuck(), new Flying()); r.Fly(); r.Quack(); r.Swim(); r.Waddle(); Penguin p = new Penguin(new Swimming(), new QuackingDuck(), new NoFly()); p.Fly(); p.Quack(); p.Swim(); p.Waddle(); Eider e = new Eider(new Swimming(), new OoohDuck(), new Flying()); e.Fly(); e.Quack(); e.Swim(); e.Waddle(); }
private void instantiatePenguinItem(Penguin penguin) { GameObject newItem = Instantiate(listItem); newItem.transform.SetParent(scrollContent); newItem.GetComponent <PenguinListItem>().populateViews(penguin); }
// Use this for initialization void Start() { penguin = GetComponent <Penguin>(); bodyPartManager = GameObject.FindGameObjectWithTag("BodyPartManager").GetComponent <BodyPartManager>(); agent = GetComponent <NavMeshAgent>(); heightManager = GetComponent <HeightManager>(); }
static void Main(string[] args) { Game game = new Game(); Player player = new Player(); game.Welcome(); player.Adopt(); //Inheritance variable - Child class Penguin penguin = new Penguin("Squawk, Squawk", "winter", "a fish"); penguin.Color(); //for random color Console.WriteLine(penguin.sound); Console.ReadKey(); //House object, diamond House house = new House("diamond"); house.About(); penguin.Eat(); penguin.ispoop = true; penguin.Poop(); //Toy object. Ice Toy ice = new Toy("an ice cube"); ice.About(); penguin.Sleep(); game.End(); }
public void SelectPenguin(string name) { if (current_penguin) { Hide(); Debug.Log("Hiding the pinguin."); } Debug.Log(name); HidePinguins(); switch (name) { case "hunter": current_penguin = penguins.hunter; break; case "worker": current_penguin = penguins.worker; break; case "manager": current_penguin = penguins.coleBlanc; break; default: current_penguin = penguins.seller; break; } current_penguin.Show(); }
override public void Removed(Penguin client) { client.Room = null; Console.WriteLine(String.Format("Removed {0} from {1}", client.username, this.name)); this.send("rp", client.id); }
public override void setTarget(Penguin.CellPattern pattern) { base.setTarget (pattern); amplitude_ = serializedTarget_.FindProperty("amplitude" ); wavelength_ = serializedTarget_.FindProperty("wavelength"); width_ = serializedTarget_.FindProperty("width" ); }
public Client.Base.BaseRoom getServerRoomObjectByPenguinObject(Penguin client) { if (client.Room != null) { return(client.Room); } return(null); }
public string getServerRoomIdByPenguinObject(Penguin client) { if (client.Room != null) { return(client.Room.GetRoomId()); } return("-1"); }
override public void Added(Penguin client) { client.Room = this; Console.WriteLine(String.Format("{0} has joined {1}", client.username, this.name)); // Send ap packet. this.send("ap", Shell.getCurrentShell().GetPlayerString(client.id)); client.send("jr", this.ToString()); }
// Use this for initialization void Start() { bodyPartManager = GameObject.FindGameObjectWithTag("BodyPartManager").GetComponent <BodyPartManager>(); anim = GetComponent <Animator>(); penguin = GetComponentInParent <Penguin>(); navManager = GetComponentInParent <NavManager>(); heightManager = GetComponentInParent <HeightManager>(); }
public void ContinuePrimaryLogin(MySqlDataReader reader, Penguin client, dynamic data) { if (!reader.HasRows || GetPenguinRandomKey(client) == null) { client.send("e", "101"); Airtower.disposeClient(false, client.getSocket()); return; } var penguin_details = reader.GetDictFromReader(); string password = Cryptography.GenerateLoginHash(penguin_details["Password"], GetPenguinRandomKey(client)); if (password != client.password) { client.send("e", "101"); Airtower.disposeClient(false, client.getSocket()); return; } client.id = penguin_details["ID"]; // Handle Banned MySQLStatement stmt = new MySQLStatement(""); stmt.parameters = new Dictionary <string, dynamic> { { "@id", client.id } }; AutoResetEvent evnt = new AutoResetEvent(false); stmt.statement = "SELECT `till` FROM `banned` WHERE `ID` = @id"; Server.Utils.MySQL.MySQL.getCurrentMySQLObject().MySQLCallback(stmt, Server.Utils.Events.EventDelegate.create(this, "HandlePenguinBanned"), client, evnt); evnt.WaitOne(); if (client.banned) { return; } string ConfHash = GetPenguinRandomKey(client).md5() + "-" + penguin_details["Password"].GetHashCode().ToString().md5(); Shell.getCurrentShell().getCurmbs("Login")["HashKey"][client][1] = ConfHash; stmt.statement = "UPDATE `penguins` SET `LoginKey` = @lk, `ConfirmationHash` = @ch WHERE `ID` = @id"; stmt.parameters["@lk"] = ConfHash; stmt.parameters["@ch"] = password; Server.Utils.MySQL.MySQL.getCurrentMySQLObject().MySQLCallback(stmt); string users_bar = Math.Floor((double)(Airtower.Clients.Values.Where(i => i.PORT == 9875).ToList().Count * 5 / 550)).ToString(); client.send("l", string.Format("{0}|{1}|{2}|{3}|NULL|45|2", new object[] { client.id, penguin_details["SWID"], client.username, password }), ConfHash, ConfHash.md5(), string.Format("100,{0}", users_bar), penguin_details["Email"]); Airtower.disposeClient(false, client.getSocket()); }
public void startTimer(Penguin p) { if (!started) { FillTime = p.getTimeToComplete(); Reset(); started = true; } }
public void SetPengu(Penguin p) { pengu = p; pengu.Bar = this; if (!cam) { cam = Camera.main; } }
protected override void OnSingleTapConfirmed() { if (mPenguin == null) { mPenguin = FindObjectOfType <Penguin>(); } mPenguin.OnSingleTapped(); }
private void OnRoundEnd() { NoticeDisplayer.ShowMessage("Truck Unloaded!", 1.5f); Penguin.DisableCollisions(); Penguin.ClearBags(); DropZone.ClearBags(); m_state = mg_bc_EGameState.STATE_ROUND_TRANSITION; Truck.StartRoundTransition(OnRoundTransitionHalf, OnRoundTransitionEnded); }
internal void RemovePenguin(Penguin penguin, Vector2Int coords) { if (penguinMap.ContainsKey(coords)) { penguinMap[coords].penguins.Remove(penguin); } AddDirtyCells(coords); }
public override void setTarget(Penguin.CellPattern pattern) { base.setTarget (pattern); size_ = serializedTarget_.FindProperty("size"); separation_ = serializedTarget_.FindProperty("separation"); }
public override void setTarget(Penguin.CellPattern pattern) { base.setTarget (pattern); breakSize_ = serializedTarget_.FindProperty("breakSize" ); intervalSize_ = serializedTarget_.FindProperty("intervalSize"); }
public override void setTarget(Penguin.CellPattern pattern) { base.setTarget (pattern); storeName_ = serializedTarget_.FindProperty("storeName"); store_ = serializedTarget_.FindProperty("store"); }