2017-05-11 2 views
0

私はUnity 2dを新しく使いました。 質問障害物として作成するにはどうすればUnity 2dの動くキャラクタが見つかりますか?プレイヤーが先に進むために応答する必要がある障害を作成する

質問は5桁までで、前方の偽装キャラクターとして表示され、プレイヤーが最も選択するオプションもありますのでご注意ください。最終的な結果は最後に数えられるかもしれません。もし彼が間違った選択肢を選んだら、彼は人生を失うかもしれません。

+0

もし私があなただったら私はunityanswers forumを使っていましたが、これは非常に厳しいのですが、これは主にハイパー複合トピックのためのものです。 –

+2

@comprehensible:簡単な質問や初心者の質問は大歓迎です。しかし、彼らは責任を負わなければならず、具体的なものでなければならない。 Torera、これまでのコードを追加することができれば、これはあなたの潜在的なヘルパーを助けるかもしれません。 – halfer

答えて

0

それはまさにあなたが検討する任意のコードを持っていないとして、あなたが望むものを知ることは難しいですが、このようなものは動作するはずです:

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 
     } 
    } 
} 

これが私たちの質問に非常に広範な答えは、もちろん、必要なものに合わせて編集する必要があります。

関連する問題