当前位置: 首页>>代码示例>>C#>>正文


C# Actor类代码示例

本文整理汇总了C#中Actor的典型用法代码示例。如果您正苦于以下问题:C# Actor类的具体用法?C# Actor怎么用?C# Actor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Actor类属于命名空间,在下文中一共展示了Actor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoImpact

        public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
        {
            if (!target.IsValidFor(firedBy))
                return;

            var pos = target.CenterPosition;
            var world = firedBy.World;
            var targetTile = world.Map.CellContaining(pos);
            var isValid = IsValidImpact(pos, firedBy);

            if ((!world.Map.Contains(targetTile)) || (!isValid))
                return;

            var palette = ExplosionPalette;
            if (UsePlayerPalette)
                palette += firedBy.Owner.InternalName;

            var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
            if (Image != null && explosion != null)
                world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette)));

            var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom);
            if (impactSound != null)
                Game.Sound.Play(impactSound, pos);
        }
开发者ID:OpenRA,项目名称:OpenRA,代码行数:25,代码来源:CreateEffectWarhead.cs

示例2: Activate

		public override void Activate(Actor self, Order order, SupportPowerManager manager)
		{
			base.Activate(self, order, manager);

			var wsb = self.TraitOrDefault<WithSpriteBody>();
			if (wsb != null && wsb.DefaultAnimation.HasSequence(info.GrantUpgradeSequence))
				wsb.PlayCustomAnimation(self, info.GrantUpgradeSequence);

			Game.Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation));

			foreach (var a in UnitsInRange(order.TargetLocation))
			{
				var um = a.TraitOrDefault<UpgradeManager>();
				if (um == null)
					continue;

				foreach (var u in info.Upgrades)
				{
					if (info.Duration > 0)
					{
						if (um.AcknowledgesUpgrade(a, u))
							um.GrantTimedUpgrade(a, u, info.Duration);
					}
					else
					{
						if (um.AcceptsUpgrade(a, u))
							um.GrantUpgrade(a, u, this);
					}
				}
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:31,代码来源:GrantUpgradePower.cs

示例3: DrawCostume

        public int DrawCostume(VirtScreen vs, int numStrips, Actor actor, bool drawToBackBuf)
        {
            var pixelsNavigator = new PixelNavigator(vs.Surfaces[drawToBackBuf ? 1 : 0]);
            pixelsNavigator.OffsetX(vs.XStart);

            ActorX += (vs.XStart & 7);
            _w = vs.Width;
            _h = vs.Height;
            pixelsNavigator.OffsetX(-(vs.XStart & 7));
            startNav = new PixelNavigator(pixelsNavigator);

            if (_vm.Game.Version <= 1)
            {
                _xmove = 0;
                _ymove = 0;
            }
            else if (_vm.Game.IsOldBundle)
            {
                _xmove = -72;
                _ymove = -100;
            }
            else
            {
                _xmove = _ymove = 0;
            }

            int result = 0;
            for (int i = 0; i < 16; i++)
                result |= DrawLimb(actor, i);
            return result;
        }
开发者ID:scemino,项目名称:nscumm,代码行数:31,代码来源:BaseCostumeRenderer.cs

示例4: Activate

        public override void Activate(Actor self, Order order)
        {
            // TODO: Reveal submarines

            // Should this play for all players?
            Sound.Play("sonpulse.aud");
        }
开发者ID:Iran,项目名称:ClassicRA,代码行数:7,代码来源:SonarPulsePower.cs

示例5: UnloadCargo

 public UnloadCargo(Actor self, bool unloadAll)
 {
     this.self = self;
     cargo = self.Trait<Cargo>();
     cloak = self.TraitOrDefault<Cloak>();
     this.unloadAll = unloadAll;
 }
开发者ID:Flamewh33l,项目名称:OpenRA,代码行数:7,代码来源:UnloadCargo.cs

示例6: Activate

        public override void Activate(Actor collector)
        {
            var actorsInRange = self.World.FindActorsInCircle(self.CenterPosition, info.Range)
                .Where(a => a != self && a != collector && a.Owner == collector.Owner && AcceptsUpgrade(a));

            if (info.MaxExtraCollectors > -1)
                actorsInRange = actorsInRange.Take(info.MaxExtraCollectors);

            collector.World.AddFrameEndTask(w =>
            {
                foreach (var a in actorsInRange.Append(collector))
                {
                    if (!a.IsInWorld || a.IsDead)
                        continue;

                    var um = a.TraitOrDefault<UpgradeManager>();
                    foreach (var u in info.Upgrades)
                    {
                        if (info.Duration > 0)
                        {
                            if (um.AcknowledgesUpgrade(a, u))
                                um.GrantTimedUpgrade(a, u, info.Duration);
                        }
                        else
                        {
                            if (um.AcceptsUpgrade(a, u))
                                um.GrantUpgrade(a, u, this);
                        }
                    }
                }
            });

            base.Activate(collector);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:34,代码来源:GrantUpgradeCrateAction.cs

示例7: ShroudPalette

 public ShroudPalette(Actor self, ShroudPaletteInfo info)
 {
     // TODO: This shouldn't rely on a base palette
         var wr = self.World.WorldRenderer;
         var pal = wr.GetPalette("terrain");
         wr.AddPalette(info.Name, new Palette(pal, new ShroudPaletteRemap(info.IsFog)));
 }
开发者ID:comradpara,项目名称:OpenRA,代码行数:7,代码来源:ShroudPalette.cs

示例8: FallToEarth

 public FallToEarth(Actor self, FallsToEarthInfo info)
 {
     this.info = info;
     aircraft = self.Trait<Aircraft>();
     if (info.Spins)
         acceleration = self.World.SharedRandom.Next(2) * 2 - 1;
 }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:FallToEarth.cs

示例9: Tick

        public override Activity Tick(Actor self)
        {
            if (self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length <= 0)
            {
                if (info.ExplosionWeapon != null)
                {
                    // Use .FromPos since this actor is killed. Cannot use Target.FromActor
                    info.ExplosionWeapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
                }

                self.Dispose();
                return null;
            }

            if (info.Spins)
            {
                spin += acceleration;
                aircraft.Facing = (aircraft.Facing + spin) % 256;
            }

            var move = info.Moves ? aircraft.FlyStep(aircraft.Facing) : WVec.Zero;
            move -= new WVec(WDist.Zero, WDist.Zero, info.Velocity);
            aircraft.SetPosition(self, aircraft.CenterPosition + move);

            return this;
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:26,代码来源:FallToEarth.cs

示例10: Tick

		public void Tick(Actor self)
		{
			if (!validTileset)
				return;

			t += info.RotationStep;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:RotationPaletteEffect.cs

示例11: Tick

 public IActivity Tick(Actor self)
 {
     var targetAltitude = self.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
     if (isCanceled || !self.World.Map.IsInMap(self.Location)) return NextActivity;
     FlyUtil.Fly(self, targetAltitude);
     return this;
 }
开发者ID:comradpara,项目名称:OpenRA,代码行数:7,代码来源:FlyTimed.cs

示例12: Tick

        public override Activity Tick(Actor self)
        {
            switch (state)
            {
                case State.Wait:
                    return this;
                case State.Turn:
                    state = State.DragIn;
                    return Util.SequenceActivities(new Turn(112), this);
                case State.DragIn:
                    state = State.Dock;
                    return Util.SequenceActivities(new Drag(startDock, endDock, 12), this);
                case State.Dock:
                    ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); state = State.Loop; });
                    state = State.Wait;
                    return this;
                case State.Loop:
                    if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc))
                        state = State.Undock;
                    return this;
                case State.Undock:
                    ru.PlayCustomAnimBackwards(self, "dock", () => state = State.DragOut);
                    state = State.Wait;
                    return this;
                case State.DragOut:
                    return Util.SequenceActivities(new Drag(endDock, startDock, 12), NextActivity);
            }

            throw new InvalidOperationException("Invalid harvester dock state");
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:30,代码来源:HarvesterDockSequence.cs

示例13: ChooseHelipad

 static Actor ChooseHelipad(Actor self)
 {
     var rearmBuildings = self.Info.Traits.Get<HelicopterInfo>().RearmBuildings;
     return self.World.Actors.Where( a => a.Owner == self.Owner ).FirstOrDefault(
         a => rearmBuildings.Contains(a.Info.Name) &&
             !Reservable.IsReserved(a));
 }
开发者ID:Iran,项目名称:ClassicRA,代码行数:7,代码来源:HeliReturn.cs

示例14: SetUp

        public void SetUp()
        {
            Location location = new Location (null, new Point (5, 5));

            actor = new MockActor (location);
            item = new MockItem (location);
        }
开发者ID:manicolosi,项目名称:questar,代码行数:7,代码来源:PickUpActionFixture.cs

示例15: Minelayer

        public Minelayer(Actor self)
        {
            this.self = self;

            var tileset = self.World.Map.Tileset.ToLowerInvariant();
            tile = self.World.Map.Rules.Sequences.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:Minelayer.cs


注:本文中的Actor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。