示例#1
0
 public static void OnDestroyHelper(GameObject objBeingDestroyed)
 {
     var toDestroy = new List<GameObject>();
     foreach (var obj in objBeingDestroyed.engine.objects.Values)
     {
         if (obj.name.StartsWith(objBeingDestroyed.name))
             toDestroy.Add(obj);
     }
     foreach (var obj in toDestroy)
         obj.Destroy();
 }
示例#2
0
        public Bullet(GameObject owner, Vector2 direction)
        {
            this.owner = owner;
            Character ownerCharacter = owner as Character;
            if (owner != null) {
                this.startingSpeed = ownerCharacter.level.shotSpeed;
                this.range = ownerCharacter.level.shotRange;
            }
            this.speed = this.startingSpeed;
            this.direction = direction;

            this.rangeToGo = this.range;
            this.fill = true;
            this.order = 6;
        }
示例#3
0
 public void SpawnBlock(int bx, int by, GameObject spriteObj, string blockName)
 {
     Console.WriteLine ("bx: {0}, by: {1}, {2} {3}", bx, by, blocks.GetLength (0), blocks.Length);
     if (blocks [bx, by] == null) {
         blocks [bx, by] = spriteObj;
         blocks [bx, by].name = blockName;
         //blocks [x, y].currentSprite = (SpriteAsset) engine.GetAsset ("block");
         blocks [bx, by].x = bx * blockW;
         blocks [bx, by].y = by * blockH;
         blocks [bx, by].order = this.order;
         if (blocksWithHitBox)
             blocks [bx, by].AddHitBox (blockName, 0, 0, blockW, blockH);
         Console.WriteLine ("Spawned block {0}.{1} at {2}.{3}", bx, by, blocks [bx, by].x, blocks [bx, by].y);
         engine.SpawnObject (blockName, blocks [bx, by]);
     }
 }
示例#4
0
 public Collision(string hitBoxName, GameObject other, string otherHitBoxName)
 {
     this.hitBox = hitBoxName;
     this.other = other;
     this.otherHitBox = otherHitBoxName;
 }
示例#5
0
 public void UpdatedObjectOrder(GameObject gameObject)
 {
     dirtyObjects[gameObject] = 2;
 }
示例#6
0
        /* 
		 * 
		 * GameObject's management
		 * 
		 */

        public void SpawnObject(string name, GameObject obj)
        {
            obj.Name = name;
            obj.Engine = this;
            obj.Enabled = true;
            obj.Id = totalObjCount++;
            Objects[name] = obj;
            dirtyObjects[obj] = 1;
            obj.Initialize();
        }
示例#7
0
 public void SpawnObject(GameObject obj)
 {
     SpawnObject(obj.Name, obj);
 }
示例#8
0
        public void RemoveObject(GameObject obj)
        {
            if (debugCollisions && obj.HitBoxes != null)
                foreach (var hitBox in obj.HitBoxes.Values)
                    if (debugCollisionsBoxes.ContainsKey(hitBox))
                        debugCollisionsBoxes.Remove(hitBox);

            Objects.Remove(obj.Name);
            dirtyObjects[obj] = 0;
        }
示例#9
0
 public TimerManager(GameObject owner) : this()
 {
     this.owner = owner;
 }
示例#10
0
文件: Engine.cs 项目: unbit/aivengine
 /*
  *
  * GameObject's management
  *
  */
 public void SpawnObject(string name, GameObject obj)
 {
     obj.name = name;
     obj.engine = this;
     obj.enabled = true;
     this.objects [name] = obj;
     obj.Initialize ();
     // force the rendering list to be rebuilt
     this.dirtyObjects = true;
 }
示例#11
0
文件: Engine.cs 项目: unbit/aivengine
 public void RemoveObject(GameObject obj)
 {
     this.objects.Remove (obj.name);
     this.dirtyObjects = true;
 }