Actor.traits is implementation detail

This commit is contained in:
Bob
2010-08-14 15:19:30 +12:00
committed by alzeih
parent f6c6255f64
commit ae703d50b2
165 changed files with 586 additions and 561 deletions

View File

@@ -1,19 +1,19 @@
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA
{
{
class DefaultShellmapScriptInfo : TraitInfo<DefaultShellmapScript> { }
class DefaultShellmapScript: ILoadWorldHook, ITick
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.RA
// Sound.PlayMusic("hell226m.aud");
goodguy = w.players.Values.Where(x => x.InternalName == "GoodGuy").FirstOrDefault();
greece = w.players.Values.Where(x => x.InternalName == "Greece").FirstOrDefault();
MapActors = w.WorldActor.traits.Get<SpawnMapActors>().MapActors;
MapActors = w.WorldActor.Trait<SpawnMapActors>().MapActors;
goodguy.Stances[greece] = Stance.Enemy;
@@ -37,18 +37,18 @@ namespace OpenRA.Mods.RA
int ticks = 0;
public void Tick(Actor self)
{
if (ticks == 250)
{
MapActors["pdox"].traits.Get<Chronosphere>().Teleport(MapActors["ca1"], new int2(90, 70));
MapActors["pdox"].traits.Get<Chronosphere>().Teleport(MapActors["ca2"], new int2(92, 71));
{
if (ticks == 250)
{
MapActors["pdox"].Trait<Chronosphere>().Teleport(MapActors["ca1"], new int2(90, 70));
MapActors["pdox"].Trait<Chronosphere>().Teleport(MapActors["ca2"], new int2(92, 71));
}
if (ticks == 100)
MapActors["mslo1"].traits.Get<NukeSilo>().Attack(new int2(96,53));
MapActors["mslo1"].Trait<NukeSilo>().Attack(new int2(96,53));
if (ticks == 110)
MapActors["mslo2"].traits.Get<NukeSilo>().Attack(new int2(92,53));
MapActors["mslo2"].Trait<NukeSilo>().Attack(new int2(92,53));
if (ticks == 120)
MapActors["mslo3"].traits.Get<NukeSilo>().Attack(new int2(94,50));
MapActors["mslo3"].Trait<NukeSilo>().Attack(new int2(94,50));
ticks++;
}