- Timestamp:
- 2013-10-07 21:47:25 (9 years ago)
- Location:
- 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Entities/Entity.cs
r4754 r4764 156 156 private bool SkipCollisionCheck(BoundingRectangleOwner collidableOwner) 157 157 { 158 if (typeof(Entity).IsAssignableFrom(collidableOwner.GetType())) 159 return !((Entity)collidableOwner).Blocks(this); 160 if (typeof(Tile).IsAssignableFrom(collidableOwner.GetType())) 158 //if (typeof(Entity).IsAssignableFrom(collidableOwner.GetType())) 159 // return !((Entity)collidableOwner).Blocks(this); 160 //if (typeof(Tile).IsAssignableFrom(collidableOwner.GetType())) 161 // return false; 162 Entity ent = collidableOwner as Entity; 163 if (ent != null) 164 return !ent.Blocks(this); 165 if (collidableOwner as Tile != null) 161 166 return false; 162 167 return true; -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobRanger.cs
r4756 r4764 161 161 StopAttack(); 162 162 } 163 if (target == null || target.Removed || (typeof(UnitBuilding).IsAssignableFrom(target.GetType()) && ((UnitBuilding)target).IsDestroyed)) 163 UnitBuilding ub = target as UnitBuilding; 164 if (target == null || target.Removed || ub != null && ub.IsDestroyed) 164 165 StopAttack(); 165 166 } … … 182 183 } 183 184 } 184 if (target == null || target.Removed || (typeof(UnitBuilding).IsAssignableFrom(target.GetType()) && ((UnitBuilding)target).IsDestroyed)) 185 UnitBuilding ub = target as UnitBuilding; 186 if (target == null || target.Removed || ub != null && ub.IsDestroyed) 185 187 { 186 188 StopAttack(); -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobWarrior.cs
r4756 r4764 164 164 StopAttack(); 165 165 } 166 if (target == null || target.Removed || (typeof(UnitBuilding).IsAssignableFrom(target.GetType()) && ((UnitBuilding)target).IsDestroyed)) 166 UnitBuilding ub = target as UnitBuilding; 167 if (target == null || target.Removed || ub != null && ub.IsDestroyed) 167 168 StopAttack(); 168 169 } … … 185 186 } 186 187 } 187 if (target == null || target.Removed || (typeof(UnitBuilding).IsAssignableFrom(target.GetType()) && ((UnitBuilding)target).IsDestroyed)) 188 UnitBuilding ub = target as UnitBuilding; 189 if (target == null || target.Removed || ub != null && ub.IsDestroyed) 188 190 StopAttack(); 189 191 } -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobWoodcutter.cs
r4756 r4764 91 91 //emmitter.Position = new Vector3(ScreenPos.X, 0.0F, ScreenPos.Y); 92 92 //Sound2D.PlaySound3D(emmitter, "sword1"); 93 TileEntity te = level.GetTileEntity(this, (int)(x / Viewport.TILESIZE), (int)(z / Viewport.TILESIZE));94 if (te != null && typeof(TileEntityTree).IsAssignableFrom(te.GetType()))93 TileEntityTree te = level.GetTileEntity(this, (int)(x / Viewport.TILESIZE), (int)(z / Viewport.TILESIZE)) as TileEntityTree; 94 if (te != null) 95 95 { 96 96 if (currentTarget != null) StopChopping(); 97 OrderChop( (TileEntityTree)te, sameOrderAmount, wasCalledBefore);97 OrderChop(te, sameOrderAmount, wasCalledBefore); 98 98 } 99 99 else -
2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/World/Level.cs
r4754 r4764 261 261 ent.Init(); 262 262 263 if (typeof(TileEntity).IsAssignableFrom(ent.GetType())) 264 tileEntities.Add((TileEntity)ent); 263 TileEntity te = ent as TileEntity; 264 if (te != null) 265 tileEntities.Add(te); 265 266 else 266 267 entities.Add(ent); 267 268 268 if (typeof(Unit).IsAssignableFrom(ent.GetType()))269 {270 Unit u = (Unit)ent;269 Unit u = ent as Unit; 270 if (u != null) 271 { 271 272 units[u.Owner.Team.ID].Add(u); 272 273 } … … 509 510 entitiesInTiles[x + z * width].ForEach(delegate(Entity ent) 510 511 { 511 if (typeof(T).IsAssignableFrom(ent.GetType())) inRadius.Add((T)ent); 512 T e = ent as T; 513 if (e != null) 514 inRadius.Add(e); 512 515 }); 513 516 }
Note: See TracChangeset
for help on using the changeset viewer.