それはまさにあなたが検討する任意のコードを持っていないとして、あなたが望むものを知ることは難しいですが、このようなものは動作するはずです:
public bool canMove = true;
if(canMove) {
//Your code allowing the player to move
}
:プレイヤーを制御するスクリプトで
障害物を管理するスクリプトで
:
public PlayerController playerController;
public bool didSolveCorrectly;
public int punishments;
void StartObstacle(int type) {
playerController.canMove = false;
switch (type) {
//Cases and other stuff about the puzzles. I recommend making methods later on in the code and calling them here, so that it's more organized.
}
}
void CompleteObstacle(bool correct, int punishmentType) {
if (correct) {
playerController.canMove = true;
}
else {
switch (punishmentType) {
//More cases governing what should happen to the player if they failed the question
}
}
}
これが私たちの質問に非常に広範な答えは、もちろん、必要なものに合わせて編集する必要があります。
もし私があなただったら私はunityanswers forumを使っていましたが、これは非常に厳しいのですが、これは主にハイパー複合トピックのためのものです。 –
@comprehensible:簡単な質問や初心者の質問は大歓迎です。しかし、彼らは責任を負わなければならず、具体的なものでなければならない。 Torera、これまでのコードを追加することができれば、これはあなたの潜在的なヘルパーを助けるかもしれません。 – halfer