public static Entity Load(Level level, LevelData levelData, Vector2 offset, EntityData entityData) { EntityID entityID = new EntityID(levelData.Name, entityData.ID); bool notDiedOrVisitedFurtherRooms = level.Session.FurthestSeenLevel == level.Session.Level || level.Session.Deaths == 0; bool unlockedCSides = SaveData.Instance.UnlockedModes >= 3 || SaveData.Instance.DebugMode; bool completed = SaveData.Instance.Areas_Safe[level.Session.Area.ID].Modes[(int)level.Session.Area.Mode].Completed; if (!entityData.Bool("mustNotDieAndVisitFurtherRooms", true)) { notDiedOrVisitedFurtherRooms = true; } if (!entityData.Bool("mustHaveUnlockedCSides", true)) { unlockedCSides = true; } if (!entityData.Bool("mustHaveCompletedLevel", true)) { completed = true; } if ((SaveData.Instance.CheatMode || (unlockedCSides && completed)) && notDiedOrVisitedFurtherRooms) { Strawberry berry = new Strawberry(entityData, offset, entityID); new DynData <Strawberry>(berry)["Golden"] = true; return(berry); } return(null); }
public override void Awake(Scene scene) { base.Awake(scene); RingColor = FrostModule.SaveData.IsChallengeBeaten(SceneAs <Level>().Session.Area.SID, ChallengeNameID, TimeLimit) ? Color.Blue : Color.Gold; var last = nodes.Last(); if (spawnBerry) { Collider = new Hitbox(width, height, last.X - Position.X, last.Y - Position.Y); BerryToSpawn = null; foreach (var berry in Scene.Entities.OfType <Strawberry>()) { if (new Rectangle((int)last.X, (int)last.Y, (int)width, (int)height).Contains(new Point((int)berry.Position.X, (int)berry.Position.Y))) { BerryToSpawn = berry; break; } } if (BerryToSpawn == null) { throw new Exception($"Didn't find a berry inside of the final node of the Speed Ring: {ChallengeNameID}, but there's {Scene.Entities.OfType<Strawberry>().Count()} berries"); } BerryToSpawn.Active = BerryToSpawn.Visible = BerryToSpawn.Collidable = false; } Collider.Position = Vector2.Zero; }
public void Chop(Mobile from) { if (from.InRange(this.GetWorldLocation(), 1)) { if (from == m_sower) { from.Direction = from.GetDirectionTo(this); double lumberValue = from.Skills[SkillName.Lumberjacking].Value / 100; if ((lumberValue > .5) && (Utility.RandomDouble() <= lumberValue)) { Strawberry fruit = new Strawberry(Utility.Random(m_yield + 2)); from.AddToBackpack(fruit); } this.Delete(); from.SendMessage("You chop the plant up"); } else { from.SendMessage("You do not own this plant !!!"); } } else { from.SendLocalizedMessage(500446); } }
static void Main(string[] args) { Console.WriteLine("----義大利餐館菜單----"); Spaghetti normalSpaghetti = new NormalSpaghetti(); // 產生平民義大利麵 normalSpaghetti = new Chocolate(normalSpaghetti); // 加點火腿 normalSpaghetti = new Egg(normalSpaghetti); // 加點蛋 normalSpaghetti = new Cheese(normalSpaghetti); // 加點起司 normalSpaghetti = new Bacon(normalSpaghetti); // Console.WriteLine("名稱:{0} 價錢:{1} 材料:{2}", normalSpaghetti.GetName(), normalSpaghetti.GetPrice(), normalSpaghetti.GetDescription()); Spaghetti spaghettiBolognese = new SpaghettiBolognese(); // 產生茄汁肉醬義大利麵 spaghettiBolognese = new Strawberry(spaghettiBolognese); spaghettiBolognese = new Banana(spaghettiBolognese); spaghettiBolognese = new Sugar(spaghettiBolognese); Console.WriteLine("名稱:{0} 價錢:{1} 材料:{2}", spaghettiBolognese.GetName(), spaghettiBolognese.GetPrice(), spaghettiBolognese.GetDescription()); Console.ReadLine(); }
private void onStrawberryCollected(On.Celeste.Strawberry.orig_OnPlayer orig, Strawberry self, Player player) { if (!Settings.AllStrawberriesAreGoldens) { orig(self, player); return; } // if the strawberry is actually collected by the player, vanilla code switches ReturnHomeWhenLost to true. // so, we'll use that to spare us some reflection or IL modding. bool origReturnHome = self.ReturnHomeWhenLost; self.ReturnHomeWhenLost = false; orig(self, player); bool wasCollected = self.ReturnHomeWhenLost; self.ReturnHomeWhenLost = origReturnHome; if (wasCollected) { // store the inventory to restore it if needed. new DynData <Strawberry>(self)["playerInventoryOnCollection"] = player.Inventory; } }
private static PlayerDeadBody PlayerDie(On.Celeste.Player.orig_Die orig, Player self, Vector2 direction, bool evenIfInvincible, bool registerDeathInStats) { Session session = (self.Scene as Level).Session; PlayerDeadBody playerDeadBody = orig(self, direction, evenIfInvincible, registerDeathInStats); if (playerDeadBody != null) { Strawberry goldenStrawb = null; foreach (Follower follower in self.Leader.Followers) { if (follower.Entity is Strawberry && (follower.Entity as Strawberry).Golden && !(follower.Entity as Strawberry).Winged) { goldenStrawb = (follower.Entity as Strawberry); } } Vector2?specialBoxLevel = (FactoryHelperModule.Instance._Session as FactoryHelperSession).SpecialBoxPosition; if (goldenStrawb == null && specialBoxLevel != null) { playerDeadBody.DeathAction = delegate { Engine.Scene = new LevelExit(LevelExit.Mode.Restart, session); }; } } return(playerDeadBody); }
private void InicializeFruits() { Fruit apple = new Apple(2, 3, GraphicsFruit); Fruit banana = new Banana(6, 8, GraphicsFruit); Fruit brezel = new Brezel(15, 6, GraphicsFruit); Fruit cherry = new Cherry(19, 2, GraphicsFruit); Fruit peach = new Peach(13, 4, GraphicsFruit); Fruit pear = new Pear(11, 12, GraphicsFruit); Fruit strawberry = new Strawberry(4, 10, GraphicsFruit); fruits = new List <Fruit> { apple, banana, brezel, cherry, peach, pear, strawberry }; foreach (var fruit in fruits) { string[] placeAvailable = AvailableFruitXY().Split(); int placeFruitX = int.Parse(placeAvailable[0]); int placeFruitY = int.Parse(placeAvailable[1]); fruit.FruitPositionX = placeFruitX; fruit.FruitPositionY = placeFruitY; } fruits.RemoveAll(x => x.FruitPositionX >= Global.XMax || x.FruitPositionY >= Global.YMax); }
private static void StrawberryOnAdded(On.Celeste.Strawberry.orig_Added orig, Strawberry self, Scene scene) { orig(self, scene); if (self.Golden && !StateManager.Instance.SavedByTas && scene.GetExtendedBoolean(StartFromSaveSate)) { TryRecolorSprite(self); } }
private static bool strawberryPulseEffectOnSeeds; // allows to pass the setting indirectly to the NonPoppingStrawberrySeed constructor public static Entity Load(Level level, LevelData levelData, Vector2 offset, EntityData entityData) { ReplaceSeeds = true; strawberryPulseEffectOnSeeds = entityData.Bool("pulseEffectOnSeeds", defaultValue: true); Entity strawberry = new Strawberry(entityData, offset, new EntityID(levelData.Name, entityData.ID)); ReplaceSeeds = false; return(strawberry); }
void Update() { if (m_Strawberry == null && currentTime > genTime) { m_Strawberry = Instantiate(strawberry, GetComponent <Transform>().position + new Vector3(Random.Range(-0.8f, 0.8f), -0.1f, 0f), Quaternion.identity).GetComponent <Strawberry>(); currentTime = 0f; } if (m_Strawberry == null) { currentTime += Time.deltaTime; } }
public void test() { //依赖倒置 创建型设计模式 不同场景 //1.简单抽象 利用一个工厂类,具体创建 //2.工厂方法 利用抽象工厂类,抽象创建方法,创建单一实例 //3.抽象工厂 利用抽象工厂类,多个抽象方法,创建一组实例 Orchard wuhanOrchard = new Wuhan_Orchard(); Strawberry strawberry = wuhanOrchard.CreateApple(); WaterMelon waterMelon = wuhanOrchard.CreateWatermelon(); strawberry.plant(); waterMelon.plant(); }
private PlayerDeadBody onPlayerDie(On.Celeste.Player.orig_Die orig, Player self, Vector2 direction, bool evenIfInvincible, bool registerDeathInStats) { if (!Settings.AllStrawberriesAreGoldens) { return(orig(self, direction, evenIfInvincible, registerDeathInStats)); } // get the first following strawberry before it is detached by the orig method Strawberry firstStrawberry = null; foreach (Follower follower in self.Leader.Followers) { if (follower.Entity is Strawberry) { firstStrawberry = (follower.Entity as Strawberry); break; } } Level level = self.SceneAs <Level>(); // call the orig method PlayerDeadBody deadBody = orig(self, direction, evenIfInvincible, registerDeathInStats); if (deadBody != null && !deadBody.HasGolden && firstStrawberry != null) { // the player is dead, doesn't have the actual golden but has a strawberry. // we have to do magic to make the game believe they had the golden. // (actually, we just do what vanilla does, but with a regular berry instead.) deadBody.HasGolden = true; deadBody.DeathAction = () => { LevelExit exit = new LevelExit(LevelExit.Mode.GoldenBerryRestart, level.Session) { GoldenStrawberryEntryLevel = firstStrawberry.ID.Level }; // if the berry saved the player's inventory on collection, pass it over to the scene. DynData <Strawberry> firstStrawberryData = new DynData <Strawberry>(firstStrawberry); if (firstStrawberryData.Data.ContainsKey("playerInventoryOnCollection")) { new DynData <LevelExit>(exit)["playerInventoryToRestore"] = firstStrawberryData.Get <PlayerInventory>("playerInventoryOnCollection"); } Engine.Scene = exit; }; } // proceed return(deadBody); }
private static void TryRecolorSprite(Strawberry berry) { if (berry.GetFieldValue("sprite") is not Sprite sprite) { return; } string spriteId = berry.GetType().FullName switch { "Celeste.Mod.CollabUtils2.Entities.SpeedBerry" => "speedrun_tool_speedberry", "Celeste.Mod.CollabUtils2.Entities.SilverBerry" => "speedrun_tool_silverberry", _ => "speedrun_tool_goldberry" }; mySpriteBank.CreateOn(sprite, spriteId); }
private static void CmdGiveBerry() { Level level = Engine.Scene as Level; if (level != null) { Player entity = level.Tracker.GetEntity <Player>(); if (entity != null) { EntityData entityData = new EntityData(); entityData.Position = entity.Position + new Vector2(0f, -16f); entityData.ID = Calc.Random.Next(); entityData.Name = "strawberry"; EntityID gid = new EntityID(level.Session.Level, entityData.ID); Strawberry entity2 = new Strawberry(entityData, Vector2.Zero, gid); level.Add(entity2); } } }
public IceCream IceCreamFactory(IceCreamTypes iceCreamTypes) { IceCream iceCream = null; switch (iceCreamTypes) { case IceCreamTypes.Strawberry: iceCream = new Strawberry(); break; case IceCreamTypes.Chocolate: iceCream = new Chocolate(); break; case IceCreamTypes.Vanilla: iceCream = new Vanilla(); break; } return(iceCream); }
/// <summary> /// 加载场景内预制 /// </summary> private void LoadPrefab() { //加载场景 GameObject scene = IOUtil.LoadGameObject("Map/Prefab/" + SceneConfig.prefab); scene.transform.rotation = Quaternion.identity; scene.transform.position = Vector3.zero; //加载玩家 GameObject go = IOUtil.LoadGameObject("Sprites/Prefab/player"); go.transform.parent = scene.transform.FindChild("Start"); go.transform.rotation = Quaternion.identity; go.transform.localPosition = Vector3.zero; _player = go.GetComponent <Player>(); //加载草莓 go = IOUtil.LoadGameObject("Sprites/Prefab/strawberry");; go.transform.parent = scene.transform.FindChild("End"); go.transform.rotation = Quaternion.identity; go.transform.localPosition = Vector3.zero; _strawberry = go.GetComponent <Strawberry>(); //加载机关 _hurts.Clear(); foreach (var item in SceneConfig.hurt) { HurtConfigModel hurtConf = GameManager.GetHurtConfById(item.id); go = IOUtil.LoadGameObject("Sprites/Prefab/" + hurtConf.prefab); go.transform.parent = scene.transform.FindChild("Hurt"); go.transform.localEulerAngles = new Vector3(0, 0, item.rotation); go.transform.localPosition = new Vector3(item.x, item.y, 0);; KHurt hurt = go.GetComponentInChildren <KHurt>(); hurt.Properties = item.value.Count == 0 ? hurtConf.value : item.value; if (hurt != null) { _hurts.Add(hurt); } } }
/// <summary> /// 加载场景内预制 /// </summary> private void LoadPrefab() { //加载场景 GameObject scene = IOUtil.LoadGameObject("Map/Prefab/" + SceneConfig.prefab); scene.transform.rotation = Quaternion.identity; scene.transform.position = Vector3.zero; //加载玩家 GameObject go = IOUtil.LoadGameObject("Sprites/Prefab/player"); go.transform.parent = scene.transform.FindChild("Start"); go.transform.rotation = Quaternion.identity; go.transform.localPosition = Vector3.zero; _player = go.GetComponent<Player>(); //加载草莓 go = IOUtil.LoadGameObject("Sprites/Prefab/strawberry"); ; go.transform.parent = scene.transform.FindChild("End"); go.transform.rotation = Quaternion.identity; go.transform.localPosition = Vector3.zero; _strawberry = go.GetComponent<Strawberry>(); //加载机关 _hurts.Clear(); foreach (var item in SceneConfig.hurt) { HurtConfigModel hurtConf = GameManager.GetHurtConfById(item.id); go = IOUtil.LoadGameObject("Sprites/Prefab/" + hurtConf.prefab); go.transform.parent = scene.transform.FindChild("Hurt"); go.transform.localEulerAngles = new Vector3(0, 0, item.rotation); go.transform.localPosition = new Vector3(item.x, item.y, 0); ; KHurt hurt = go.GetComponentInChildren<KHurt>(); hurt.Properties = item.value.Count == 0 ? hurtConf.value : item.value; if (hurt != null) { _hurts.Add(hurt); } } }
static void Main(string[] args) { var snacker = new Snacker(); var banana = new Banana(); var apple = new Apple(); var strawberry = new Strawberry(); Console.WriteLine("Snacking on an apple..."); apple.Accept(snacker); Console.WriteLine("Snacking on a banana..."); banana.Accept(snacker); Console.WriteLine("Snacking on a strawberry..."); strawberry.Accept(snacker); Console.ReadLine(); }
private void btn_Strawberry_Click(object sender, RoutedEventArgs e) { Strawberry strwb = new Strawberry(); strwb.Show(); }
public NonPoppingStrawberrySeed(Strawberry strawberry, Vector2 position, int index, bool ghost) : base(strawberry, position, index, ghost) { pulseEffect = strawberryPulseEffectOnSeeds; }
#pragma warning restore CS0414 // assigned but never used public patch_StrawberrySeed(Strawberry strawberry, Vector2 position, int index, bool ghost) : base(strawberry, position, index, ghost) { // this constructor will be ignored }
public CassetteFriendlyStrawberrySeed(Strawberry strawberry, Vector2 position, int index, bool ghost) : base(strawberry, position, index, ghost) { }
private void OverlayEntities(MapElement entities, Bitmap map, VirtualMap <char> solids, bool background) { CassetteBlock.Blocks.Clear(); using (Graphics g = Graphics.FromImage(map)) { List <Entity> ents = new List <Entity>(); for (int i = entities.Children.Count - 1; i >= 0; i--) { MapElement child = entities.Children[i]; Entity entity = null; if (child.Name.IndexOf("spikes", StringComparison.OrdinalIgnoreCase) == 0) { entity = background ? Spikes.FromElement(child) : null; } else if (child.Name.IndexOf("triggerSpikes", StringComparison.OrdinalIgnoreCase) == 0) { entity = background ? TriggerSpikes.FromElement(child) : null; } else if (child.Name.IndexOf("strawberry", StringComparison.OrdinalIgnoreCase) == 0) { entity = background ? Strawberry.FromElement(child) : null; } else if (child.Name.Equals("goldenBerry", StringComparison.OrdinalIgnoreCase)) { entity = background ? Strawberry.FromElement(child) : null; } else if (child.Name.Equals("redBlocks", StringComparison.OrdinalIgnoreCase)) { entity = background ? ClutterBlock.FromElement(child) : null; } else if (child.Name.Equals("greenBlocks", StringComparison.OrdinalIgnoreCase)) { entity = background ? ClutterBlock.FromElement(child) : null; } else if (child.Name.Equals("yellowBlocks", StringComparison.OrdinalIgnoreCase)) { entity = background ? ClutterBlock.FromElement(child) : null; } else if (child.Name.Equals("clutterCabinet", StringComparison.OrdinalIgnoreCase)) { entity = background ? ClutterCabinet.FromElement(child) : null; } else if (child.Name.Equals("introCar", StringComparison.OrdinalIgnoreCase)) { entity = background ? IntroCar.FromElement(child) : null; } else if (child.Name.Equals("clothesLine", StringComparison.OrdinalIgnoreCase)) { entity = background ? ClothesLine.FromElement(child) : null; } else if (child.Name.Equals("colorSwitch", StringComparison.OrdinalIgnoreCase)) { entity = background ? ColorSwitch.FromElement(child) : null; } else if (child.Name.Equals("memorialTextController", StringComparison.OrdinalIgnoreCase)) { entity = background ? Strawberry.FromElement(child) : null; } else if (child.Name.Equals("bonfire", StringComparison.OrdinalIgnoreCase)) { entity = background ? Bonfire.FromElement(child) : null; } else if (child.Name.Equals("trapDoor", StringComparison.OrdinalIgnoreCase)) { entity = background ? TrapDoor.FromElement(child) : null; } else if (child.Name.Equals("movingPlatform", StringComparison.OrdinalIgnoreCase)) { entity = background ? MovingPlatform.FromElement(child) : null; } else if (child.Name.Equals("sinkingPlatform", StringComparison.OrdinalIgnoreCase)) { entity = background ? SinkingPlatform.FromElement(child) : null; } else if (child.Name.Equals("clutterDoor", StringComparison.OrdinalIgnoreCase)) { entity = background ? ClutterDoor.FromElement(child) : null; } else if (child.Name.Equals("bridge", StringComparison.OrdinalIgnoreCase)) { entity = background ? Bridge.FromElement(child) : null; } else if (child.Name.Equals("bridgeFixed", StringComparison.OrdinalIgnoreCase)) { entity = background ? BridgeFixed.FromElement(child) : null; } else if (child.Name.Equals("jumpThru", StringComparison.OrdinalIgnoreCase)) { entity = background ? JumpThru.FromElement(child) : null; } else if (child.Name.Equals("door", StringComparison.OrdinalIgnoreCase)) { entity = background ? Door.FromElement(child) : null; } else if (child.Name.Equals("blockField", StringComparison.OrdinalIgnoreCase)) { entity = background ? BlockField.FromElement(child) : null; } else if (child.Name.Equals("lamp", StringComparison.OrdinalIgnoreCase)) { entity = background ? Lamp.FromElement(child) : null; } else if (child.Name.Equals("hahaha", StringComparison.OrdinalIgnoreCase)) { entity = background ? Haha.FromElement(child) : null; } else if (child.Name.Equals("waterFall", StringComparison.OrdinalIgnoreCase)) { entity = background ? WaterFall.FromElement(child) : null; } else if (child.Name.Equals("water", StringComparison.OrdinalIgnoreCase)) { entity = background ? Water.FromElement(child) : null; } else if (child.Name.Equals("key", StringComparison.OrdinalIgnoreCase)) { entity = background ? Key.FromElement(child) : null; } else if (child.Name.Equals("resortLantern", StringComparison.OrdinalIgnoreCase)) { entity = background ? ResortLantern.FromElement(child) : null; } else if (child.Name.Equals("bird", StringComparison.OrdinalIgnoreCase)) { entity = background ? Bird.FromElement(child) : null; } else if (child.Name.Equals("memorial", StringComparison.OrdinalIgnoreCase)) { entity = background ? Memorial.FromElement(child) : null; } else if (child.Name.Equals("player", StringComparison.OrdinalIgnoreCase)) { entity = background ? PlayerSpawn.FromElement(child) : null; } else if (child.Name.Equals("zipMover", StringComparison.OrdinalIgnoreCase)) { entity = background ? ZipMover.FromElement(child) : null; } else if (child.Name.Equals("wire", StringComparison.OrdinalIgnoreCase)) { entity = background ? Wire.FromElement(child) : null; } else if (child.Name.Equals("crumbleBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? CrumbleBlock.FromElement(child) : null; } else if (child.Name.Equals("refill", StringComparison.OrdinalIgnoreCase)) { entity = background ? Refill.FromElement(child) : null; } else if (child.Name.Equals("spring", StringComparison.OrdinalIgnoreCase)) { entity = background ? Spring.FromElement(child) : null; } else if (child.Name.Equals("fakeWall", StringComparison.OrdinalIgnoreCase)) { entity = background ? FakeWall.FromElement(child) : null; } else if (child.Name.Equals("exitBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? FakeWall.FromElement(child) : null; } else if (child.Name.Equals("lightBeam", StringComparison.OrdinalIgnoreCase)) { entity = background ? LightBeam.FromElement(child) : null; } else if (child.Name.Equals("cobweb", StringComparison.OrdinalIgnoreCase)) { entity = background ? Cobweb.FromElement(child) : null; } else if (child.Name.Equals("cassette", StringComparison.OrdinalIgnoreCase)) { entity = background ? Cassette.FromElement(child) : null; } else if (child.Name.Equals("flutterBird", StringComparison.OrdinalIgnoreCase)) { entity = background ? FlutterBird.FromElement(child) : null; } else if (child.Name.Equals("checkpoint", StringComparison.OrdinalIgnoreCase)) { entity = background ? Checkpoint.FromElement(child) : null; } else if (child.Name.Equals("fallingBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? FallingBlock.FromElement(child) : null; } else if (child.Name.Equals("introCrusher", StringComparison.OrdinalIgnoreCase)) { entity = background ? FallingBlock.FromElement(child) : null; } else if (child.Name.Equals("cassetteBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? CassetteBlock.FromElement(child) : null; } else if (child.Name.Equals("dashBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? DashBlock.FromElement(child) : null; } else if (child.Name.Equals("coverupWall", StringComparison.OrdinalIgnoreCase)) { entity = background ? CoverupWall.FromElement(child) : null; } else if (child.Name.Equals("npc", StringComparison.OrdinalIgnoreCase)) { entity = background ? NPC.FromElement(child) : null; } else if (child.Name.Equals("birdForsakenCityGem", StringComparison.OrdinalIgnoreCase)) { entity = background ? ForsakenCityGem.FromElement(child) : null; } else if (child.Name.Equals("soundSource", StringComparison.OrdinalIgnoreCase)) { entity = background ? SoundSource.FromElement(child) : null; } else if (child.Name.Equals("friendlyGhost", StringComparison.OrdinalIgnoreCase)) { entity = background ? FriendlyGhost.FromElement(child) : null; } else if (child.Name.Equals("floatingDebris", StringComparison.OrdinalIgnoreCase)) { entity = background ? FloatingDebris.FromElement(child) : null; } else if (child.Name.Equals("hangingLamp", StringComparison.OrdinalIgnoreCase)) { entity = background ? HangingLamp.FromElement(child) : null; } else if (child.Name.Equals("lockBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? LockBlock.FromElement(child) : null; } else if (child.Name.Equals("heartGem", StringComparison.OrdinalIgnoreCase)) { entity = background ? HeartGem.FromElement(child) : null; } else if (child.Name.Equals("blackGem", StringComparison.OrdinalIgnoreCase)) { entity = background ? HeartGem.FromElement(child) : null; } else if (child.Name.Equals("dreamMirror", StringComparison.OrdinalIgnoreCase)) { entity = background ? DreamMirror.FromElement(child) : null; } else if (child.Name.Equals("darkChaser", StringComparison.OrdinalIgnoreCase)) { entity = background ? DarkChaser.FromElement(child) : null; } else if (child.Name.Equals("dreamBlock", StringComparison.OrdinalIgnoreCase)) { entity = background ? DreamBlock.FromElement(child) : null; } else if (child.Name.Equals("touchSwitch", StringComparison.OrdinalIgnoreCase)) { entity = background ? TouchSwitch.FromElement(child) : null; } else if (child.Name.Equals("switchGate", StringComparison.OrdinalIgnoreCase)) { entity = background ? SwitchGate.FromElement(child) : null; } else if (child.Name.Equals("invisibleBarrier", StringComparison.OrdinalIgnoreCase)) { entity = background ? InvisibleBarrier.FromElement(child) : null; } else if (child.Name.Equals("payphone", StringComparison.OrdinalIgnoreCase)) { entity = background ? Payphone.FromElement(child) : null; } else if (child.Name.Equals("spinner", StringComparison.OrdinalIgnoreCase)) { entity = background ? Spinner.FromElement(child) : null; } else if (child.Name.Equals("rotateSpinner", StringComparison.OrdinalIgnoreCase)) { entity = background ? RotateSpinner.FromElement(child) : null; } else if (child.Name.Equals("trackSpinner", StringComparison.OrdinalIgnoreCase)) { entity = background ? TrackSpinner.FromElement(child) : null; } else if (child.Name.Equals("towerViewer", StringComparison.OrdinalIgnoreCase)) { entity = background ? TowerViewer.FromElement(child) : null; } else if (child.Name.Equals("foregroundDebris", StringComparison.OrdinalIgnoreCase)) { entity = !background?ForegroundDebris.FromElement(child) : null; } else if (background) { Console.WriteLine(child.Name); } if (entity != null) { ents.Add(entity); } } ents.Sort(delegate(Entity one, Entity two) { int comp = two.Depth.CompareTo(one.Depth); return(comp == 0 ? one.ID.CompareTo(two.ID) : comp); }); for (int i = 0; i < ents.Count; i++) { Entity entity = ents[i]; entity.Render(g, solids); } } }
private static void onStrawberryUpdate(On.Celeste.Strawberry.orig_Update orig, Strawberry self) { if (!(self is SecretBerry berry)) { // this is a regular berry: it should behave normally. orig(self); return; } // back up vanilla particles ParticleType origGlow = P_Glow; ParticleType origGhostGlow = P_GhostGlow; // replace them P_Glow = berry.strawberryParticleType; P_GhostGlow = berry.strawberryGhostParticleType; // run vanilla code (that may emit particles) orig(self); // place the vanilla particles back P_Glow = origGlow; P_GhostGlow = origGhostGlow; }
private IEnumerator Strawberry_CollectRoutine(On.Celeste.Strawberry.orig_CollectRoutine orig, Strawberry self, int collectIndex) { IEnumerator output = orig(self, collectIndex); while (output.MoveNext()) { yield return(null); } if (Object.ReferenceEquals(self, this)) { this.Scene.Add(new CustomPoints(this.Position, this.isGhostBerry, pointsText, this.Moon)); this.RemoveSelf(); } yield break; }
public override void OnDoubleClick(Mobile from) { if (m_sower == null || m_sower.Deleted) { m_sower = from; } if (from.Mounted && !CropHelper.CanWorkMounted) { from.SendMessage("You cannot harvest a crop while mounted."); return; } if (DateTime.Now > lastpicked.AddSeconds(3)) // 3 seconds between picking { lastpicked = DateTime.Now; int tailorValue = (int)from.Skills[SkillName.Tailoring].Value / 20; if (tailorValue == 0) { from.SendMessage("You have no idea how to harvest this crop."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); if (PlayerCanDestroy && !(m_sower.AccessLevel > AccessLevel.Counselor)) { UpRootGump g = new UpRootGump(from, this); from.SendGump(g); } } else //check skill and sower { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0); if (from == m_sower) { tailorValue *= 2; m_lastvisit = DateTime.Now; } if (tailorValue > m_yield) { tailorValue = m_yield + 1; } int pick = Utility.Random(tailorValue); if (pick == 0) { from.SendMessage("You do not manage to harvest any crops."); return; } m_yield -= pick; from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s")); //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); ((Item)this).ItemID = pickedGraphic; Strawberry crop = new Strawberry(pick); from.AddToBackpack(crop); if (SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !(m_sower.AccessLevel > AccessLevel.Counselor)) { this.UpRoot(from); return; } if (!regrowTimer.Running) { //regrowTimer = new CropTimer( this ); regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
private static IEnumerator onStrawberryCollectRoutine(On.Celeste.Strawberry.orig_CollectRoutine orig, Strawberry self, int collectIndex) { Scene scene = self.Scene; IEnumerator origEnum = orig(self, collectIndex); while (origEnum.MoveNext()) { yield return(origEnum.Current); } if (self is RainbowBerry) { // remove the strawberry points StrawberryPoints points = scene.Entities.ToAdd.OfType <StrawberryPoints>().First(); Vector2 position = points.Position; scene.Entities.ToAdd.Remove(points); // spawn a perfect effect instead scene.Add(new RainbowBerryPerfectEffect(position)); } }
private static IEnumerator onStrawberryCollect(On.Celeste.Strawberry.orig_CollectRoutine orig, Strawberry self, int collectIndex) { Scene scene = self.Scene; yield return(new SwapImmediately(orig(self, collectIndex))); if (self is SecretBerry berry) { // reskin the strawberry points. StrawberryPoints points = scene.Entities.ToAdd.OfType <StrawberryPoints>().First(); GFX.SpriteBank.CreateOn(points.Get <Sprite>(), berry.strawberrySprite); } }
private static void onStrawberryConstructor(On.Celeste.Strawberry.orig_ctor orig, Strawberry self, EntityData data, Vector2 offset, EntityID gid) { orig(self, data, offset, gid); // save the value for SpringCollab2020_ignoreLighting to the DynData for the strawberry. new DynData <Strawberry>(self)["SpringCollab2020_ignoreLighting"] = data.Bool("SpringCollab2020_ignoreLighting"); }
// Start is called before the first frame update void Start() { chest.SetActive(true); manager = FindObjectOfType <LevelManager>(); berry = FindObjectOfType <Strawberry>(); }
private void PatchCollectBerry(On.Celeste.Strawberry.orig_OnPlayer orig, Strawberry self, Player player) { PerformAutoBubble(self); orig(self, player); }