public void castSpell(GameObject target) { if(target.GetComponent("Enchantable") == null) { TraceLogger.LogKVtime("attempt", getSpellName()); TraceLogger.LogKV("target", target.GetInstanceID().ToString()+", "+target.name+", "+target.transform.position); TraceLogger.LogKV("player", ""+ObjectManager.FindById("Me").transform.position); (GameObject.Find("Popup").GetComponent("Popup") as Popup).popup("Target ("+target.name+") immune to magic."); SetHidden(false); return; } TraceLogger.LogKVtime("spell", getSpellName()); ProgramLogger.LogKVtime("spell", getSpellName()); TraceLogger.LogKV("target", target.GetInstanceID().ToString()+", "+target.name+", "+target.transform.position); TraceLogger.LogKV("player", ""+ObjectManager.FindById("Me").transform.position); June june = new June(target, file_name); SetHidden(false); item_name = "Blank"; file_name = ""; animate = false; inventoryTexture = Resources.Load( "Textures/Scroll") as Texture2D; (target.GetComponent("Enchantable") as Enchantable).enchant(june, delegate(GameObject t){absorbSpell(t); }); }
public void castSpell(GameObject target) { if (target.GetComponent("Enchantable") == null) { TraceLogger.LogKVtime("attempt", getSpellName()); TraceLogger.LogKV("target", target.GetInstanceID().ToString() + ", " + target.name + ", " + target.transform.position); TraceLogger.LogKV("player", "" + ObjectManager.FindById("Me").transform.position); (GameObject.Find("Popup").GetComponent("Popup") as Popup).popup("Target (" + target.name + ") immune to magic."); SetHidden(false); return; } TraceLogger.LogKVtime("spell", getSpellName()); ProgramLogger.LogKVtime("spell", getSpellName()); TraceLogger.LogKV("target", target.GetInstanceID().ToString() + ", " + target.name + ", " + target.transform.position); TraceLogger.LogKV("player", "" + ObjectManager.FindById("Me").transform.position); June june = new June(target, file_name); SetHidden(false); item_name = "Blank"; file_name = ""; animate = false; inventoryTexture = Resources.Load("Textures/Scroll") as Texture2D; (target.GetComponent("Enchantable") as Enchantable).enchant(june, delegate(GameObject t){ absorbSpell(t); }); }
public void enchant(June june, EnchantmentFinishedCallback callback) { this.june = june; this.callback = callback; this.junes.Push(june); this.enchantmentsRunning.Push(true); this.callbacks.Push(callback); StartCoroutine(enchantAnimation()); }
// This is about the most horrible way to do this, but Stacks don't allow me to remove an arbirtrary element. I mean, seriously? public void disenchant(string name) { Stack tempj = new Stack(); Stack tempe = new Stack(); Stack tempc = new Stack(); June thejune; int count = junes.Count; bool found = false; // Lock the stacks so that no one else modifies them lock (junes.SyncRoot) { lock (enchantmentsRunning.SyncRoot) { lock (callbacks.SyncRoot) { // Find the right june, pushing non-matching ones onto temporary stacks for (int i = 0; i < count; i++) { thejune = (June)junes.Pop(); if (thejune.getFileName().Equals(name)) { june = thejune; enchantmentsRunning.Pop(); is_enchanted = false; callback = (EnchantmentFinishedCallback)callbacks.Pop(); found = true; break; } tempj.Push(thejune); tempe.Push(enchantmentsRunning.Pop()); tempc.Push(callbacks.Pop()); } // Put items on the temporary stacks back in place count = tempj.Count; for (int i = 0; i < count; i++) { junes.Push(tempj.Pop()); enchantmentsRunning.Push(tempe.Pop()); callbacks.Push(tempc.Pop()); } if (found) { // Put the matching june at the top of the stack junes.Push(june); enchantmentsRunning.Push(is_enchanted); callbacks.Push(callback); } } } } if (found) { june.Stop(); } }
// This is about the most horrible way to do this, but Stacks don't allow me to remove an arbirtrary element. I mean, seriously? public void disenchant(string name) { Stack tempj = new Stack(); Stack tempe = new Stack(); Stack tempc = new Stack(); June thejune; int count = junes.Count; bool found = false; // Lock the stacks so that no one else modifies them lock (junes.SyncRoot) { lock (enchantmentsRunning.SyncRoot) { lock (callbacks.SyncRoot) { // Find the right june, pushing non-matching ones onto temporary stacks for (int i=0; i<count; i++) { thejune = (June) junes.Pop(); if (thejune.getFileName().Equals(name)) { june = thejune; enchantmentsRunning.Pop(); is_enchanted = false; callback = (EnchantmentFinishedCallback) callbacks.Pop(); found = true; break; } tempj.Push(thejune); tempe.Push(enchantmentsRunning.Pop()); tempc.Push(callbacks.Pop()); } // Put items on the temporary stacks back in place count = tempj.Count; for (int i=0; i<count; i++) { junes.Push(tempj.Pop()); enchantmentsRunning.Push(tempe.Pop()); callbacks.Push(tempc.Pop()); } if (found) { // Put the matching june at the top of the stack junes.Push(june); enchantmentsRunning.Push(is_enchanted); callbacks.Push(callback); } }}} if (found) june.Stop(); }
public void Can_use_static_months() { DateTime date = January.The(1); Assert.That(date.Month, Is.EqualTo(1)); date = February.The(1); Assert.That(date.Month, Is.EqualTo(2)); date = March.The(1); Assert.That(date.Month, Is.EqualTo(3)); date = April.The(1); Assert.That(date.Month, Is.EqualTo(4)); date = May.The(1); Assert.That(date.Month, Is.EqualTo(5)); date = June.The(1); Assert.That(date.Month, Is.EqualTo(6)); date = July.The(1); Assert.That(date.Month, Is.EqualTo(7)); date = August.The(1); Assert.That(date.Month, Is.EqualTo(8)); date = September.The(1); Assert.That(date.Month, Is.EqualTo(9)); date = October.The(1); Assert.That(date.Month, Is.EqualTo(10)); date = November.The(1); Assert.That(date.Month, Is.EqualTo(11)); date = December.The(1); Assert.That(date.Month, Is.EqualTo(12)); }
public void Can_use_static_months() { DateTime date = January.The(1); date.Month.ShouldBe(1); date = February.The(1); date.Month.ShouldBe(2); date = March.The(1); date.Month.ShouldBe(3); date = April.The(1); date.Month.ShouldBe(4); date = May.The(1); date.Month.ShouldBe(5); date = June.The(1); date.Month.ShouldBe(6); date = July.The(1); date.Month.ShouldBe(7); date = August.The(1); date.Month.ShouldBe(8); date = September.The(1); date.Month.ShouldBe(9); date = October.The(1); date.Month.ShouldBe(10); date = November.The(1); date.Month.ShouldBe(11); date = December.The(1); date.Month.ShouldBe(12); }
void Start() { June june = new June(this.gameObject, java_file_name); june.Start(); }
public string this[int indexer] { get { switch (indexer) { case 0: January jan = new January(); return jan.ToString(); case 1: February f = new February(); return f.ToString(); case 2: March m = new March(); return m.ToString(); case 3: April a = new April(); return a.ToString(); case 4: May may = new May(); return may.ToString(); case 5: June j = new June(); return j.ToString(); case 6: July july = new July(); return july.ToString(); case 7: August august = new August(); return august.ToString(); case 8: September s = new September(); return s.ToString(); case 9: October o = new October(); return o.ToString(); case 10: November n = new November(); return n.ToString(); case 11: December d = new December(); return d.ToString(); default: throw new Exception("No such index"); } } }
public string this[string indexer] { get { switch (indexer) { case "January": January jan= new January(); return jan.ToString(); case "February": February f = new February(); return f.ToString(); case "March": March m = new March(); return m.ToString(); case "April": April a = new April(); return a.ToString(); case "May": May may = new May(); return may.ToString(); case "June": June j = new June(); return j.ToString(); case "July": July july = new July(); return july.ToString(); case "August": August august = new August(); return august.ToString(); case "September": September s = new September(); return s.ToString(); case "October": October o = new October(); return o.ToString(); case "November": November n = new November(); return n.ToString(); case "December": December d = new December(); return d.ToString(); default: throw new Exception("No such index"); } } }
// Update is called once per frame void Update() { if (gameObject.GetComponent <Text3D>() != null) { gameObject.GetComponent <Text3D>().text = id; } //////////////////////////////// // if (june.isStopped()) { // if (!isEnchanted()) { // disenchantAnimation(); // } // if (callback != null) { // callback(gameObject); // if (!isEnchanted()) // callback = null; // if (june.wasSuccessful()) { // if(EnchantmentEnded != null) // EnchantmentEnded(gameObject, june.getFileName()); // } else { // if(EnchantmentFailed != null) // EnchantmentFailed(gameObject, june.getFileName()); // } // } // } //////////////////////////////// if (june != null && !isEnchanted()) { //ProgramLogger.LogKV("enchantments", hasRunningEnchantment()+""); if (!hasRunningEnchantment()) { disenchantAnimation(); } if (callback != null) { callback(gameObject); //if (!hasRunningEnchantment()) // callback = null; if (june.wasSuccessful()) { if (EnchantmentEnded != null) { EnchantmentEnded(gameObject, june.getFileName()); } } else { if (EnchantmentFailed != null) { EnchantmentFailed(gameObject, june.getFileName()); } } } junes.Pop(); enchantmentsRunning.Pop(); callbacks.Pop(); if (junes.Count > 0) { june = (June)junes.Peek(); is_enchanted = (bool)enchantmentsRunning.Peek(); callback = (EnchantmentFinishedCallback)callbacks.Peek(); } else { june = null; is_enchanted = false; callback = null; newEnchantment = true; } } // if(!isEnchanted()) // { // disenchantAnimation(); // // if(callback != null) // { // callback(gameObject); // callback = null; // // if(june.wasSuccessful()) // { // if(EnchantmentEnded != null) // EnchantmentEnded(gameObject, june.getFileName()); // } else { // // if(EnchantmentFailed != null) // { // EnchantmentFailed(gameObject, june.getFileName()); // } // } // } // } }
// Update is called once per frame void Update() { if(gameObject.GetComponent<Text3D>() != null) { gameObject.GetComponent<Text3D>().text = id; } //////////////////////////////// // if (june.isStopped()) { // if (!isEnchanted()) { // disenchantAnimation(); // } // if (callback != null) { // callback(gameObject); // if (!isEnchanted()) // callback = null; // if (june.wasSuccessful()) { // if(EnchantmentEnded != null) // EnchantmentEnded(gameObject, june.getFileName()); // } else { // if(EnchantmentFailed != null) // EnchantmentFailed(gameObject, june.getFileName()); // } // } // } //////////////////////////////// if(june != null && !isEnchanted()) { //ProgramLogger.LogKV("enchantments", hasRunningEnchantment()+""); if (!hasRunningEnchantment()) disenchantAnimation(); if(callback != null) { callback(gameObject); //if (!hasRunningEnchantment()) // callback = null; if(june.wasSuccessful()) { if(EnchantmentEnded != null) EnchantmentEnded(gameObject, june.getFileName()); } else { if(EnchantmentFailed != null) { EnchantmentFailed(gameObject, june.getFileName()); } } } junes.Pop(); enchantmentsRunning.Pop(); callbacks.Pop(); if (junes.Count > 0) { june = (June) junes.Peek(); is_enchanted = (bool) enchantmentsRunning.Peek(); callback = (EnchantmentFinishedCallback) callbacks.Peek(); } else { june = null; is_enchanted = false; callback = null; newEnchantment = true; } } // if(!isEnchanted()) // { // disenchantAnimation(); // // if(callback != null) // { // callback(gameObject); // callback = null; // // if(june.wasSuccessful()) // { // if(EnchantmentEnded != null) // EnchantmentEnded(gameObject, june.getFileName()); // } else { // // if(EnchantmentFailed != null) // { // EnchantmentFailed(gameObject, june.getFileName()); // } // } // } // } }