/**
 * 继承baseView界面的打开关闭动效类型
 */
export class ViewAction 
{   

    /************************ */
    private _text:Laya.Text = null;
    	/**
	 * 动画状态开始时执行。
	 */
	public onStateEnter():void {
		console.log("动画开始播放了");
		this._text.text = "动画状态：动画开始播放";
	}
		
	/**
	 * 动画状态更新时执行。
	 */
	public onStateUpdate():void {
		console.log("动画状态更新了");
		this._text.text = "动画状态：动画更新中";
	}
		
	/**
	 * 动画状态退出时执行。
	 */
	public onStateExit():void {
		console.log("动画退出了");
		this._text.text = "动画状态：动画开始退出";
    }
    /**
     * 从小变大
     */
    static ActionType_addscaleMinToMax:string = "ActionType_addscaleMinToMax";

    /**
     * 从大变小移出
     */
    static ActionType_removescaleMaxToMin:string = "ActionType_removescaleMaxToMin";

    /**
     * 没有动效
     */
    static ActionType_none:string = "ActionType_none";

    /********************************************** */
    private scene:Laya.Scene3D;
    private mat1:Laya.BlinnPhongMaterial; 
    private mesh1:Laya.Mesh;
    private mesh2:Laya.Mesh;
    public addBox():void
    {
        for (let i:number = 0; i < 8; i++) {
            this.addVerticalBox(-0.65, 0.165 + i * 0.33 * 2, 0);
            this.addVerticalBox(0, 0.165 + i * 0.33 * 2, 0);
            this.addVerticalBox(0.65, 0.165 + i * 0.33 * 2, 0);
        }
    }
    public addVerticalBox(x:number, y:number, z:number):void
    {
        var box:Laya.MeshSprite3D = this.scene.addChild(new Laya.MeshSprite3D(this.mesh1)) as Laya.MeshSprite3D;
        box.meshRenderer.material = this.mat1;
        box.meshRenderer.castShadow = true;
        box.meshRenderer.receiveShadow = true;
        box.transform.position = new Laya.Vector3(x, y, z);
        
        var rigidBody:Laya.Rigidbody3D = box.addComponent(Laya.Rigidbody3D) as Laya.Rigidbody3D;
        rigidBody.mass = 10;
        rigidBody.friction = 0.4;
        rigidBody.restitution = 0.2;
        var boxShape:Laya.BoxColliderShape = new Laya.BoxColliderShape(0.5, 0.33, 2);
        rigidBody.colliderShape = boxShape;
    }

    /********************************************** */


    /**
     * 从右边移动到中央
     */
    static ActionType_addmoveToMiddle:string="ActionType_addmoveToMiddle";
    /**
     * 从最右边移出
     */
    static ActionType_removemoveToRight:string = "ActionType_removemoveToRight";

    /**
     * 从底部向上移动
     */
    static ActionType_addmoveFromBottom:string="ActionType_addmoveFromBottom";
    /**
     * 从上向底部移动
     */
    static ActionType_addmoveFromup:string="ActionType_addmoveFromup";

    

    
}