Project settings>Project>Maps&Modes>Default Maps
设置项目默认关卡
Scale右侧的锁可以让物体等比例缩放
Project settings>Project>Maps&Modes>Default Maps
设置项目默认关卡
Scale右侧的锁可以让物体等比例缩放
按住鼠标右键,加上wsad可以像第一人称射击视角移动,e上升,q下降
Top视图,右键平移,左键框选,中键度量
Edit>Edit Preferences
设置编辑器偏好
Edit>Project Setting
项目设置,仅对当前项目生效
Level、Map、World指同一个东西,即关卡
Toolbar>Settings>World Settings
关卡设置,仅对当前关卡生效,并且会覆盖掉项目设置
在窗口>布局>加载布局>默认布局
可以恢复默认布局
cout << "hello"//输出
endl //换行 无法放在字符串中
\n //换行 可以放在字符串中
选中后先按ctrl+K 再按ctrl+C 是注释
按住ctrl+K 再按ctrl+U是取消注释
请问老师,测试时,人物移动到一半即返回,并且没有播放出攻击动作,可能是什么问题?
(人物移动到一半即返回的问题,可以通过在取montage的时长数据后再*2ji
overlap有两个条件:
1.是否可以碰撞;
2.允许重叠;
StopMovement和destroyDecalComponet。点击鼠标后清除上一次点击的鼠标贴花并取消上一次的移动任务。课时8
直接设置Actor的Zzhou位置更直接
hit碰撞事件,生成一个通道,贴画与材质碰撞,如果碰撞到,则生成贴画,否则就不生成
引用MainPlayer.h时,4.25版本下,写全目录报错。只需写#include "MainPlayer.h"即可。
练习题
1.int i;
for(i = 0; i < 5; i++)
cout << i;
cout << endl;
这段代码将输出:
01234
2.int j;
for(j = 0; j < 11; j += 3)
cout << j;
cout << endl << j << endl;
这段代码将输出:
0369
12
3.int j = 5;
while(++j < 9)
cout << j++ << endl;
这段代码将输出:
6
8
4.int k = 8;
do
cout << "k = " << k << endl;
while(k++ < 5);
这段代码将输出:
k = 8;
5.
#include <iostream>
#include <cstdio>
#include <string>
#include <array>
using namespace std;
int main()
{
int result = 1;
for (int i = 0; i < 7; i++)
{
cout << result << " ";
result *= 2;
}
}
6.
#include <iostream>
#include <cstdio>
#include <string>
#include <array>
using namespace std;
int main()
{
int a = 0;
int b = 0;
int total = 0;
cout << "Enter a number:";
cin >> a;
cout << "Enter another number that larger than first one:";
cin >> b;
for (; a <= b; a++) {
total += a;
}
cout << "The sum of integers between two numbers is:" << total << endl;
}
7.
#include <iostream>
#include <cstdio>
#include <string>
#include <array>
using namespace std;
int main()
{
int temp = 0;
int sum = 0;
cout << "Enter a number(Enter zero mean quit program):";
cin >> temp;
while (temp != 0) {
sum += temp;
cout << "Current sum is:" << sum << endl;
cout << "Enter a number(Enter zero mean quit program):";
cin >> temp;
}
}
多维数组
声明多维数组的基本结构如下:
int testArray[2][2]{
{11,22},
{33,44}
};
std::array<array<int, 2>,2> testArray2;
testArray2[0] = {{11,22}};
testArray2[1] = {{33,44}};
上述代码声明了一个2维数组testArray和testArray2,可以将第一个"[]"内的数字看做行数,第二个"[]"内的数字看做列数。
多维数组的声明和遍历操作如下:
#include <iostream>
#include <cstdio>
#include <string>
#include <array>
using namespace std;
int main()
{
array<int, 10> testArray{11,22,33,44,55,66,77,88,99,00};
array<int, 10> testArray2{22,33,44,55,66,77,88,99,00,11};
array<int, 10> testArray3{33,44,55,66,77,88,99,00,11,22};
array<array<int, 10>, 3> testArrayTotal;
testArrayTotal = { testArray, testArray2, testArray3 };
for (int i = 0; i < testArrayTotal.size();i++){
for (int j = 0; j < 10; j++){
cout << testArrayTotal[i][j] << "\n";
}
cout << "," << endl;
}
}
do-while循环
do-while循环与while循环类似,区别在于do-while的函数体在条件判断语句的前面,所以无论条件满足与否,都会执行一次循环体。基本结构如下:
do{
loop body;
}while(condition);
其中,loop body表示循环体,condition表示条件。
使用do-while遍历数组的操作如下:
array<int, 10> testArray;
int i = 0;
do{
cout << testArray[i];
i++;
}while(i < testArray.size());
遍历数组的新方式
遍历数组的新方式操作如下:
array<int, 10> testArray;
for(int temp : testArray){
cout << temp << endl;
}
此方式只能够进行遍历操作,如果要使用此操作进行赋值,操作如下:
array<int, 10> testArray;
for(int& temp : testArray){
temp = 10;
}
While循环
while循环是循环结构的一种,可以通过while()括号中设定条件,该循环会在满足设定的条件时重复执行循环体内的函数。while循环的基本结构如下:
while(condition){
loop body;
}
其中condition表示条件,loop body表示循环体。
遍历一个数组的操作如下:
array<int,10> testArray;
int i = 0;
while(i < testArray.size()){
std::cout << testArray[i] << endl;
i++;
}
宏
定义宏的操作如下:
#define STR return 0;
可以指定一个字符串来代替另外的一些字符串。如:
#define END return 0;
#define FSTRING string
当定义了宏时,能够在使用被替换的字符串时键入宏名称来代替被替换的字符串。
在为一个数据类型定义一个宏或函数时,不能使用";"符号结束。
类型别名
用宏来实现类型别名外能够使用typedef来实现,操作如下:
typedef int UInt
需要使用";"符号结束。
typedef只能为数据类型定义别名。
for循环
循环结构的一种,根据条件重复执行同一段代码,基本结构如下:
for(init; condition; update){
loob body;
}
其中,init部分为初始化一个用来判断条件的整型变量;condition部分为执行loob body的条件;update部分为更新用来判断条件的整型变量;loob body部分为循环体,即重复执行的代码。
初始化部分只会执行一次,然后执行判断部分,如果判断结果为true,则执行一次循环体内的代码;如果判断结果为false,则结束循环。当执行了一次循环体内的代码后,会进入更新部分,更新完成后再进行判断。这个过程将重复执行至判断结果为false才会结束循环。
如果要使用for循环遍历一个数组的所有元素,代码如下:
array<int, 10> testArray;
for(int i = 0; i < testArray.size(); i++){
std::cout << testArray[i];
}
第二次编程练习
#include <iostream>
#include <array>
#include <string>
using namespace std;
struct CandyBar {
string brand;
float weight;
int cal;
};
int main()
{
//1.
array<char, 30> actor1;
char actor2[30]{};
array<float, 13> chuck1;
float chuck2[30]{};
//2.
CandyBar snack{"Mocha Munch", 2.3f, 500};
cout << "Candybar snack's info:\n" << "Name:" << snack.brand
<< "\nWeight:" << snack.weight
<< "g\nKcal:" << snack.cal << "cal." << endl;
//3.
array<float, 3> score;
cout << "Enter three 50-meter sprint results:" << endl;
cin >> score[0];
cout << "Entered." << endl;
cin >> score[1];
cout << "Entered." << endl;
cin >> score[2];
cout << "Number of attempts is " << score.size()
<< ", average score is "
<< (score[0] + score[1] + score[2]) / 3
<< "." << endl;
}
模板类array
C++11的标准将使用模板类创建数组,需要引入模板类array和命名空间std,如下:
#include <array>
using namespace std;
int main(){
array<type,elementCount> arrayName = {11,22,33,44};
//type为数据类型,elementCount为元素个数,arrayName为数组名。
}
此方式可以对数组进行赋值操作,将能够将一个数组的元素复制给另一个数组。