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


C# Forays.PhysicalObject类代码示例

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


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


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