一、创建战争迷雾类:
module gtm {
export class Fog extends egret.DisplayObjectContainer{
public constructor() {
super();
}
private bitmap:egret.Bitmap;
private bgSh:egret.Shape;
private fogLayer:egret.DisplayObjectContainer;
public init(w:number, h:number):void {
this.bitmap = new egret.Bitmap();
this.addChild(this.bitmap);
this.bgSh = new egret.Shape();
this.bgSh.graphics.beginFill(0x000000, 0.7);
this.bgSh.graphics.drawRect(0, 0, w, h); // 创建黑色遮罩覆盖战场
this.bgSh.graphics.endFill();
this.con = new egret.DisplayObjectContainer();
this.con.addChild(this.bgSh);
this.fogLayer = new egret.DisplayObjectContainer();
this.con.addChild(this.fogLayer);
this.texture = RES.getRes("fog_png"); //以人物为中心的圆形视野
}
private con:egret.DisplayObjectContainer;
private bitmaps:egret.Bitmap[] = [];
private texture:egret.Texture;
private getBitmap():egret.Bitmap