//-------------------------------------------------------------------------------------------------- ModifierBase Execute(Body body, IShapeOperand[] operands) { InteractiveContext.Current.WorkspaceController.Selection.SelectEntity(null); ModifierBase boolOpShape = null; switch (Operation) { case Operations.Cut: boolOpShape = BooleanCut.Create(body, operands); break; case Operations.Common: boolOpShape = BooleanCommon.Create(body, operands); break; case Operations.Fuse: boolOpShape = BooleanFuse.Create(body, operands); break; } foreach (var operandBody in operands.OfType <BodyShapeOperand>()) { operandBody.Body.IsVisible = false; } return(boolOpShape); }
//-------------------------------------------------------------------------------------------------- void _OnActionFinished(ToolAction toolAction) { var ta = toolAction as SelectEntityAction <Body>; if (ta == null) { return; } ta.Stop(); ModifierBase boolOpShape = null; if (ta.SelectedEntity != null) { boolOpShape = Execute(_SourceBody, new IShapeOperand[] { new BodyShapeOperand(ta.SelectedEntity) }); } Stop(); if (boolOpShape != null) { InteractiveContext.Current.UndoHandler.Commit(); InteractiveContext.Current.WorkspaceController.Selection.SelectEntity(_SourceBody); } WorkspaceController.Invalidate(); }
void setInfos(ObjectInfo infos, ModifierBase modifier) { infos.sprite.sprite = modifier.m_image; List <string> texts = new List <string>(); List <Color> colors = new List <Color>(); if (modifier.life != 0) { texts.Add("A " + modifier.life.ToString()); colors.Add(m_lifeColor); } if (modifier.speed != 0) { texts.Add("B " + modifier.speed.ToString()); colors.Add(m_speedColor); } if (modifier.fireRate != 0) { texts.Add("C " + modifier.fireRate.ToString()); colors.Add(m_fireRateColor); } if (modifier.power != 0) { texts.Add("D " + modifier.power.ToString()); colors.Add(m_powerColor); } if (texts.Count > 0) { infos.line1.setText(texts[0], colors[0]); } else { infos.line1.setText("", Color.white); } if (texts.Count > 1) { infos.line2.setText(texts[1], colors[1]); } else { infos.line2.setText("", Color.white); } if (texts.Count > 2) { infos.line3.setText(texts[2], colors[2]); } else { infos.line3.setText("", Color.white); } }
public void FireWeapon() { ProjectileBase projectileInstance = PhotonNetwork.Instantiate(projectile.name, muzzle.transform.position, muzzle.transform.rotation).GetComponent <ProjectileBase>(); projectileInstance.owner = GetComponent <WeaponBase>(); switch (weaponManager.modifierSelected) { case ModifierBase.EModifier.CLUSTER: projectileInstance.gameObject.AddComponent <ClusterModifier>().m_projectile = projectileInstance; break; case ModifierBase.EModifier.RICOCHET: projectileInstance.gameObject.AddComponent <RicochetModifier>().m_projectile = projectileInstance; break; case ModifierBase.EModifier.THREEWAY: projectileInstance.gameObject.AddComponent <ThreeWayModifier>().m_projectile = projectileInstance; break; case ModifierBase.EModifier.PIERCE: projectileInstance.gameObject.AddComponent <PierceModifier>().m_projectile = projectileInstance; break; } ModifierBase mod = projectileInstance.gameObject.AddComponent <RicochetModifier>(); mod.m_projectile = projectileInstance; switch (weaponType) { case EWeapon.SHOOT: projectileInstance.Fire(fireVelocity, false); break; default: projectileInstance.Fire(fireVelocity, true); break; } Debug.Log("Firing"); }
void onCrush(CrushEvent e) { foreach (var o in m_objects) { Destroy(o.transform.gameObject); } m_objects.Clear(); m_modifier = e.modifier; m_ship = e.ship; setInfos(m_crusher, e.modifier); foreach (var m in e.ship.modifiers) { var obj = Instantiate(m_modifierPrefab); ObjectInfo infos = new ObjectInfo(); infos.transform = obj.transform; infos.sprite = obj.GetComponent <SpriteRenderer>(); infos.line1 = obj.transform.Find("Line1").GetComponent <SpriteTextLogic>(); infos.line2 = obj.transform.Find("Line2").GetComponent <SpriteTextLogic>(); infos.line3 = obj.transform.Find("Line3").GetComponent <SpriteTextLogic>(); setInfos(infos, m); infos.transform.parent = m_objectsBase; infos.transform.localPosition = new Vector3(m_objects.Count * m_itemSpacing - (e.ship.modifiers.Count - 1) * m_itemSpacing / 2, 0, 0); m_objects.Add(infos); } setCruherIndex(m_objects.Count / 2 - 1); m_background.size = new Vector2((m_objects.Count + 1) * m_itemSpacing, m_background.size.y); gameObject.SetActive(true); m_active = true; }
public CrushEvent(ModifierBase _modifier, ShipLogic _ship) { modifier = _modifier; ship = _ship; }
static protected int indexOf(ModifierBase item, List <ModifierBase> modifiers) { return(modifiers.IndexOf(item)); }
public abstract void MultiplyCustomModifiers(GameTime gameTime, ModifierBase modifyMult);
public abstract void AddCustomModifiers(GameTime gameTime, ModifierBase modifyAdd);
public void Init() { // TODO uncomment below to create an instance of ModifierBase instance = new Plastic("newID"); }
public override void MultiplyCustomModifiers(GameTime gameTime, ModifierBase modifyMult) { }
public override void AddCustomModifiers(GameTime gameTime, ModifierBase modifyAdd) { }