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

C# Forays.PhysicalObject类代码示例

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

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



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

示例1: Add

        public async void Add(string s, PhysicalObject obj)
        { //if there's at least one object, the player must be able to
            bool add = false;
            if (obj == player || player.CanSee(obj))
            {
                add = true;
            }

            else
            {
                add = true;
            }
            if (add && s.Length > 0)
            {
                if (s.Match(new System.Text.RegularExpressions.Regex("^[a-z]")) != null && s.Match(new System.Text.RegularExpressions.Regex("^[a-z]")).Length > 0)
                {
                    s = s.Replace(new System.Text.RegularExpressions.Regex("^[a-z]"), (sr) => sr[0].ToString().ToUpper());
                    //					c[0] = Char.ToUpper(s[0]);
                    //s = new string(c);
                }
                int idx = str.Count - 1;
                str[idx] = str[idx] + s;
                //str.Add(str[idx]);
                //while (str[idx].Length > max_length)
                //{
                //    int extra_space_for_more = 7;
                //    if (str.Count < 3)
                //    {
                //        extra_space_for_more = 1;
                //    }
                //    for (int i = max_length - extra_space_for_more; i >= 0; --i)
                //    {
                //        if (str[idx].Substring(i, 1) == " ")
                //        {
                //            if (str.Count == 3)
                //            {
                //                overflow = str[idx].Substring(i + 1);
                //            }
                //            else
                //            {
                //                //(str[idx].Substring(i + 1)); //todo - this breaks very long lines again.
                //            }
                //            str[idx] = str[idx].Substring(0, i + 1);
                //            break;
                //        }
                //    }
                if (overflow != "")
                {
                    Screen.ResetColors();
                    await Print(false);
                    idx = 0;
                }

            }
        }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:55,代码来源:Buffer.cs


示例2: Event

 public Event(PhysicalObject target_,int delay_)
 {
     target=target_;
     delay=delay_;
     type=EventType.MOVE;
     value=0;
     msg="";
     msg_objs = null;
     time_created=Q.turn;
     dead=false;
     tiebreaker = Q.Tiebreaker;
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:12,代码来源:Queue.cs


示例3: foreach

 /*public Event(int delay_,string msg_,params PhysicalObject[] objs){
     target=null;
     delay=delay_;
     type=EventType.ANY_EVENT;
     attr=AttrType.NO_ATTR;
     value=0;
     msg=msg_;
     msg_objs = new List<PhysicalObject>();
     foreach(PhysicalObject obj in objs){
         msg_objs.Add(obj);
     }
     time_created=Q.turn;
     dead=false;
     tiebreaker = Q.Tiebreaker;
 }*/
 public Event(List<Tile> area_,int delay_,EventType type_)
 {
     target=null;
     /*area = new List<Tile>(); //todo: reverted this. hope it works.
     foreach(Tile t in area_){
         area.Add(t);
     }*/
     area=area_;
     delay=delay_;
     type=type_;
     attr=AttrType.NO_ATTR;
     value=0;
     msg="";
     msg_objs = null;
     time_created=Q.turn;
     dead=false;
     tiebreaker = Q.Tiebreaker;
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:33,代码来源:Queue.cs


示例4: Kill

 public void Kill(PhysicalObject target_,AttrType attr_)
 {
     if(target == target_ && type == EventType.REMOVE_ATTR && attr == attr_){
         target = null;
         if(msg_objs != null){
             msg_objs.Clear();
             msg_objs = null;
         }
         if(area != null){
             area.Clear();
             area = null;
         }
         dead = true;
     }
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:15,代码来源:Queue.cs


示例5: FirstSolidTileInLine

 public Tile FirstSolidTileInLine(PhysicalObject obj)
 {
     return FirstSolidTileInLine(obj,1);
 }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:4,代码来源:PhysicalObject.cs


示例6: Execute


//.........这里部分代码省略.........
                                        float avg = neighbors_total / (float)open;
                                        float d = 0.03f * open;
                                        g[i,j] = M.gas[i,j] * (1-d) + avg * d;
                                    }
                                }
                            }
                        }
                        M.gas = g;
                    }
                    for(int i=0;i<ROWS;++i){
                        for(int j=0;j<COLS;++j){
                            if(g[i,j] > 0.0f){
                                if(g[i,j] <= 0.001f){
                                    g[i,j] = 0.0f;
                                    M.tile[i,j].features.Remove(FeatureType.POISON_GAS);
                                }
                                else{
                                    g[i,j] -= 0.001f;// * (float)R.r.NextDouble();
                                    M.tile[i,j].features.AddUnique(FeatureType.POISON_GAS);
                                }
                            }
                            else{
                                M.tile[i,j].features.Remove(FeatureType.POISON_GAS);
                            }
                        }
                    }
                    Q.Add(new Event(100,EventType.GAS_UPDATE));
                    break;
                }*/
                case EventType.FIRE:
                {
                    List<Tile> chance_to_burn = new List<Tile>(); //tiles that might be affected
                    List<Tile> chance_to_die_out = new List<Tile>(); //fires that might die out
                    List<PhysicalObject> no_fire = new List<PhysicalObject>();
                    foreach(PhysicalObject o in new List<PhysicalObject>(Fire.burning_objects)){
                        if(o.IsBurning()){
                            foreach(Tile neighbor in o.TilesWithinDistance(1)){
                                if(neighbor.actor() != null && neighbor.actor() != o){
                                    if(neighbor.actor() == player){
                                        if(!player.HasAttr(AttrType.JUST_SEARED,AttrType.FROZEN,AttrType.DAMAGE_RESISTANCE)){
                                            B.Add("The heat sears you! ");
                                        }
                                        player.RefreshDuration(AttrType.JUST_SEARED,50);
                                    }
                                    neighbor.actor().TakeDamage(DamageType.FIRE,DamageClass.PHYSICAL,false,1,null,"searing heat");
                                }
                                //every actor adjacent to a burning object takes proximity fire damage. (actors never get set on
                                //  fire directly this way, but an actor covered in oil will ignite if it takes any fire damage)
                                //every tile adjacent to a burning object has a chance to be affected by fire. oil-covered objects are always affected.
                                //if the roll is passed, fire is applied to the tile.
                                chance_to_burn.AddUnique(neighbor);
                            }
                            if(o is Tile){
                                chance_to_die_out.AddUnique(o as Tile);
                            }
                        }
                        else{
                            no_fire.AddUnique(o);
                        }
                    }
                    foreach(Tile t in chance_to_burn){
                        if(R.OneIn(6) || t.Is(FeatureType.OIL,FeatureType.SPORES,FeatureType.CONFUSION_GAS) || t.Is(TileType.BARREL)){
                            t.ApplyEffect(DamageType.FIRE);
                        }
                    }
                    foreach(Tile t in chance_to_die_out){
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:67,代码来源:Queue.cs


示例7: AnimateExplosion

		public static void AnimateExplosion(PhysicalObject obj,int radius,colorchar ch,bool single_frame){
			AnimateExplosion(obj,radius,ch,50,single_frame);
		}
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:3,代码来源:Screen.cs


示例8: FindTargetedEvent

 public Event FindTargetedEvent(PhysicalObject target,EventType type)
 {
     for(LinkedListNode<Event> current = list.First;current!=null;current = current.Next){
         if(!current.Value.dead && current.Value.target == target && current.Value.type == type){
             return current.Value;
         }
     }
     return null;
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:9,代码来源:Queue.cs


示例9: GetBestLineOfEffect

 public List<Tile> GetBestLineOfEffect(PhysicalObject o)
 {
     return GetBestLineOfEffect(o.row,o.col);
 }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:4,代码来源:PhysicalObject.cs


示例10: GetBestExtendedLine

 public List<Tile> GetBestExtendedLine(PhysicalObject o)
 {
     return GetBestExtendedLine(o.row,o.col);
 }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:4,代码来源:PhysicalObject.cs


示例11: GetAlternateExtendedBresenhamLine

 public List<Tile> GetAlternateExtendedBresenhamLine(PhysicalObject o)
 {
     return GetAlternateExtendedBresenhamLine(o.row,o.col);
 }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:4,代码来源:PhysicalObject.cs


示例12: AddBurningObject

 public static void AddBurningObject(PhysicalObject o)
 {
     if(fire_event == null){
         Event player_move = Event.Q.FindTargetedEvent(Event.player,EventType.MOVE);
         int fire_time = player_move.TimeToExecute();
         int remainder = fire_time % 100;
         if(remainder != 0){
             fire_time = (fire_time - remainder) + 100;
         }
         fire_event = new Event(fire_time - Event.Q.turn,EventType.FIRE);
         fire_event.tiebreaker = 0;
         Event.Q.Add(fire_event);
     }
     burning_objects.AddUnique(o);
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:15,代码来源:Queue.cs


示例13: FindAttrEvent

 public Event FindAttrEvent(PhysicalObject target,AttrType attr)
 {
     for(LinkedListNode<Event> current = list.First;current!=null;current = current.Next){
         if(!current.Value.dead && current.Value.target == target && current.Value.type == EventType.REMOVE_ATTR && current.Value.attr == attr){
             return current.Value;
         }
     }
     return null;
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:9,代码来源:Queue.cs


示例14: KillEvents

 public void KillEvents(PhysicalObject target,AttrType attr)
 {
     for(LinkedListNode<Event> current = list.First;current!=null;current = current.Next){
         current.Value.Kill(target,attr);
     }
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:6,代码来源:Queue.cs


示例15: UpdateStatusBarWithFeatures

 public void UpdateStatusBarWithFeatures()
 {
     foreach(FeatureType ft in features){
         if(ft == FeatureType.BONES || ft == FeatureType.GRENADE || ft == FeatureType.STABLE_TELEPORTAL || ft == FeatureType.TELEPORTAL || ft == FeatureType.TROLL_BLOODWITCH_CORPSE || ft == FeatureType.TROLL_CORPSE){
             PhysicalObject o = new PhysicalObject(proto_feature[ft].name,proto_feature[ft].symbol,proto_feature[ft].color);
             o.p = p;
             UI.sidebar_objects.Add(o);
         }
     }
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:10,代码来源:Tile.cs


示例16: FirstActorInLine

 public Actor FirstActorInLine(PhysicalObject obj)
 {
     return FirstActorInLine(obj,1);
 }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:4,代码来源:PhysicalObject.cs


示例17: FirstActorInExtendedLine

 public Actor FirstActorInExtendedLine(PhysicalObject obj,int num,int max_distance)
 {
     if(obj == null){
         return null;
     }
     int count = 0;
     List<Tile> line = GetBestExtendedLine(obj.row,obj.col);
     line.RemoveAt(0);
     foreach(Tile t in line){
         if(!t.passable){
             return null;
         }
         if(max_distance != -1 && DistanceFrom(t) > max_distance){
             return null;
         }
         if(M.actor[t.row,t.col] != null){
             ++count;
             if(count == num){
                 return M.actor[t.row,t.col];
             }
         }
     }
     return null;
 }
开发者ID:tommyettinger,项目名称:ForaysIntoSaltarelle,代码行数:24,代码来源:PhysicalObject.cs


示例18: Define

 private static void Define(FeatureType type_,string name_,char symbol_,Color color_)
 {
     proto_feature[type_] = new PhysicalObject(name_,symbol_,color_);
     switch(type_){
     case FeatureType.BONES:
         proto_feature[type_].sprite_offset = new pos(0,31);
         break;
     case FeatureType.FIRE:
         proto_feature[type_].sprite_offset = new pos(0,27);
         break;
     case FeatureType.FOG:
         proto_feature[type_].sprite_offset = new pos(0,21);
         break;
     case FeatureType.FORASECT_EGG:
         proto_feature[type_].sprite_offset = new pos(1,18);
         break;
     case FeatureType.GRENADE:
         proto_feature[type_].sprite_offset = new pos(0,16);
         break;
     case FeatureType.INACTIVE_TELEPORTAL:
         proto_feature[type_].sprite_offset = new pos(0,24);
         break;
     case FeatureType.OIL:
         proto_feature[type_].sprite_offset = new pos(2,20);
         break;
     case FeatureType.PIXIE_DUST:
         proto_feature[type_].sprite_offset = new pos(1,17);
         break;
     case FeatureType.POISON_GAS:
         proto_feature[type_].sprite_offset = new pos(0,22);
         break;
     case FeatureType.SLIME:
         proto_feature[type_].sprite_offset = new pos(2,16);
         break;
     case FeatureType.SPORES:
         proto_feature[type_].sprite_offset = new pos(1,19);
         break;
     case FeatureType.STABLE_TELEPORTAL:
         proto_feature[type_].sprite_offset = new pos(0,25);
         break;
     case FeatureType.TELEPORTAL:
         proto_feature[type_].sprite_offset = new pos(0,23);
         break;
     case FeatureType.TROLL_BLOODWITCH_CORPSE:
         proto_feature[type_].sprite_offset = new pos(0,19);
         break;
     case FeatureType.TROLL_CORPSE:
         proto_feature[type_].sprite_offset = new pos(0,17);
         break;
     case FeatureType.WEB:
         proto_feature[type_].sprite_offset = new pos(1,16);
         break; //todo: no dust, confusion gas, any other new stuff yet.
     }
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:54,代码来源:Tile.cs


示例19: RemoveMouseover

 public static void RemoveMouseover()
 {
     if(mouselook_current_target != null){
         if(mouselook_current_desc_area != Rectangle.Empty){
             int h = mouselook_current_desc_area.Height;
             int w = mouselook_current_desc_area.Width;
             Screen.UpdateGLBuffer(Global.MAP_OFFSET_ROWS,Global.MAP_OFFSET_COLS + mouselook_current_desc_area.Left,Global.MAP_OFFSET_ROWS + h - 1,Global.MAP_OFFSET_COLS + mouselook_current_desc_area.Right - 1);
             mouselook_current_desc_area = Rectangle.Empty;
         }
         mouselook_current_target = null;
         Screen.CursorVisible = true;
     }
     if(mouse_path != null){
         foreach(pos p in mouse_path){
             int i = p.row;
             int j = p.col;
             colorchar cch = Screen.MapChar(i,j); //I tried doing this with a single call to UpdateVertexArray. It was slow.
             Game.gl.UpdateVertexArray(i+Global.MAP_OFFSET_ROWS,j+Global.MAP_OFFSET_COLS,GLGame.text_surface,0,(int)cch.c,cch.color.GetFloatValues(),cch.bgcolor.GetFloatValues());
         }
         mouse_path = null;
     }
 }
开发者ID:ptrefall,项目名称:ForaysIntoNorrendrin,代码行数:22,代码来源:MouseUI.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Entities.IndicatorComp类代码示例发布时间:2022-05-26
下一篇:
C# Mocks.MockWriter类代码示例发布时间: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