當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。