예제 #1
0
        public GMaze(CBattle battle, Vector3 scale, Vector3 offset, int row, int col)
        {
            this._battle = battle;
            this.scale   = scale;
            this.offset  = offset;
            this.row     = row;
            this.col     = col;

            this._localToWorld = Matrix4x4.TRS(this.offset, Quaternion.identity, this.scale);
            this._worldToLocal = this._localToWorld.inverse;

            this._root          = new GameObject("Maze_root");
            this._root.isStatic = true;
            Object.DontDestroyOnLoad(this._root);

            //this._ground = Object.Instantiate( Resources.Load<GameObject>( "Prefabs/Water0" ) ).transform;
            //this._ground.localScale = new Vector3( this.col * this.scale.x * 2, this.row * this.scale.z * 2, 1 );//because rotation.x = 90
            //this._ground.position = new Vector3( this.col * this.scale.x * 0.5f, -0.4f, -this.row * this.scale.z * 0.5f );
            //this._ground.SetParent( this._root.transform );
            //this._groundMat = this._ground.GetComponent<MeshRenderer>().material;
            //this._groundMat.mainTextureScale = new Vector2( this.col * this.scale.x * 2, this.row * this.scale.z * 2 );

            this._FOWPlane            = Object.Instantiate(Resources.Load <GameObject>("Prefabs/FOWPlane")).transform;
            this._FOWPlane.localScale = new Vector3(this.col * this.scale.x * 2, this.row * this.scale.z * 2, 1);              //because rotation.x = 90
            this._FOWPlane.position   = new Vector3(this.col * this.scale.x * 0.5f, 2f, -this.row * this.scale.z * 0.5f);
            this._FOWPlane.SetParent(this._root.transform);
            this._FOWPlaneMat = this._FOWPlane.GetComponent <MeshRenderer>().material;
            this._FOWPlaneMat.SetFloat("_Frequency", ( float )this._battle.FOWFogFrequency);
            this._FOWPlaneMat.SetFloat("_Amplitude", ( float )this._battle.FOWFogAmplitude);
        }
예제 #2
0
        public static void Init(BattleParams param)
        {
            _init = true;
            _shouldSendActions = false;

            _elapsedSinceLastLogicUpdate = Fix64.Zero;
            _framesPerKeyFrame           = param.framesPerKeyFrame;
            _frameRate    = param.frameRate;
            _nextKeyFrame = _framesPerKeyFrame;

            cBattle = new CBattle(param);
            lBattle = new Battle(param);

            _logicThread = new Thread(LogicWorker);
            _logicThread.IsBackground = true;
            _logicThread.Start();

            if (Env.useNetwork)
            {
                NetModule.instance.AddACMDListener(Module.BATTLE, Command.ACMD_BATTLE_START, HandleBattleStart);
                NetModule.instance.AddACMDListener(Module.BATTLE, Command.ACMD_FRAME, HandleFrame);
                NetModule.instance.AddACMDListener(Module.BATTLE, Command.ACMD_BATTLE_END, HandleBattleEnd);
                NetModule.instance.Send(ProtocolManager.PACKET_BATTLE_QCMD_BATTLE_CREATED());
            }
        }
예제 #3
0
 public void Dispose()
 {
     if (this._root != null)
     {
         //Object.Destroy( this._ground.gameObject );
         //this._ground = null;
         //Object.Destroy( this._groundMat );
         //this._groundMat = null;
         Object.Destroy(this._FOWPlane.gameObject);
         this._FOWPlane = null;
         Object.Destroy(this._FOWPlaneMat);
         this._FOWPlaneMat = null;
         MeshRenderer mr = this._root.GetComponent <MeshRenderer>();
         Object.Destroy(mr.material);
         Object.Destroy(this._root);
         this._root = null;
     }
     this._battle      = null;
     this._tmpPos      = null;
     this._tmpFov      = null;
     this._tmpEntities = null;
     this._bright      = false;
 }
예제 #4
0
 public CGameCmdAttack(int _targetCityID, CBattle _battle)
 {
     this.targetCityID_ = _targetCityID;
     this.battle_       = _battle;
 }