Exemplo n.º 1
0
 void Update()
 {
     lifeLabel.text         = "Life: " + characterControlScript.Life() + "/" + characterControlScript.MaxLife();
     goldLabel.text         = "G: " + CharacterControlScript.Gold();
     ammoLabel.text         = "残弾数: " + characterControlScript.Ammo();
     stateLabel.text        = "ダンジョン1階";
     defeatNumberLabel.text = "倒した数: " + defeatNumber;
 }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        coinsText  = GameObject.Find("Coins").GetComponent <Text>();
        pointsText = GameObject.Find("ActualScore").GetComponent <Text>();
        GameObject thePlayer = GameObject.Find("model1");

        controlScript = thePlayer.GetComponent <CharacterControlScript>();
        GameObject buttonsPanel = GameObject.Find("pauseMenu");

        pmbScript = buttonsPanel.GetComponent <PauseMenuButtons>();
    }
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     if (current == null)
     {
         current = this;
     }
     else
     {
         Debug.LogError("Doofus you moofus you have two players.");
     }
 }
Exemplo n.º 4
0
    private IEnumerator Access()
    {
        Dictionary <string, string> dic = new Dictionary <string, string>(); // goldをscoreとして取得

        dic.Add("id", ShowRankingScript.PlayerId().ToString());              //インプットフィールドからidの取得
        dic.Add("name", TitleController.PlayerName());                       //タイトルシーンで入力した名前
        dic.Add("score", CharacterControlScript.Gold().ToString());          // goldをscoreとして取得);

        StartCoroutine(Post(ServerAddress, dic));                            // POST
        yield return(0);
    }
Exemplo n.º 5
0
    void Start()
    {
        GetComponent <AudioSource>().playOnAwake = false;
        GetComponent <AudioSource>().clip        = coinAudio;
        GameObject thePlayer = GameObject.Find("model1");

        controlScript = thePlayer.GetComponent <CharacterControlScript>();
        animator      = thePlayer.GetComponent <Animation>();
        GameObject buttonsPanel = GameObject.Find("pauseMenu");

        pmbScript = buttonsPanel.GetComponent <PauseMenuButtons>();
    }
Exemplo n.º 6
0
    private IEnumerator Access()
    {
        WWWForm form = new WWWForm();                        // データ送信準備
        WWW     www  = new WWW(url, form);                   //実際にサーバに接続。データを取得している

        yield return(StartCoroutine(CheckTimeOut(www, 3f))); //TimeOutSecond = 3s;

        if (www.error != null)
        {
            Debug.Log("HttpPost NG: " + www.error);
            //そもそも接続ができていないとき
        }
        else if (www.isDone)
        {
            string json = www.text;
            // JSONデータは最初は配列から始まるので、Deserialize(デコード)した直後にリストへキャスト
            IList dataList = (IList)Json.Deserialize(json);
            // リストの内容はオブジェクトなので、辞書型の変数に一つ一つ代入しながら、処理
            foreach (IDictionary scores in dataList)
            {
                // name,dataは文字列なので、文字列型へキャストしてから変数へ格納
                // id,scoreは整数型だが、intとかlongに変換できないからstringにしてる
                string id    = (string)scores["id"];
                string name  = (string)scores["name"];
                string score = (string)scores["score"];
                nameStr  += name + "\n";                  //表示するために名前をランキング順に改行して足していってる
                scoreStr += score + "\n";                 //表示するためにスコアををランキング順に改行して足していってる
                if (name == TitleController.PlayerName()) //ランキングの中に現在の名前と同じものがいたらそのidを取得
                {
                    playerId   = int.Parse(id);
                    savedScore = int.Parse(score);
                    Debug.Log(playerId);
                }
                lastScore = int.Parse(score);                     // 一番低いスコアの値を取得
            }
            Debug.Log(lastScore);
            if (lastScore < CharacterControlScript.Gold())         // 現在のスコアがランキング最下位より大きかったとき
            {
                if (playerId == 0)
                {
                    addScoreButton.SetActive(true);
                }
                else if (playerId != 0 && CharacterControlScript.Gold() > savedScore)
                {
                    updateScoreButton.SetActive(true);
                }
            }
            //送られてきたデータをテキストに反映
            rankingBoardName.GetComponent <Text>().text  = nameStr;
            rankingBoardScore.GetComponent <Text>().text = scoreStr;
        }
    }
Exemplo n.º 7
0
    private IEnumerator Access()
    {
        Dictionary <string, string> dic = new Dictionary <string, string>();

        score = CharacterControlScript.Gold();          // goldをscoreとして取得
        //dic.Add("name", inputName.GetComponent<Text>().text);  //インプットフィールドからidの取得
        dic.Add("name", TitleController.PlayerName());  //タイトルシーンで入力した名前
        dic.Add("score", score.ToString());             // goldをscoreとして取得);

        StartCoroutine(Post(ServerAddress, dic));       // POST

        yield return(0);
    }
Exemplo n.º 8
0
    public Item AddItemToInventory(CharacterControlScript ccs)
    {
        if (!_uiController)
        {
            _uiController = GameObject.FindGameObjectWithTag("Canvas").GetComponent <UIController>();
        }
        Item newItem = getNewItem();

        ccs.ItemInInventory = newItem;
        ccs.SendMessageToHat();
        _uiController.Item.enabled = true;
        _uiController.Item.sprite  = newItem.GetSprite();
        return(newItem);
    }
Exemplo n.º 9
0
 // Use this for initialization
 public override void Start()
 {
     base.Start();
     //Disable cooldown for potion
     uiController.CoolDownActivated = false;
     //Load sounds
     AudioSource = EventController.Instance.GetComponent <AudioSource>();
     soundDrink  = Resources.Load("schlucken") as AudioClip;
     AudioSource.PlayOneShot(soundDrink, 1.0f);
     //We have a player here
     _ccs = gameObject.GetComponent <CharacterControlScript>();
     _ccs.dashLengthInSeconds *= 0.5f;
     dashes = _ccs.DashCounter;
 }
Exemplo n.º 10
0
 void Awake()
 {
     if (character==null) {
         var player = GameObject.FindGameObjectWithTag("Player");
         if (player != null)
             character = player.GetComponent<CharacterControlScript>();
     }
     if (initializeLocalInput)
     {
         InputController.Vertical.registerCallback(character.Accelerate);
         InputController.Horizontal.registerCallback(character.Strafe);
         InputController.Rotation.registerCallback(character.Rotate);
         InputController.Jump.registerCallback(character.Jump);
     }
 }
Exemplo n.º 11
0
 void Awake()
 {
     if (character == null)
     {
         var player = GameObject.FindGameObjectWithTag("Player");
         if (player != null)
         {
             character = player.GetComponent <CharacterControlScript>();
         }
     }
     if (initializeLocalInput)
     {
         InputController.Vertical.registerCallback(character.Accelerate);
         InputController.Horizontal.registerCallback(character.Strafe);
         InputController.Rotation.registerCallback(character.Rotate);
         InputController.Jump.registerCallback(character.Jump);
     }
 }
Exemplo n.º 12
0
    //private float _animatorCutTime = 0.143f;

    private void Awake()
    {
        _rockThrowScript        = GameObject.Find("MainCharacter").GetComponent <RockThrowScript>();
        _characterControlScript = GameObject.Find("MainCharacter").GetComponent <CharacterControlScript>();
    }
 void Start()
 {
     score = CharacterControlScript.Gold();
 }
 //float velocity = 0.5f;
 void Start()
 {
     instance = this;
 }
Exemplo n.º 15
0
 public void RegisterCharacter(CharacterControlScript _characterControlScript)
 {
     characterControlScript = _characterControlScript;
 }