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

C# FOnline.Critter类代码示例

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

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



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

示例1: ChooseAttackPosition

        public UInt16Array ChooseAttackPosition(Critter npc, Critter target, AttackChoice attackChoice)
        {
            var weapon = npc.GetItemById (attackChoice.WeaponId);
            if (weapon == null)
                return null;

            var weaponDistance = weapon.Proto.WeaponMaxDist (attackChoice.WeaponUse);
            var distance = Global.GetDistance (npc, target);

            if (weaponDistance < distance) {
                var direction = Global.GetDirection (npc, target);
                var hexX = npc.HexX;
                var hexY = npc.HexY;

                do {
                    npc.GetMap ().MoveHexByDir (ref hexX, ref hexY, direction, 1);
                } while(!npc.GetMap ().IsHexPassed (hexX, hexY));

                var result = new UInt16Array ();
                result.Add (hexX);
                result.Add (hexY);
                result.Add ((ushort)direction);
                return result;
            }

            return null;
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:27,代码来源:Ranged.cs


示例2: GlobalCritterStealingEventArgs

 public GlobalCritterStealingEventArgs(Critter cr, Critter thief, Item item, int count)
 {
     this.Cr = cr;
     this.Thief = thief;
     this.Item = Item;
     this.Count = Count;
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:7,代码来源:Main.cs


示例3: InitAnimalEvil

        public static void InitAnimalEvil(Critter critter)
        {
            var builder = new CritterBehaviorBuilder (critter);

            builder
                .Do (new CallReinforcements (BlackboardKeys.Attackers))
                .DoSequence ("3% to attack weakest animal from my team - fight over the area")
                    .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10)))
                    .Do (new AtChance<CritterBlackboard> (3))
                    .Do (new FindCritters (Find.Life).Choose (new Weakest ())).If (new SeesCritter ()).If (new IsTeamMember ())
                    .Do (new Attack ())
                .End ()
                .DoSequence ("10% to attack animal of same type from other team")
                    .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10)))
                    .Do (new AtChance<CritterBlackboard> (10))
                    .Do (new FindCritters (Find.Life).Choose (new BT.Random ())).If (new SeesCritter ()).IfNot (new IsTeamMember ())
                    .Do (new Attack ())
                .End ()
                .DoSequence ("Attack every non member and not same type critter")
                    .Do (new FindCritters (Find.Life)).IfNot (new AmAttacking ()).If (new SeesCritter ()).If (new IsTeamMember ()).IfNot (new IsSameType ())
                    .Do (new Attack ())
                .End ()
                .Do (new ProvideReinforcements ()).IfNot (new AmAttacking ());

            Global.RegisterBehaviorTask (builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:26,代码来源:EncounterRoles.cs


示例4: RaiseAttack

 // called by engine
 bool RaiseAttack(Critter cr, Critter target)
 {
     if (Attack != null)
     {
         var e = new ItemAttackEventArgs(this, cr, target);
         Attack(this, e);
         return e.Prevent;
     }
     return false;
 }
开发者ID:rotators,项目名称:fomono,代码行数:11,代码来源:Item.Events.cs


示例5: RaiseUse

 // called by engine
 public bool RaiseUse(Critter cr, Critter on_critter, Item on_item, IntPtr on_scenery)
 {
     if (Use != null)
     {
         var e = new ItemUseEventArgs(this, cr, on_critter, on_item, Scenery.FromNative(on_scenery));
         Use(this, e);
         return e.Prevent;
     }
     return false;
 }
开发者ID:rotators,项目名称:fomono,代码行数:11,代码来源:Item.Events.cs


示例6: InitGyro

        public static void InitGyro(Critter npc)
        {
            var builder = new CritterBehaviorBuilder(npc);

            builder
                .DoSequence("I am attacked")
                    .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers))
            //TODO: maybe run to guard
                .End();

            Global.RegisterBehaviorTask(builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:12,代码来源:JunkyardRoles.cs


示例7: InitAnimalGood

        public static void InitAnimalGood(Critter critter)
        {
            var builder = new CritterBehaviorBuilder (critter);

            builder
                .Do (new CallReinforcements (BlackboardKeys.Attackers))
                .Do (new ProvideReinforcements ()).IfNot (new AmAttacking ())
                .DoSequence ("Move randomly every 10-20 seconds")
                    .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10), Time.RealSecond (20)))
                    .Do (new MoveRandomly (1, 5))
                .End ();

            Global.RegisterBehaviorTask (builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:14,代码来源:EncounterRoles.cs


示例8: ChooseNextTarget

        public Critter ChooseNextTarget(Critter npc, Critter currentTarget)
        {
            var enemyStack = new UIntArray ();
            npc.GetEnemyStack (enemyStack);

            for (int i = 0; i < enemyStack.Length; i++) {
                if (enemyStack [i] != 0) {
                    var target = npc.GetMap ().GetCritter (enemyStack [i]);
                    if (target != null)
                        return target;
                }
            }

            return null;
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:15,代码来源:Ranged.cs


示例9: AddAttackPlane

 public static bool AddAttackPlane(this Critter npc, uint priority, Critter target, int minHp)
 {
     NpcPlane plane=Global.CreatePlane();
     plane.Type=PlaneType.Attack;
     plane.Priority=(priority==0?Priorities.Attack:priority);
     plane.Attack_TargId=target.Id;
     plane.Attack_MinHp=minHp;
     plane.Attack_IsGag=false;
     plane.Attack_GagHexX=0;
     plane.Attack_GagHexY=0;
     plane.Attack_LastHexY=target.HexY;
     plane.Attack_LastHexX=target.HexX;
     plane.Run=false;
     return npc.AddPlane(plane);
 }
开发者ID:rotators,项目名称:fomono,代码行数:15,代码来源:NpcPlanes.cs


示例10: InitGuard

        /**
         * Init methods for use in Mono
         */
        public static void InitGuard(Critter npc)
        {
            var builder = new CritterBehaviorBuilder(npc);

            builder
                .DoSequence()
                    .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers))
                    .Do(new BT.Say(FOnline.Say.NormOnHead, TextMsg.Text, 70140))
                    .Do(new Attack(BlackboardKeys.Attackers))
                .End()
                .DoSelection()
                    .Do(new ProvideReinforcements())
                .End();

            Global.RegisterBehaviorTask(builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:19,代码来源:Vault112Roles.cs


示例11: InitGuard

        /**
         * Init methods for use in Mono
         */
        public static void InitGuard(Critter npc)
        {
            var builder = new CritterBehaviorBuilder(npc);

            builder
                .DoSequence()
                    .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers))
                    .Do(new Attack(BlackboardKeys.Attackers))
                .End()
                .DoSelection()
                    .Do(new ProvideReinforcements())
                .End()
                .DoSequence()
                    .Do(new Patrol(Entire.Patrol))
                    .Do(new LookAround(3, Time.RealSecond(15)))
                .End();

            Global.RegisterBehaviorTask(builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:22,代码来源:JunkyardRoles.cs


示例12: InitCritter1

        public static void InitCritter1(Critter npc)
        {
            var builder = new CritterBehaviorBuilder(npc);

            builder
                .Do(new TakeDrug(ItemPack.HealingDrugs).If(new IsHurt(70)))
                .DoSequence("Attack and call reinforcements")
                    .Do(new CallReinforcements(BlackboardKeys.Attackers, BlackboardKeys.SeenAttackers, BlackboardKeys.Killers))
                    .Do(new CallReinforcements(VirtualRealityReinforcements, BlackboardKeys.Attackers, BlackboardKeys.Killers))
                    .Do(new Attack(BlackboardKeys.Attackers))
                .End()
                .Do(new ProvideReinforcements()).IfNot(new AmAttacking())
                .Do(new ProvideReinforcements(VirtualRealityReinforcements)).IfNot(new AmAttacking()).If(new SeesCritter())
                .DoSequence("Find player and attack him")
                    .Do(new FindCritters(Find.Life | Find.OnlyPlayers).Choose(new Weakest())).If(new SeesCritter()).IfNot(new AmAttacking())
                    .Do(new Attack())
                .End();

            Global.RegisterBehaviorTask(builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:20,代码来源:VirtualRealityRoles.cs


示例13: InitHumanEvil

        /**
         * Init methods for use in Mono
         */
        public static void InitHumanEvil(Critter critter)
        {
            var builder = new CritterBehaviorBuilder (critter);

            builder
                .Do (new CallReinforcements (BlackboardKeys.Attackers))
                .Do (new TakeDrug (ItemPack.HealingDrugs)).If (new IsHurt (70))
                .DoSequence ("20% to find weakest player and attack him instead")
                    .Do (new AtFixedRate<CritterBlackboard> (Time.RealSecond (10)))
                    .Do (new AtChance<CritterBlackboard> (20))
                    .Do (new FindCritters (Find.Life | Find.OnlyPlayers).Choose (new Weakest ())).If (new SeesCritter ()).IfNot (new IsTeamMember ())
                    .Do (new Attack ())
                .End ()
                .DoSequence ("Attack every non member")
                    .Do (new FindCritters (Find.Life)).If (new SeesCritter ()).IfNot (new AmAttacking ()).IfNot (new IsTeamMember ())
                    .Do (new Attack ())
                .End ()
                .Do (new ProvideReinforcements ()).IfNot (new AmAttacking ());

            Global.RegisterBehaviorTask (builder.MainTask);
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:24,代码来源:EncounterRoles.cs


示例14: ChooseAttack

        public AttackChoice ChooseAttack(Critter npc, Critter target)
        {
            var attackChoice = new AttackChoice ();
            var currentItem = npc.GetItemHand ();
            Item weaponItem = null;

            if (currentItem != null) {
                if (CanBeMyWeapon (npc, currentItem)) {
                    weaponItem = currentItem;
                }
            } else {
                weaponItem = null;
            }

            if (weaponItem == null) {
                return null;
            }
            attackChoice.WeaponId = weaponItem.Id;
            attackChoice.WeaponUse = 0;
            attackChoice.HitLocation = HitLocation.Uncalled;

            return attackChoice;
        }
开发者ID:wladimiiir,项目名称:vault112,代码行数:23,代码来源:Ranged.cs


示例15: RaiseTurnBasedProcess

 // called by engine
 void RaiseTurnBasedProcess(Critter cr, bool begin_turn)
 {
     if (TurnBasedProcess != null)
         TurnBasedProcess (this, new MapTurnBasedProcessEventArgs (this, cr, begin_turn));
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:6,代码来源:Map.Events.cs


示例16: GetVisibleLocations

 public uint GetVisibleLocations(ushort wx, ushort wy, uint radius, Critter visible_for, LocationArray locations)
 {
     return Global_GetVisibleLocations(wx, wy, radius, visible_for.ThisPtr, (IntPtr)locations);
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:4,代码来源:MapManager.cs


示例17: RaiseCritterDead

 // called by engine
 void RaiseCritterDead(Critter cr, Critter killer)
 {
     if (CritterDead != null)
         CritterDead (this, new MapCritterDeadEventArgs (this, cr, killer));
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:6,代码来源:Map.Events.cs


示例18: RaiseOutCritter

 // called by engine
 void RaiseOutCritter(Critter cr)
 {
     if (OutCritter != null)
         OutCritter (this, new MapInOutCritterEventArgs (this, cr));
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:6,代码来源:Map.Events.cs


示例19: MapInOutCritterEventArgs

 public MapInOutCritterEventArgs(Map map, Critter cr)
     : base(map)
 {
     this.Cr = cr;
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:5,代码来源:Map.Events.cs


示例20: MapTurnBasedProcessEventArgs

 public MapTurnBasedProcessEventArgs(Map map, Critter cr, bool begin_turn)
     : base(map)
 {
     this.Cr = cr;
     this.BeginTurn = begin_turn;
 }
开发者ID:wladimiiir,项目名称:vault112,代码行数:6,代码来源:Map.Events.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Server.Critter类代码示例发布时间:2022-05-24
下一篇:
C# Studio.EventInstance类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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