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


C# IGameObject.GetType方法代码示例

本文整理汇总了C#中IGameObject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IGameObject.GetType方法的具体用法?C# IGameObject.GetType怎么用?C# IGameObject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGameObject的用法示例。


在下文中一共展示了IGameObject.GetType方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Touches

 public override void Touches(IGameObject entity)
 {
     if (entity.GetType() == typeof(Neko))
     {
         this.Destroyed = true;
         // TODO: Update GameObject to use the Destroy() method instead.
     }
 }
开发者ID:rmtsukuru,项目名称:Nekonigiri,代码行数:8,代码来源:HealthPack.cs

示例2: OnGetBonus

 public override void OnGetBonus(IGameObject obj)
 {
     if (obj.GetType() == typeof(Player))
        {
        Player player = (Player) obj;
        player.AddShield(50);
        Owner.RemoveObject(this);
        }
 }
开发者ID:TeamAmpere,项目名称:AdvancedC-Game,代码行数:9,代码来源:ShieldBonus.cs

示例3: Intersect

 public override void Intersect(IGameObject obj)
 {
     if (obj.GetType() == typeof(Player))
     {
         Player player = (Player)obj;
         player.TakeDMG(Damage);
         Owner.RemoveObject(this);
     }
 }
开发者ID:TeamAmpere,项目名称:AdvancedC-Game,代码行数:9,代码来源:Asteroid.cs

示例4: Intersect

 public override void Intersect(IGameObject obj)
 {
     base.Intersect(obj);
     if (obj.GetType() == typeof(Bullet))
     {
         this.NeedToRemove = true;
         var bullet = (Bullet)obj;
         Owner.RemoveObject(bullet);
     }
 }
开发者ID:TeamAmpere,项目名称:AdvancedC-Game,代码行数:10,代码来源:LittleEnemy.cs

示例5: OnGetEnemy

        public override void OnGetEnemy(IGameObject obj)
        {
            if (obj.GetType() == typeof(Player))
            {
                Player player = (Player)obj;

                player.TakeDMG(+50);

                Owner.RemoveObject(this);
            }
        }
开发者ID:TeamAmpere,项目名称:AdvancedC-Game,代码行数:11,代码来源:LittleEnemy.cs

示例6: OnButtonPressed

    private void OnButtonPressed(object o, ButtonPressEventArgs args)
    {
        TreePath path = GetPathAtPos((int) args.Event.X, (int) args.Event.Y);
            if (path == null) return;

            TreeIter iter;
            if(!Model.GetIter(out iter, path))
                return;

            currentObject = (IGameObject) Model.GetValue(iter, COL_OBJECT);
            application.EditProperties(currentObject, currentObject.GetType().Name);

            if(args.Event.Button == 3) {
                ShowPopupMenu();
            }
    }
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:16,代码来源:GameObjectListWidget.cs

示例7: AddObject

        public void AddObject(IGameObject obj)
        {
            if (obj != null)
            {
                if (obj.GetType() != typeof(Explosion))
                {
                    obj.Owner = this;
                    obj.LoadContent(this.ResourceMgr);
                    this.objects.Add(obj);
                }

                else
                {
                    this.Explosions.Add((Explosion)obj);
                }

            }
        }
开发者ID:TeamAmpere,项目名称:AdvancedC-Game,代码行数:18,代码来源:ObjectManager.cs

示例8: GetName

        protected static string GetName(IGameObject obj, bool classname)
        {
            if ((!classname) && (obj is GameObject))
            {
                if (obj is Sim)
                {
                    return (obj as Sim).Name;
                }
                else
                {
                    try
                    {
                        string result = (obj as GameObject).ToTooltipString();
                        if (!string.IsNullOrEmpty(result))
                        {
                            return result;
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception(obj, e);
                    }
                }
            }

            string name = null;

            name = obj.GetType().Namespace + "." + obj.GetType().Name;
            name = name.Replace("Sims3.Gameplay.", "");

            return name;
        }
开发者ID:Robobeurre,项目名称:NRaas,代码行数:32,代码来源:ObjectProcessor.cs

示例9: Intersect

        public override void Intersect(IGameObject obj)
        {
            OnGetEnemy(obj);
            if (obj.GetType() == typeof(Bullet))
            {
                var bullet = (Bullet)obj;
                this.shooted--;
                if (this.shooted < 0)
                {
                    this.Health -= 2;
                    Owner.RemoveObject(bullet);
                    this.shooted = 10;
                }

                if (this.Health <= 0)
                {
                    this.NeedToRemove = true;
                    Owner.RemoveObject(this.bossLaser);
                    this.ScoringPoints = 100;
                }
            }
        }
开发者ID:TeamAmpere,项目名称:AdvancedC-Game,代码行数:22,代码来源:PurpleAlien.cs

示例10: SerializeIGameObject

 /// <summary>
 /// Serializes the given IGameObject (name, type, team).
 /// </summary>
 /// <param name="rootElement">The parent element.</param>
 /// <param name="gameObject">The serializing IGameObject.</param>
 private void SerializeIGameObject(XElement rootElement, IGameObject gameObject, string elementName)
 {
     var element = new XElement(elementName,
         new XAttribute("name", gameObject.Name),
         new XAttribute("type", gameObject.GetType().ToString().Split('.').Last()),
         new XAttribute("team", gameObject.Team)
         );
     rootElement.Add(element);
     foreach (var item in GetSortedArgsToSerialization(gameObject)) {
         SerializeArgument(element, item.Value);
     }
     foreach (var item in gameObject.GetIGameActions()) {
         SerializeGameAction(element, item);
     }
 }
开发者ID:vavrekmichal,项目名称:StrategyGame,代码行数:20,代码来源:GameSerializer.cs

示例11: CopyState

        /// <summary>
        /// Copies the current values of this object to a new object
        /// </summary>
        /// <param name="copyTo">The object that should have it's properties overwritten with the values of the calling Object</param>
        public virtual void CopyState(ref IGameObject copyFrom, bool ignoreNonNullProperties = false)
        {
            PropertyInfo[] properties = copyFrom.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

            foreach (PropertyInfo prop in properties)
            {
                PropertyInfo info = this.GetType().GetProperty(prop.Name, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);

                // Check if this property has State Copy disabled via the custom attribute, if so, don't copy this property.
                Attribute[] attrib = (Attribute[])info.GetCustomAttributes(typeof(DisableStateCopyAttribute), true);
                if (attrib.Length > 0)
                    continue;

                // If info is not null and we can write it without an exception
                if (info != null && info.CanWrite)
                {
                    // Check if this.Property already has a value.
                    // if it does, then check if the user wants to override it or not.
                    if (info.GetValue(this, null) != null && !ignoreNonNullProperties)
                        info.SetValue(this, prop.GetValue(copyFrom, null), null);
                    // If it does not have a value, then we set it regardless.
                    else if (info.GetValue(this, null) == null)
                        info.SetValue(this, prop.GetValue(copyFrom, null), null);
                }
                else
                {
                    Log.Error(string.Format("Failed to get property {0} from object {1} within the {2}.CopyState method", prop.Name, copyFrom.Name, this.Name));
                }
            }
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:34,代码来源:GameObject.cs

示例12: DebugObject

 public DebugObject(IGameObject item)
 {
     this.item = item;
     this.Attributes = new List<System.Reflection.PropertyInfo>(item.GetType().GetProperties());
     this.Id = item.GetHashCode();
 }
开发者ID:CharlieScarver,项目名称:TeamMidori,代码行数:6,代码来源:DebugObject.cs


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