コード例 #1
0
        public override void Update()
        {
            //获取新的指向砖块 并设置颜色
            Vector3 tempVector3 = GameTool.GetMouseWorldPosition();

            if (tempVector3 != GameTool.noUsePosition)
            {
                _oldCub     = _currentCub;
                _currentCub = GetCub(tempVector3);
                if (_isShowRedCub)
                {
                    SetCubRed(_currentCub);
                }
            }
            //设置久砖块的颜色
            if (_currentCub != _oldCub)
            {
                ResetCubColor(_oldCub);
            }
        }
コード例 #2
0
        //获取炮塔产生位置
        public Vector3 GetTurretCreatePos()
        {
            Vector3 pointPos = GameTool.GetMouseWorldPosition();

            if (pointPos != GameTool.noUsePosition)
            {
                int h = (int)(pointPos.z + 2.5) / 5;
                int l = (int)(pointPos.x + 2.5) / 5;
                if (_turretMaps[h, l])
                {
                    //TODO 提示用户此处已经有炮塔
                    return(GameTool.noUsePosition);
                }
                int x = l * 5;
                int z = h * 5;
                _turretMaps[h, l] = true;
                return(new Vector3(x, 0, z));
            }
            else
            {
                return(GameTool.noUsePosition);
            }
        }