Arbitrary smudge types
This commit is contained in:
@@ -52,9 +52,12 @@ namespace OpenRA
|
||||
|
||||
Sound.Play(GetImpactSound(warhead, isWater));
|
||||
|
||||
if (warhead.SmudgeType != SmudgeType.None)
|
||||
if (warhead.SmudgeType != null)
|
||||
{
|
||||
var smudgeLayer = world.WorldActor.traits.WithInterface<SmudgeLayer>().FirstOrDefault(x => x.Info.Type == warhead.SmudgeType);
|
||||
if (smudgeLayer == null)
|
||||
throw new NotImplementedException("Unknown smudge type `{0}`".F(warhead.SmudgeType));
|
||||
|
||||
if (!isWater)
|
||||
smudgeLayer.AddSmudge(targetTile);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region Copyright & License Information
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.GameRules
|
||||
public readonly bool Wood = false; // can this damage wood?
|
||||
public readonly bool Ore = false; // can this damage ore?
|
||||
public readonly int Explosion = 0; // explosion effect to use
|
||||
public readonly SmudgeType SmudgeType = SmudgeType.None; // type of smudge to apply
|
||||
public readonly string SmudgeType = null; // type of smudge to apply
|
||||
public readonly int[] Size = { 0, 0 }; // size of the explosion. provide 2 values for a ring effect (outer/inner)
|
||||
public readonly int InfDeath = 0; // infantry death animation to use
|
||||
public readonly string ImpactSound = null; // sound to play on impact
|
||||
@@ -54,13 +54,6 @@ namespace OpenRA.GameRules
|
||||
concrete = 4,
|
||||
}
|
||||
|
||||
public enum SmudgeType
|
||||
{
|
||||
None = 0,
|
||||
Crater = 1,
|
||||
Scorch = 2,
|
||||
}
|
||||
|
||||
public enum DamageModel
|
||||
{
|
||||
Normal, // classic RA damage model: point actors, distance-based falloff
|
||||
|
||||
@@ -23,13 +23,12 @@ using System.Linq;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
class SmudgeLayerInfo : ITraitInfo
|
||||
{
|
||||
public readonly SmudgeType Type = SmudgeType.Scorch;
|
||||
public readonly string Type = "Scorch";
|
||||
public readonly string[] Types = {"sc1", "sc2", "sc3", "sc4", "sc5", "sc6"};
|
||||
public readonly int[] Depths = {1,1,1,1,1,1};
|
||||
public object Create(Actor self) { return new SmudgeLayer(self, this); }
|
||||
@@ -39,11 +38,9 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public SmudgeLayerInfo Info;
|
||||
SpriteRenderer spriteRenderer;
|
||||
World world;
|
||||
|
||||
TileReference<byte,byte>[,] tiles;
|
||||
Sprite[][] smudgeSprites;
|
||||
string[] smudgeTypes;
|
||||
World world;
|
||||
|
||||
public SmudgeLayer(Actor self, SmudgeLayerInfo info)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user