public Game(Player[] players, CardTypeFactory cardTypeFactory, EffectFactory effectFactory) { if (players is null) { throw new ArgumentNullException("players"); } if (players.Length <= 0) { throw new ArgumentException("Player array must not be empty!", "players"); } if (cardTypeFactory is null) { throw new ArgumentNullException("cardTypeFactory"); } if (effectFactory is null) { throw new ArgumentNullException("effectFactory"); } // Initialize this.registry = new Registry(); this.players = new List <Player>(); // Handle parameters foreach (var player in players) { this.players.Add(player); } effectFactory.Initialize(this, registry); cardTypeFactory.Initialize(registry); }
public ImGuiRenderer(Game game, EffectFactory effectFactory) { var context = ImGui.CreateContext(); ImGui.SetCurrentContext(context); this.Game = game; this.Effect = effectFactory.Construct <UIEffect>(); this.GraphicsDevice = game.GraphicsDevice; this.LoadedTextures = new Dictionary <IntPtr, TextureReference>(); this.RasterizerState = new RasterizerState() { CullMode = CullMode.None, DepthBias = 0, FillMode = FillMode.Solid, MultiSampleAntiAlias = false, ScissorTestEnable = true, SlopeScaleDepthBias = 0 }; this.TextureContrast = 1.0f; this.SetupInput(); this.RebuildFontAtlas(); }
public static Skill getAnatomy() { if (anatomy == null) { anatomy = new Skill(); anatomy.name = "Anatomy"; anatomy.icon = Resources.Load <Sprite>("SpellIcons/fade"); anatomy.description = "Buffs allies that increases damage and healing for 4 turns"; anatomy.targetType = Skill.TargetType.ALLY; anatomy.range = 3; anatomy.aoe = 0; anatomy.manaCost = user => 3; anatomy.OnTarget = (user, target, args) => { target.AddEffect(EffectFactory.getAnatomyEffect(), 3); }; anatomy.GenerateTasks = (user, tile, args) => { GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch")); GameManager.instance.tasks.Add(new Task_Wait(0.3f)); GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Fog1"))); GameManager.instance.tasks.Add(new Task_Fire_Projectile(user.transform.position + Vector3.up, tile.transform.position + Vector3.up, (GameObject)Resources.Load("SpellVisuals/MEDIC/ANATOMY/anatomy projectile prefab"), 3)); anatomy.EnqueueExecuteTask(user, tile, args); }; } return(anatomy); }
public DirectionalLightSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DirectionalLight> lights) { this.Device = device; this.Effect = effectFactory.Construct <DirectionalLightEffect>(); this.Lights = lights; this.FullScreenTriangle = new FullScreenTriangle(); }
private void OnDead() { if (IsDead) { return; } IsDead = true; //音效 Sound.PlayUiAudioOneShot(Deploy.deadSound); //特效 EffectFactory.PlayEffectOnce(Deploy.deadEffect, transform.position); //播放shader特效 StageCamera2D.Instance.PlayDeadEffect(transform.position); //销毁僚机 SupportMgr.Clear(); //销毁自己 Destroy(gameObject); //发事件 GameEventCenter.Send(GameEvent.OnPlayerDead); //销毁子弹 BulletExplosion.Create(transform.position, 0.3f); }
public static Skill GetFade() { if (fade == null) { fade = new Skill(); fade.name = "Fade"; fade.icon = Resources.Load <Sprite>("SpellVisuals/ASSASSIN/FADE/fade"); fade.description = "For next 3 turns, any damage delt to you is avoided"; fade.basePower = 0; fade.manaCost = user => 1; fade.aoe = 0; fade.range = 0; fade.cooldown = 6; fade.damageType = Skill.DamageType.HEAL; fade.targetType = Skill.TargetType.SELF; fade.OnTarget = (user, target, args) => { //bool flag = user.talentTags.Contains("Fade Upgrade"); target.AddEffect(EffectFactory.getInvincibleEffect(), 3); //target.AddEffect(EffectFactory.getSmokeEffect(),3); }; fade.GenerateTasks = (user, tile, args) => { GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Twine"))); GameManager.instance.tasks.Add(new Task_ShowParticleAnimation((GameObject)Resources.Load("SpellVisuals/Fade"), user.transform.position, 1)); fade.EnqueueExecuteTask(user, tile, args); }; } return(fade); }
public void SetCard(Card info) { card = info; EffectFactory factory = new EffectFactory(); effects = factory.GetEffects(info.cardEffectName); }
protected virtual void Update() { if (!_destroyOnNotalive && !_hasFinishedNotify) { return; } if (Time.time - _lastCheckTime < 1f) { return; } _lastCheckTime = Time.time; if (!IsAlive()) { if (_hasFinishedNotify) { _playFinishNotify(this); _playFinishNotify = null; _hasFinishedNotify = false; } if (_destroyOnNotalive) { EffectFactory.DestroyEffect(this); } } }
public static Skill getStickyGrenade() { if (stickyGrenade == null) { stickyGrenade = new Skill(); stickyGrenade.name = "Sticky\nGrenade"; stickyGrenade.icon = Resources.Load <Sprite>("SpellVisuals/TECH/GRENADE/sticky"); stickyGrenade.description = "Give your enemy a live retro grenade so he can show his friends!"; stickyGrenade.cooldown = 3; stickyGrenade.manaCost = user => 4; stickyGrenade.range = 3; stickyGrenade.targetType = Skill.TargetType.ENEMY; stickyGrenade.OnTarget = (user, target, args) => { target.AddEffect(EffectFactory.getStickyGrenadeEffect(), 2); }; stickyGrenade.GenerateTasks = (user, tile, args) => { GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch")); GameManager.instance.tasks.Add(new Task_Wait(0.3f)); GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Earth6"))); GameManager.instance.tasks.Add(new Task_Fire_Projectile(user.transform.position + Vector3.up, tile.transform.position + Vector3.up, (GameObject)Resources.Load("SpellVisuals/TECH/GRENADE/german grenade projectile prefab"), 3)); stickyGrenade.EnqueueExecuteTask(user, tile, args); }; } return(stickyGrenade); }
public static Skill getAcidBlade() { if (acidBlade == null) { acidBlade = new Skill(); acidBlade.name = "Acid\nBlade"; acidBlade.icon = Resources.Load <Sprite>("SpellVisuals/ASSASSIN/ACID BLADE/acid blade"); acidBlade.description = "Weaker than Shiv but corrodes your enemy's armor!"; acidBlade.basePower = 3; acidBlade.aoe = 0; acidBlade.range = 1; acidBlade.manaCost = user => 0; acidBlade.cooldown = 3; acidBlade.damageType = Skill.DamageType.DAMAGE; acidBlade.targetType = Skill.TargetType.ENEMY; acidBlade.OnTarget = (user, target, args) => { float amt = user.DamageMultiplier * acidBlade.basePower; target.TakeDamage(amt, user); target.AddEffect(EffectFactory.GetWeakenDefenseEffect(), 3); }; acidBlade.GenerateTasks = (user, tile, args) => { List <Unit> list = acidBlade.gatherTargets(user, tile); GameManager.instance.tasks.Add(new Task_Face_Eachother(user, tile.unit)); GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch")); GameManager.instance.tasks.Add(new Task_Wait(0.3f)); GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Sward4"))); GameManager.instance.tasks.Add(new Task_ShowParticleAnimation((GameObject)Resources.Load("SpellVisuals/ASSASSIN/shiv/shiv prefab"), tile.transform.position, 1)); GameManager.instance.tasks.Add(new Task_Trigger_Animation(tile.unit, "Hit")); acidBlade.EnqueueExecuteTask(user, tile, args); }; } return(acidBlade); }
public PointLightSystem(GraphicsDevice device, EffectFactory effectFactory, LightPrimitiveLoader lightPrimitiveLoader, IComponentContainer <PointLight> lights) { this.Device = device; this.Effect = effectFactory.Construct <PointLightEffect>(); this.Sphere = lightPrimitiveLoader.UnitSphere(); this.Lights = lights; }
/// <summary/> public TestObjects(Variation v) { this.variation = v; this.viewport = null; this.visual = null; this.content = null; string ctb = v["ClipToBounds"]; string o = v["Opacity"]; string om = v["OpacityMask"]; string c = v["Clip"]; string t = v["Transform"]; string e = v["Effect"]; string ei = v["EffectInput"]; string em = v["EdgeMode"]; clipToBounds = (ctb == null) ? false : StringConverter.ToBool(ctb); clip = (c == null) ? null : GeometryFactory.MakeGeometry(c); opacity = (o == null) ? 1.0 : StringConverter.ToDouble(o); opacityMask = (om == null) ? null : BrushFactory.MakeBrush(om); transform = (t == null) ? null : Transform2DFactory.MakeTransform2D(t); effect = (e == null) ? null : EffectFactory.MakeEffect(e); effectInput = (ei == null) ? null : EffectInputFactory.MakeEffectInput(ei); edgeMode = (em == null) ? EdgeMode.Unspecified : (EdgeMode)Enum.Parse(typeof(EdgeMode), em); // Don't do DPI scaling here. Avalon needs unscaled input. // We will do the scale in the verification code. MathEx.RelativeToAbsolute(opacityMask, new Rect(0, 0, v.WindowWidth, v.WindowHeight)); // Can't scale effectInput here because we don't know the rendered bounds yet. }
public void PopulateActions() { for (int i = 0; i < 4; i++) { int randomEntry = Random.Range(0, actionsDatabase.actionData.Count); for (int x = 0; x < actions.Count; x++) { //Debug.Log(actions[x].actionNameText.text + " " + actionsDatabase.actionData[randomEntry].actionName); while (actions[x].actionNameText.text == actionsDatabase.actionData[randomEntry].actionName) { //Debug.Log("messed up here"); randomEntry = Random.Range(0, actionsDatabase.actionData.Count); x = 0; } } Debug.Log("actions " + i + "is" + actionsDatabase.actionData[randomEntry].actionName); GameObject newEntry = Instantiate(actionEntryTemplate.gameObject) as GameObject; newEntry.transform.SetParent(actionEntryHolder, false); newEntry.GetComponent <Image>().sprite = spriteButtons[i]; newEntry.SetActive(true); ActionEntry entryScript = newEntry.GetComponent <ActionEntry>(); GameEffect testEfect = EffectFactory.CreateGameEffect(actionsDatabase.actionData[randomEntry].testSimpleEffect, actionsDatabase.actionData[randomEntry].delay); entryScript.Initialize(actionsDatabase.actionData[randomEntry], testEfect, this); actions.Add(entryScript); } }
public static Skill GetTaunt() { if (taunt == null) { taunt = new Skill(); taunt.name = "Taunt"; taunt.icon = Resources.Load <Sprite>("SpellIcons/taunt"); taunt.description = "Tell a 'Yo Momma' joke so vulgar, the entire gang puts only you in their sights"; taunt.basePower = 0; taunt.aoe = 0; taunt.range = 0; taunt.manaCost = user => 2; taunt.cooldown = 2; taunt.damageType = Skill.DamageType.CONDITIONAL; taunt.targetType = Skill.TargetType.NONE; taunt.OnTarget = (user, target, args) => { user.AddEffect(EffectFactory.getTauntEffect(), 4); }; taunt.GenerateTasks = (user, tile, args) => { //TODO: MAKE ANIMATION LAST [SET AMOUNT] TURNS! GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Devil1"))); GameManager.instance.tasks.Add(new Task_ShowParticleAnimation((GameObject)Resources.Load("SpellVisuals/TANK/TAUNT/taunt prefab"), user.transform.position, 1)); taunt.EnqueueExecuteTask(user, tile, args); }; } return(taunt); }
public static Skill GetWeakenDefense() { if (weakenDefense == null) { weakenDefense = new Skill(); weakenDefense.name = "Weaken\nDefense"; weakenDefense.icon = Resources.Load <Sprite>("SpellIcons/weakenDefense"); weakenDefense.description = "Weakens the armor of your target"; weakenDefense.basePower = 2; weakenDefense.manaCost = user => 1; weakenDefense.aoe = 3; weakenDefense.range = 4; weakenDefense.cooldown = 0; weakenDefense.damageType = Skill.DamageType.DAMAGE; weakenDefense.targetType = Skill.TargetType.ENEMY; weakenDefense.OnTarget = (user, target, args) => { target.AddEffect(EffectFactory.GetWeakenDefenseEffect(), -1); }; weakenDefense.GenerateTasks = (user, tile, args) => { foreach (Unit target in weakenDefense.gatherTargets(user, tile)) { GameManager.instance.tasks.Add(new Task_Face_Eachother(user, target)); GameManager.instance.tasks.Add(new Task_Trigger_Animation(user, "Punch")); GameManager.instance.tasks.Add(new Task_Wait(0.3f)); GameManager.instance.tasks.Add(new Task_Fire_Projectile(user.transform.position + Vector3.up, target.tile.transform.position + Vector3.up, (GameObject)Resources.Load("SpellVisuals/TANK/tank projectile prefab"), 3)); GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Damage2"))); GameManager.instance.tasks.Add(new Task_ShowParticleAnimation((GameObject)Resources.Load("SpellVisuals/TANK/WEAKEN DEFENSE/WeakenDefense prefab"), target.transform.position, 1)); GameManager.instance.tasks.Add(new Task_Trigger_Animation(target, "Hit")); } weakenDefense.EnqueueExecuteTask(user, tile, args); }; } return(weakenDefense); }
public static Skill GetSlam() { if (slam == null) { slam = new Skill(); slam.name = "Slam"; slam.icon = Resources.Load <Sprite>("SpellIcons/slam"); slam.description = "Creates a shattering quake that damages all nearby enemies"; slam.basePower = 4; slam.manaCost = user => 2; slam.aoe = 1; slam.range = 0; slam.cooldown = 2; slam.damageType = Skill.DamageType.DAMAGE; slam.targetType = Skill.TargetType.ENEMY; slam.OnTarget = (user, target, args) => { bool flag = user.talentTags.Contains("Slam Upgrade"); float amt = user.DamageMultiplier * slam.basePower * (1f - target.Armor); target.TakeDamage(amt * (flag?2:1), user); target.AddEffect(EffectFactory.getStunEffect(), flag?1:2); }; slam.GenerateTasks = (user, tile, args) => { GameManager.instance.tasks.Add(new Task_PlaySound(Resources.Load <AudioClip>("SE/Thunder5"))); GameManager.instance.tasks.Add(new Task_ShowParticleAnimation((GameObject)Resources.Load("SpellVisuals/TANK/SLAM/SlamPrefab"), user.transform.position, 4)); foreach (Unit target in slam.gatherTargets(user, tile)) { GameManager.instance.tasks.Add(new Task_Trigger_Animation(target, "Hit")); } slam.EnqueueExecuteTask(user, tile, args); }; } return(slam); }
public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> debugInfos, IList <IComponentContainer> containers, IconLibrary library) : base(debugInfos, containers) { this.Device = device; this.Effect = effectFactory.Construct <TextureEffect>(); this.Library = library; this.Quad = new UnitQuad(device); }
public static EffectFactory GetInstance() { if (Instance == null) { Instance = new EffectFactory(); } return(Instance); }
public DeferredRenderPipeline( GraphicsDevice device, ShadowMapSystem shadowMapSystem, ModelSystem modelSystem, AveragedParticleSystem particleSystem, AdditiveParticleSystem additiveParticleSystem, ProjectorSystem projectorSystem, EffectFactory effectFactory, AmbientLightSystem ambientLightSystem, DirectionalLightSystem directionalLightSystem, PointLightSystem pointLightSystem, CascadedShadowMapSystem cascadedShadowMapSystem, ShadowCastingLightSystem shadowCastingLightSystem, SunlightSystem sunlightSystem, BoundarySystem boundarySystem, DynamicTextureSystem dynamicTextureSystem, IconSystem iconSystem, CutsceneSystem cutsceneSystem, IMeterRegistry meterRegistry) { this.ShadowMapSystem = shadowMapSystem; this.ModelSystem = modelSystem; this.TransparentParticleSystem = particleSystem; this.AdditiveParticleSystem = additiveParticleSystem; this.ProjectorSystem = projectorSystem; this.CombineEffect = effectFactory.Construct <CombineEffect>(); this.FxaaEffect = effectFactory.Construct <FxaaEffect>(); this.AmbientLightSystem = ambientLightSystem; this.DirectionalLightSystem = directionalLightSystem; this.PointLightSystem = pointLightSystem; this.CascadedShadowMapSystem = cascadedShadowMapSystem; this.ShadowCastingLightSystem = shadowCastingLightSystem; this.SunlightSystem = sunlightSystem; this.BoundarySystem = boundarySystem; this.DynamicTextureSystem = dynamicTextureSystem; this.CutsceneSystem = cutsceneSystem; this.IconSystem = iconSystem; var width = device.PresentationParameters.BackBufferWidth; var height = device.PresentationParameters.BackBufferHeight; this.GBuffer = new GBuffer(device, width, height); this.Input = new RenderPipelineInput(); this.Settings = new RenderPipelineSettings(); this.ShadowPipeline = ShadowPipeline.Create(device, meterRegistry); this.LightingPipeline = LightingPipeline.Create(device, meterRegistry); this.ModelPipeline = ModelPipeline.Create(device, meterRegistry); this.ParticlePipeline = ParticlePipeline.Create(device, meterRegistry); this.ProjectorPipeline = ProjectorPipeline.Create(device, meterRegistry); this.Pipeline = RenderPipeline.Create(device, meterRegistry); this.RootPass = new Pass(PassType.Opaque, 0); this.Recreate(); }
public BoundarySystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> components, IComponentContainer <Bounds> bounds) { this.Device = device; this.Components = components; this.Bounds = bounds; this.Effect = effectFactory.Construct <ColorEffect>(); this.Bound = new BoundsDrawer3D(device); this.Quad = new BoundsDrawer2D(device); }
public BoundarySystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> debugInfos, IList <IComponentContainer> containers) : base(debugInfos, containers) { this.Device = device; this.Effect = effectFactory.Construct <ColorEffect>(); this.Bounds = new BoundsDrawer3D(device); this.Quad = new BoundsDrawer2D(device); }
public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> components, IComponentContainer <Pose> poses, IconLibrary library) { this.Device = device; this.Components = components; this.Poses = poses; this.Effect = effectFactory.Construct <TextureEffect>(); this.Library = library; this.Quad = new UnitQuad(device); }
public void DecreaseO2() { currentO2 -= 1f; if (currentO2 <= 0) { active = false; EffectFactory.KillPlayer(); } }
private void CreateRecoveryMethods() { int count = abilityData.recoveryData.Count; for (int i = 0; i < count; i++) { AbilityRecovery newRevovrey = EffectFactory.CreateRecovery(this, abilityData.recoveryData[i]); RecoveryManager.AddRecoveryMethod(newRevovrey); } }
private void CreateEffects() { int count = abilityData.effectData.Count; for (int i = 0; i < count; i++) { Effect newEffect = EffectFactory.CreateEffect(this, abilityData.effectData[i]); EffectManager.AddEffect(newEffect); } }
public LineSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugLine> components) { this.Device = device; this.Components = components; this.Effect = effectFactory.Construct <ColorEffect>(); this.vertices = new VertexPosition[0]; this.indices = new short[0]; }
public SunlightSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <Sunlight> Lights, CascadedShadowMapFactory cascadedShadowMapFactory) { this.Device = device; this.Effect = effectFactory.Construct <SunlightEffect>(); this.Lights = Lights; this.FullScreenTriangle = new FullScreenTriangle(); this.Frustum = new Frustum(); }
public ImageProcessorRenderer(Size previewSize) { m_taskQueueLock = new object(); m_requestedPreviewSize = previewSize; // Begin initializing all the imageprocessors... m_createImageProcessorsTask = EffectFactory.CreateEffects(); m_lastQueuedTask = InitializeAsync(); }
protected virtual void OnDead() { //特效 EffectFactory.PlayEffectOnce(Deploy.deadEffect, transform.position); Sound.PlayUiAudioOneShot(104); GameEventCenter.Send(GameEvent.OnEnemyDie); Destroy(gameObject); }
public virtual void Trigger(GameObject trappedObject) { trappedObject.GetComponent <HealthController>().SetStunned(true); //Apply ministun to stop object's turn trappedObject.GetComponent <HealthController>().AddEndOfTurnBuff(new StunDebuff(), 0); EffectFactory factory = new EffectFactory(); Effect effect = factory.GetEffect(card.cardEffectName[effectIndex]); effect.Process(this.gameObject, null, trappedObject, card, effectIndex); Destroy(this.gameObject); }