public void Start() { EnemyShoot shoot = this.GetComponent <EnemyShoot>(); NonMonoSpellGrid grid = new NonMonoSpellGrid(6, 6); Ink ink = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("FireWeedSap", SpellComponent.SubSpellComponentType.Ink)) as Ink; grid.SetInk(ink); grid.SetPixel(2, 2, true); grid.SetPixel(2, 3, true); grid.SetPixel(3, 2, true); grid.SetPixel(3, 3, true); grid.SetPixel(4, 4, true); grid.SetPixel(3, 4, true); grid.SetPixel(4, 3, true); grid.SetPixel(2, 4, true); grid.SetPixel(4, 2, true); grid.SetPixel(3, 1, true); grid.SetPixel(3, 5, true); grid.SetPixel(1, 3, true); grid.SetPixel(5, 3, true); ProjectileSpellBookBuilder spellBuilder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.enemy); spellBuilder.caster = gameObject; spellBuilder.grid = grid; spellBuilder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Paper", SpellComponent.SubSpellComponentType.Paper)) as SpellPage; spellBuilder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language; spellBuilder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Raging Badger", SpellComponent.SubSpellComponentType.Rune)) as SpellRune); shoot.current_spell = spellBuilder.MakeSpellBook(); shoot.coolDown = spellBuilder.page.GetCoolDown(); }
public void Init(ProjectileSpellBookBuilder builder) { name = builder.name; source = builder.source; caster = builder.caster; if (source == ProjectileSpellBookBuilder.spellSource.player) { spellBuilder = builder; caster = GameObject.FindGameObjectWithTag("Player"); } thrown = builder.GetRune().IsThrown(); MakeTriggerEvent(builder); chaos = builder.page.GetChaos(); coolDown = builder.page.GetCoolDown(); reloadTime = builder.page.GetReloadTime(); loadSize = builder.page.GetCharges(); moveSpeedMod = builder.page.GetMoveSpeed(); layerMaskNames = builder.GetLayers(); CheckOutProj(builder); if ((source == ProjectileSpellBookBuilder.spellSource.player)) { cost = builder.CalculateCost(); setCharges(); } }
public void Open(bool basicSpell, int spellNumber) { gameObject.SetActive(true); basic = basicSpell; number = spellNumber; // Get the old builder to set values on the new book ProjectileSpellBook book = null; if (basicSpell) { book = playerShoot.GetComponent <Shoot>().GetNonBasicSpell(0) as ProjectileSpellBook; } else { book = playerShoot.GetComponent <Shoot>().GetNonBasicSpell(1) as ProjectileSpellBook; } book.ReturnProj(); ProjectileSpellBookBuilder builder = book.spellBuilder; uiStuff.spellGrid.SetGrid(builder.grid.GetGrid()); // Set our builder to the new builder projSpellBookBuilder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.player); // Clear and set the grid //uiStuff.spellGrid.ClearGrid (); projSpellBookBuilder.grid = uiStuff.spellGrid; if (SpellInterfaceOpened != null) { SpellInterfaceOpened(builder, projSpellBookBuilder, uiStuff.spellGrid); } }
void InitType(SpellComponent.SubSpellComponentType type, ProjectileSpellBookBuilder builder) { int i = 0; while (i < layOuts.Count) { if (type == layOuts[i].type) { ChangeLayOut(i); break; } i++; } }
public void InitBook(ProjectileSpellBookBuilder builder, ProjectileSpellBookBuilder newBuilder, SpellGrid spellGrid) { oldBuilder = newBuilder; stats.builder = newBuilder; spellGrid.GridChanged += stats.UpdateStats; SpellComponent.SubSpellComponentType type = SpellComponent.SubSpellComponentType.Rune; InitType(type, builder); int index = playerInventory.ownedComponents[type].FindIndex(delegate(string s) { return(s == builder.GetRune().GetTitle()); }); if (index >= 0) { CompIndexSelected(index); } else { Debug.LogError("Cant find that in the option list " + builder.GetRune().GetTitle()); } type = SpellComponent.SubSpellComponentType.language; InitType(type, builder); index = playerInventory.ownedComponents[type].FindIndex(delegate(string s) { return(s == builder.lang.GetTitle()); }); if (index >= 0) { CompIndexSelected(index); } else { Debug.LogError("Cant find that in the option list " + builder.lang.GetTitle()); } type = SpellComponent.SubSpellComponentType.Paper; InitType(type, builder); index = playerInventory.ownedComponents[type].FindIndex(delegate(string s) { return(s == builder.page.GetTitle()); }); if (index >= 0) { CompIndexSelected(index); } else { Debug.LogError("Cant find that in the option list " + builder.page.GetTitle()); } type = SpellComponent.SubSpellComponentType.Ink; InitType(type, builder); CompIndexSelected(0); ChangeLayOut(layOuts.Count - 1); stats.UpdateStats(); scrollbar.value = 1; }
void MakeTriggerEvent(ProjectileSpellBookBuilder spellBookBuilder) { switch (spellBookBuilder.trigger) { case ProjectileSpellBookBuilder.EventTrigger.None: break; case ProjectileSpellBookBuilder.EventTrigger.Timed: foreach (SpellCreationSegment seg in spellBookBuilder.GetSpellSegs()) { seg.RemoveEvent(); seg.AddEvent(spellBookBuilder.spellEvent); seg.AddEvent(new SpellEnd()); } break; } }
void Awake() { GameObject.Find("Player").GetComponent <CharacterLevel>().LeveledUp += OnPlayerLevelUp; if (spells[0] == null) { NonMonoSpellGrid spellGrid = new NonMonoSpellGrid(4, 4); spellGrid.SetPixel(1, 1, true); spellGrid.SetPixel(1, 2, true); spellGrid.SetPixel(1, 3, true); ProjectileSpellBookBuilder builder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.player); builder.grid = spellGrid; builder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language; builder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Raging Badger", SpellComponent.SubSpellComponentType.Rune)) as SpellRune); builder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Paper", SpellComponent.SubSpellComponentType.Paper)) as SpellPage; spells[0] = builder.MakeSpellBook(); } if (spells[1] == null) { NonMonoSpellGrid spellGrid = new NonMonoSpellGrid(4, 4); spellGrid.SetPixel(1, 1, true); spellGrid.SetPixel(2, 1, true); spellGrid.SetPixel(1, 2, true); spellGrid.SetPixel(2, 2, true); ProjectileSpellBookBuilder builder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.player); builder.grid = spellGrid; builder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language; builder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Bomb", SpellComponent.SubSpellComponentType.Rune)) as SpellRune); builder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Paper", SpellComponent.SubSpellComponentType.Paper)) as SpellPage; spells[1] = builder.MakeSpellBook(); } if (basicSpell == null) { NonMonoSpellGrid spellGrid = new NonMonoSpellGrid(4, 4); spellGrid.SetPixel(2, 2, true); ProjectileSpellBookBuilder builder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.player); builder.grid = spellGrid; builder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language; builder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Basic", SpellComponent.SubSpellComponentType.Rune)) as SpellRune); builder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Paper", SpellComponent.SubSpellComponentType.Paper)) as SpellPage; basicSpell = builder.MakeSpellBook(); } SpellChanged(spells[currentSpell]); }
public SpellBook SpellBookRain(ISpellGrid fgrid) { NonMonoSpellGrid grid = new NonMonoSpellGrid(6, 6); Ink ink = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("FireWeedSap", SpellComponent.SubSpellComponentType.Ink)) as Ink; grid.SetInk(ink); grid.SetPixel(2, 2, true); grid.SetPixel(2, 3, true); grid.SetPixel(2, 4, true); ProjectileSpellBookBuilder spellBuilder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.player); //spellBuilder.caster = ; spellBuilder.grid = grid; spellBuilder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Paper", SpellComponent.SubSpellComponentType.Paper)) as SpellPage; spellBuilder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language; spellBuilder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Raging Badger", SpellComponent.SubSpellComponentType.Rune)) as SpellRune); return(spellBuilder.MakeSpellBook()); }
public void Start() { EnemyShoot shoot = this.GetComponent <EnemyShoot>(); NonMonoSpellGrid grid = new NonMonoSpellGrid(6, 6); Ink ink = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("SootExtract", SpellComponent.SubSpellComponentType.Ink)) as Ink; grid.SetInk(ink); grid.SetPixel(2, 2, true); grid.SetPixel(2, 3, true); grid.SetPixel(3, 2, true); grid.SetPixel(3, 3, true); ProjectileSpellBookBuilder spellBuilder = new ProjectileSpellBookBuilder(ProjectileSpellBookBuilder.spellSource.enemy); spellBuilder.grid = grid; spellBuilder.page = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("Cotton", SpellComponent.SubSpellComponentType.Paper)) as SpellPage; spellBuilder.lang = ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("English", SpellComponent.SubSpellComponentType.language)) as Language; spellBuilder.SetRune(ComponentLoader.GetInstance().LoadComponent(new ComponentLoader.UnLoadedSpellComponent("BullFrog", SpellComponent.SubSpellComponentType.Rune)) as SpellRune); shoot.current_spell = spellBuilder.MakeSpellBook(); shoot.coolDown = spellBuilder.page.GetCoolDown(); Debug.Log("Cooldown " + shoot.coolDown); }
// Check out and init projectiles foreach seg void CheckOutProj(ProjectileSpellBookBuilder builder) { foreach (SpellCreationSegment seg in builder.GetSpellSegs()) { List <GameObject> gameObjs = new List <GameObject>(); for (int i = 0; i < 15; i++) { GameObject projParent = ProjectileParentPool.Take(); if (builder.trigger == ProjectileSpellBookBuilder.EventTrigger.Proximity) { projParent.GetComponent <Trigger>().active = true; projParent.GetComponent <Trigger>().spellEvent = builder.spellEvent; } foreach (SpellPixelFinal spf in seg.GetPixels()) { GameObject projPixel = ProjectilePool.Take(); projPixel.transform.parent = projParent.transform; projPixel.transform.localPosition = Vector2.zero + spf.m_position * .25f; projPixel.transform.rotation = Quaternion.identity; projPixel.GetComponent <SpriteRenderer>().color = spf.m_ink.GetColor(); ProjectileCollision projCollision = projPixel.GetComponent <ProjectileCollision>(); projCollision.caster = caster; projCollision.priority = spf.m_ink.GetPriority(); projCollision.spellCollisionBehaviour = spf.m_ink.GetOnSpellCollisionEffect(); projCollision.damage = spf.damage; projCollision.damageBehaviour = spf.m_ink.GetOnHitEffect(); projCollision.backGroundCollisionBehaviour = builder.lang.GetCollisionBehaviour(); } projParent.GetComponent <ProjectileController>().SetProjectile(seg, this); gameObjs.Add(projParent); projParent.SetActive(false); } openObjs.Add(seg, gameObjs); } }