本文整理汇总了C#中OpenRA.Actor类的典型用法代码示例。如果您正苦于以下问题:C# Actor类的具体用法?C# Actor怎么用?C# Actor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Actor类属于OpenRA命名空间,在下文中一共展示了Actor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanPlaceBuilding
public static bool CanPlaceBuilding(this World world, string name, BuildingInfo building, int2 topLeft, Actor toIgnore)
{
var res = world.WorldActor.traits.Get<ResourceLayer>();
return !Footprint.Tiles(name, building, topLeft).Any(
t => !world.Map.IsInMap(t.X, t.Y) || res.GetResource(t) != null || !world.IsCellBuildable(t,
building.WaterBound, toIgnore));
}
示例2: Player
public Player( World world, Session.Client client )
{
World = world;
Shroud = new ShroudRenderer(this, world.Map);
PlayerActor = world.CreateActor("Player", new int2(int.MaxValue, int.MaxValue), this);
if (client != null)
{
Index = client.Index;
Palette = PlayerColors[client.PaletteIndex % PlayerColors.Count()].a;
Color = PlayerColors[client.PaletteIndex % PlayerColors.Count()].c;
PlayerName = client.Name;
InternalName = "Multi{0}".F(client.Index);
}
else
{
Index = -1;
PlayerName = InternalName = "Neutral";
Palette = "neutral";
Color = Color.Gray; // HACK HACK
}
Country = world.GetCountries()
.FirstOrDefault(c => client != null && client.Country == c.Name)
?? world.GetCountries().Random(world.SharedRandom);
}
示例3: Add
public void Add(World w, Actor a)
{
actors.Add(a);
foreach (var sel in a.TraitsImplementing<INotifySelected>())
sel.Selected(a);
foreach (var ns in w.WorldActor.TraitsImplementing<INotifySelection>())
ns.SelectionChanged();
}
示例4: PathSearch
public PathSearch(Actor self)
{
this.self = self;
world = self.World;
cellInfo = InitCellInfo();
mobile = self.Trait<Mobile>();
queue = new PriorityQueue<PathDistance>();
}
示例5: Tick
public override Activity Tick(Actor self)
{
if (move == null || refuelsNear == null)
return NextActivity;
self.SetTargetLine(target, Color.Green);
return ActivityUtils.SequenceActivities(move.MoveWithinRange(target, refuelsNear.Info.Range), NextActivity);
}
示例6: Search
public static PathSearch Search(World world, MobileInfo mi, Actor self, bool checkForBlocked)
{
var search = new PathSearch(world, mi, self)
{
CheckForBlocked = checkForBlocked
};
return search;
}
示例7: Order
public Order(string orderString, Actor subject,
Actor targetActor, int2 targetLocation, string targetString)
{
this.OrderString = orderString;
this.Subject = subject;
this.TargetActor = targetActor;
this.TargetLocation = targetLocation;
this.TargetString = targetString;
}
示例8: FromPoint
public static PathSearch FromPoint( Actor self, int2 from, int2 target, bool checkForBlocked )
{
var search = new PathSearch(self) {
heuristic = DefaultEstimator( target ),
checkForBlocked = checkForBlocked };
search.AddInitialCell( self.World, from );
return search;
}
示例9: Order
Order(string orderString, Actor subject,
Actor targetActor, int2 targetLocation, string targetString, bool queued, int2 extraLocation)
{
this.OrderString = orderString;
this.Subject = subject;
this.TargetActor = targetActor;
this.TargetLocation = targetLocation;
this.TargetString = targetString;
this.Queued = queued;
this.ExtraLocation = extraLocation;
}
示例10: FromPoint
public static PathSearch FromPoint(World world, MobileInfo mi, Actor self, CPos from, CPos target, bool checkForBlocked)
{
var search = new PathSearch(world, mi, self)
{
Heuristic = DefaultEstimator(target),
CheckForBlocked = checkForBlocked
};
search.AddInitialCell(from);
return search;
}
示例11: PathSearch
public PathSearch(World world, MobileInfo mobileInfo, Actor self)
{
this.self = self;
CellInfo = InitCellInfo();
this.mobileInfo = mobileInfo;
this.self = self;
customCost = null;
Queue = new PriorityQueue<PathDistance>();
Considered = new HashSet<CPos>();
MaxCost = 0;
nextDirections = CVec.directions.Select(d => new Pair<CVec, int>(d, 0)).ToArray();
}
示例12: Order
Order(string orderString, Actor subject,
Actor targetActor, CPos targetLocation, string targetString, bool queued, CPos extraLocation, uint extraData)
{
this.OrderString = orderString;
this.Subject = subject;
this.TargetActor = targetActor;
this.TargetLocation = targetLocation;
this.TargetString = targetString;
this.Queued = queued;
this.ExtraLocation = extraLocation;
this.ExtraData = extraData;
}
示例13: Order
Order(string orderString, Actor subject,
Actor targetActor, CPos targetLocation, string targetString, bool queued, CPos extraLocation, uint extraData)
{
OrderString = orderString;
Subject = subject;
TargetActor = targetActor;
TargetLocation = targetLocation;
TargetString = targetString;
Queued = queued;
ExtraLocation = extraLocation;
ExtraData = extraData;
}
示例14: FromPoints
public static PathSearch FromPoints(World world, MobileInfo mi, Actor self, IEnumerable<CPos> froms, CPos target, bool checkForBlocked)
{
var search = new PathSearch(world, mi, self)
{
Heuristic = DefaultEstimator(target),
CheckForBlocked = checkForBlocked
};
foreach (var sl in froms)
search.AddInitialCell(sl);
return search;
}
示例15: DoExplosion
public static void DoExplosion(Actor attacker, string weapontype, int2 location, int altitude)
{
var args = new ProjectileArgs
{
src = location,
dest = location,
srcAltitude = altitude,
destAltitude = altitude,
firedBy = attacker,
target = null,
weapon = Rules.Weapons[ weapontype.ToLowerInvariant() ],
facing = 0
};
DoImpacts(args, location);
}