• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Actors.Actor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InventoryGrid

 public InventoryGrid(Actor owner, int rows, int columns, int slot = 0)
 {
     this._backpack = new uint[rows, columns];
     this._owner = owner;
     this.Items = new Dictionary<uint, Item>();
     this.EquipmentSlot = slot;
 }
开发者ID:wow4all,项目名称:mooege,代码行数:7,代码来源:InventoryGrid.cs


示例2: RunPower

        public bool RunPower(Actor user, PowerScript power, Actor target = null,
                             Vector3D targetPosition = null, TargetMessage targetMessage = null)
        {
            // replace power with existing channel instance if one exists
            if (power is ChanneledSkill)
            {
                var existingChannel = _FindChannelingSkill(user, power.PowerSNO);
                if (existingChannel != null)
                {
                    power = existingChannel;
                }
                else  // new channeled skill, add it to the list
                {
                    _channeledSkills.Add((ChanneledSkill)power);
                }
            }

            // copy in context params
            power.User = user;
            power.Target = target;
            power.World = user.World;
            power.TargetPosition = targetPosition;
            power.TargetMessage = targetMessage;

            _StartScript(power);
            return true;
        }
开发者ID:loonbg,项目名称:mooege,代码行数:27,代码来源:PowerManager.cs


示例3: GenerateRandom

        // generates a random item from given type category.
        // we can also set a difficulty mode parameter here, but it seems current db doesnt have nightmare or hell-mode items with valid snoId's /raist.
        public static Item GenerateRandom(Actor player, ItemType type)
        {
            var validDefinitions = ItemDefinitions[type].Where(definition => definition.SNOId != 0).ToList(); // only find item definitions with snoId!=0 for given itemtype.
            var itemDefinition = GetRandom(validDefinitions);

            return CreateItem(player, itemDefinition);
        }
开发者ID:PsyKo,项目名称:mooege,代码行数:9,代码来源:ItemGenerator.cs


示例4: GetNearestTarget

 // get nearest target of targetType
 public static Actor GetNearestTarget(World world, Actor attacker, Vector3D centerPosition, float range, ActorType targetType = ActorType.Monster)
 {
     Actor result = null;
     List<Actor> actors = world.QuadTree.Query<Actor>(new Circle(centerPosition.X, centerPosition.Y, range));
     if (actors.Count > 1)
     {
         float distanceNearest = range; // max. range
         float distance = 0f;
         foreach (var target in actors.Where(target => ((target.ActorType == targetType) && (target != attacker) && !target.Attributes[GameAttribute.Is_NPC])))
         {
             if ((target.World == null) || (world.GetActorByDynamicId(target.DynamicID) == null))
             {
                 // leaving world
                 continue;
             }
             distance = ActorUtils.GetDistance(centerPosition, target.Position);
             if ((result == null) || (distance < distanceNearest))
             {
                 result = target;
                 distanceNearest = distance;
             }
         }
     }
     return result;
 }
开发者ID:K42,项目名称:mooege,代码行数:26,代码来源:CombatSystem.cs


示例5: PlayAnimation

        public void PlayAnimation(Actor actor, int animationId)
        {
            if (actor == null) return;

            foreach (Mooege.Core.GS.Player.Player player in actor.World.GetPlayersInRange(actor.Position, 150f))
            {
                //Stop actor current animation
                player.InGameClient.SendMessage(new ANNDataMessage(Opcodes.ANNDataMessage13)
                {
                    ActorID = actor.DynamicID
                });

                player.InGameClient.SendMessage(new PlayAnimationMessage()
                {
                    ActorID = actor.DynamicID,
                    Field1 = 0xb,
                    Field2 = 0,
                    tAnim = new PlayAnimationMessageSpec[1]
                    {
                        new PlayAnimationMessageSpec()
                        {
                            Field0 = 0x2,
                            Field1 = animationId,
                            Field2 = 0x0,
                            Field3 = 0.6f
                        }
                    }
                });
            } 
        }
开发者ID:Sasho,项目名称:mooege,代码行数:30,代码来源:PowerEffect.cs


示例6: GetPath

 //This submits a request for a path to the pathfinder thread. This is the main point of entry for usage. - DarkLotus
 public PathRequestTask GetPath(Actor owner, Vector3D vector3D, Vector3D heading)
 {
     if (aipather == null)
         aipather = new Pathfinder();
     var pathRequestTask = new PathRequestTask(aipather, owner, owner.Position, heading);
     _queuedPathTasks.TryAdd(owner.DynamicID, pathRequestTask);
     return pathRequestTask;
 }
开发者ID:vrobel,项目名称:mooege,代码行数:9,代码来源:Pathfinder.cs


示例7: HitPayload

        public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
            : base(attackPayload.Context, target)
        {
            this.IsCriticalHit = criticalHit;
            
            // TODO: select these values based on element type?
            float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
            float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];

            // calculate and add up damage amount for each element type
            this.ElementDamages = new Dictionary<DamageType, float>();

            foreach (var entry in attackPayload.DamageEntries)
            {
                if (!this.ElementDamages.ContainsKey(entry.DamageType))
                    this.ElementDamages[entry.DamageType] = 0f;

                if (entry.IsWeaponBasedDamage)
                    this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier *
                        (weaponMinDamage + (float)PowerContext.Rand.NextDouble() * weaponDamageDelta);
                else
                    this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;

                this.ElementDamages[entry.DamageType] *= 1.0f + this.Target.Attributes[GameAttribute.Amplify_Damage_Percent];
            }

            // apply critical damage boost
            if (criticalHit)
            {
                // TODO: probably will calculate this off of GameAttribute.Crit_Damage_Percent, but right now that attribute is never set
                var damTypes = this.ElementDamages.Keys.ToArray();
                foreach (var type in damTypes)
                    this.ElementDamages[type] *= 1.5f + this.Target.Attributes[GameAttribute.Crit_Percent_Bonus_Capped];
            }



            // TODO: reduce element damage amounts according to target's resistances

            // TODO: reduce total damage by target's armor
            // ~weltmeyer Using WOW Calculation till we find the correct formula :)


            this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value) ;
            var targetArmor = target.Attributes[GameAttribute.Armor_Total];
            var attackerLevel = attackPayload.Context.User.Attributes[GameAttribute.Level];
            var reduction = TotalDamage * (0.1f * targetArmor) /
                               ((8.5f * attackerLevel) + 40);

            reduction /= 1+reduction;
            reduction = Math.Min(0.75f, reduction);
            this.TotalDamage = TotalDamage*(1 - reduction);

            this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
            if (this.DominantDamageType == null)
                this.DominantDamageType = DamageType.Physical; // default to physical if no other damage type calced
        }
开发者ID:loonbg,项目名称:mooege,代码行数:57,代码来源:HitPayload.cs


示例8: ActorExists

 public bool ActorExists(Actor actor)
 {
     return Actors.Any(
         t =>
             t.SnoId == actor.SnoId && 
             t.Position.X == actor.Position.X && 
             t.Position.Y == actor.Position.Y &&
             t.Position.Z == actor.Position.Z);
 }
开发者ID:Rianon,项目名称:mooege,代码行数:9,代码来源:World.cs


示例9: Chase

        public void Chase(Actor actor)
        {
            if (this.Heading == actor.Position)
                return;

            this.Target = actor;
            this.Heading = this.Target.Position;

            this.Move(this.Target);
        }
开发者ID:ncoop23,项目名称:mooege,代码行数:10,代码来源:Brain.cs


示例10: Minion

 public Minion(World world, int snoId, Actor master, TagMap tags)
     : base(world, snoId, tags)
 {
     // The following two seems to be shared with monsters. One wonders why there isn't a specific actortype for minions.
     this.Master = master;
     this.Field2 = 0x8; 
     this.GBHandle.Type = (int)GBHandleType.Monster; this.GBHandle.GBID = 1;
     this.Attributes[GameAttribute.Summoned_By_ACDID] = (int)master.DynamicID;
     this.Attributes[GameAttribute.TeamID] = master.Attributes[GameAttribute.TeamID];
 }
开发者ID:God601,项目名称:mooege,代码行数:10,代码来源:Minion.cs


示例11: BroadcastIfRevealed

 public void BroadcastIfRevealed(GameMessage message, Actor actor)
 {
     foreach (var player in this.Players.Values)
     {
         if (player.RevealedObjects.ContainsKey(actor.DynamicID))
         {
             player.InGameClient.SendMessageNow(message);
         }
     }
 }
开发者ID:bryan77,项目名称:mooege,代码行数:10,代码来源:World.cs


示例12: ShootAtAngle

 // shhots projectile at 2D angle
 public static void ShootAtAngle(World world, Actor projectile, float angle, float speed)
 {
     float[] delta = ActorUtils.GetDistanceDelta(speed, angle);
     world.BroadcastInclusive(new ACDTranslateFixedMessage()
     {
         Id = 113, // needed
         ActorId = unchecked((int)projectile.DynamicID),
         Velocity = new Vector3D { X = delta[0], Y = delta[1], Z = 0 },
         Field2 = 1,
         AnimationTag = 1,//walkAnimationSNO
         Field4 = 1,
     }, projectile);
 }
开发者ID:K42,项目名称:mooege,代码行数:14,代码来源:CombatSystem.cs


示例13: MonsterBrain

        public MonsterBrain(Actor body)
            : base(body)
        {
            this.PresetPowers = new List<int>();

            // build list of powers defined in monster mpq data
            if (body.ActorData.MonsterSNO > 0)
            {
                var monsterData = (Mooege.Common.MPQ.FileFormats.Monster)MPQStorage.Data.Assets[SNOGroup.Monster][body.ActorData.MonsterSNO].Data;
                foreach (var monsterSkill in monsterData.SkillDeclarations)
                {
                    if (monsterSkill.SNOPower > 0)
                        this.PresetPowers.Add(monsterSkill.SNOPower);
                }
            }
        }
开发者ID:rinoa,项目名称:mooege-1,代码行数:16,代码来源:MonsterBrain.cs


示例14: UsePower

        public bool UsePower(Actor user, PowerScript power, Actor target = null,
                             Vector3D targetPosition = null, TargetMessage targetMessage = null)
        {
            // replace power with existing channel instance if one exists
            if (power is ChanneledPower)
            {
                var chanpow = _FindChannelingPower(user, power.PowerSNO);
                if (chanpow != null)
                    power = chanpow;
            }

            // copy in context params
            power.User = user;
            power.Target = target;
            power.World = user.World;
            power.TargetPosition = targetPosition;
            power.TargetMessage = targetMessage;

            // process channeled power events
            var channeledPower = power as ChanneledPower;
            if (channeledPower != null)
            {
                if (channeledPower.ChannelOpen)
                {
                    channeledPower.OnChannelUpdated();
                }
                else
                {
                    channeledPower.OnChannelOpen();
                    channeledPower.ChannelOpen = true;
                    _channeledPowers.Add(channeledPower);
                }
            }

            var powerEnum = power.Run().GetEnumerator();
            // actual power will first run here, if it yielded a timer process it in the waiting list
            if (powerEnum.MoveNext() && powerEnum.Current != PowerScript.StopExecution)
            {
                _waitingPowers.Add(new WaitingPower
                {
                    PowerEnumerator = powerEnum,
                    Implementation = power
                });
            }

            return true;
        }
开发者ID:n3rus,项目名称:mooege,代码行数:47,代码来源:PowerManager.cs


示例15: PlayEffectGroupActorToActor

        public void PlayEffectGroupActorToActor(int effectId, Actor from, Actor target)
        {
            if (target == null) return;

            foreach (Mooege.Core.GS.Player.Player player in from.World.GetPlayersInRange(from.Position, 150f))
            {
                player.InGameClient.SendMessage(new EffectGroupACDToACDMessage()
                {
                    Id = 0xaa,
                    effectSNO = effectId,
                    fromActorID = from.DynamicID,
                    toActorID = target.DynamicID
                });

                SendDWordTick(player.InGameClient);
            }
        }
开发者ID:Sasho,项目名称:mooege,代码行数:17,代码来源:PowerEffect.cs


示例16: PlayHitEffect

        public void PlayHitEffect(HitEffect id, Actor target, Actor from)
        {
            if (target == null) return;

            foreach (Mooege.Core.GS.Player.Player player in target.World.GetPlayersInRange(target.Position, 150f))
            {
                player.InGameClient.SendMessage(new PlayHitEffectMessage()
                {
                    Id = 0x7b,
                    ActorID = target.DynamicID,
                    HitDealer = from.DynamicID,
                    Field2 = (int)id,
                    Field3 = false
                });

                SendDWordTick(player.InGameClient);
            }
        }
开发者ID:Sasho,项目名称:mooege,代码行数:18,代码来源:PowerEffect.cs


示例17: MonsterBrain

        public MonsterBrain(Actor body)
            : base(body)
        {
            this.PresetPowers = new List<int>();

            // build list of powers defined in monster mpq data
            if (body.ActorData.MonsterSNO > 0)
            {
                var monsterData = (Mooege.Common.MPQ.FileFormats.Monster)MPQStorage.Data.Assets[SNOGroup.Monster][body.ActorData.MonsterSNO].Data;
                _mpqPowerCount = monsterData.SkillDeclarations.Count(e => e.SNOPower != -1);
                foreach (var monsterSkill in monsterData.SkillDeclarations)
                {
                    if (Powers.PowerLoader.HasImplementationForPowerSNO(monsterSkill.SNOPower))
                    {
                        this.PresetPowers.Add(monsterSkill.SNOPower);
                    }
                }
            }
        }
开发者ID:loonbg,项目名称:mooege,代码行数:19,代码来源:MonsterBrain.cs


示例18: HitPayload

        public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
        {
            this.Context = attackPayload.Context;
            this.Target = target;
            this.IsCriticalHit = criticalHit;
            
            // TODO: select these values based on element type?
            float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
            float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];

            // calculate and add up damage amount for each element type
            this.ElementDamages = new Dictionary<DamageType, float>();

            foreach (var entry in attackPayload.DamageEntries)
            {
                if (!this.ElementDamages.ContainsKey(entry.DamageType))
                    this.ElementDamages[entry.DamageType] = 0f;

                if (entry.IsWeaponBasedDamage)
                    this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier *
                        (weaponMinDamage + (float)PowerContext.Rand.NextDouble() * weaponDamageDelta);
                else
                    this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;
            }

            // apply critical damage boost
            if (criticalHit)
            {
                // TODO: probably will calculate this off of GameAttribute.Crit_Damage_Percent, but right now that attribute is never set
                var damTypes = this.ElementDamages.Keys.ToArray();
                foreach (var type in damTypes)
                    this.ElementDamages[type] *= 1.0f + 0.25f;
            }

            // TODO: reduce element damage amounts according to target's resistances

            // TODO: reduce total damage by target's armor

            this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value);
            this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
        }
开发者ID:n3rus,项目名称:mooege,代码行数:41,代码来源:HitPayload.cs


示例19: HirelingBrain

 protected HirelingBrain(Actor body) : base(body)
 { }
开发者ID:wow4all,项目名称:mooege,代码行数:2,代码来源:HirelingBrain.cs


示例20: DeathPayload

 public DeathPayload(PowerContext context, DamageType deathDamageType, Actor target)
 {
     this.Context = context;
     this.DeathDamageType = deathDamageType;
     this.Target = target;
 }
开发者ID:n3rus,项目名称:mooege,代码行数:6,代码来源:DeathPayload.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Math.Vector3D类代码示例发布时间:2022-05-26
下一篇:
C# FileFormats.ItemTypeTable类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap