コード例 #1
0
    /**
     * Update is called once per frame
     */
    void Update()
    {
        // counter更新
        if (canCount && playSeconds >= 0f)
        {
            playSeconds -= Time.deltaTime;
            if (playSeconds < 1f)
            {
                playSeconds = 0f;
                gameDirector.Action(GameActionEvent.EventType.ChaserModeCountEnd);
                canCount = false;
                StartCoroutine(GameEnd());
            }
            UpdateCounter((int)playSeconds);
        }


        // 着席モードでRキーで位置トラッキングをリセットする
        if (Input.GetKeyDown(KeyCode.R))
        {
            SteamVR.instance.hmd.ResetSeatedZeroPose();
        }


        // デバッグ用 マウス操作
        var mousePos = Input.mousePosition;

        mousePos.z = 0.1f;
        var point = Camera.main.ScreenToWorldPoint(mousePos);

        gameDirector.HoverScreen(Player.ColorType.Pink, point);
        if (Input.GetMouseButtonDown(0))
        {
            gameDirector.ShotScreen(Player.ColorType.Pink, point);

            Ray ray = Camera.main.ScreenPointToRay(Camera.main.WorldToScreenPoint(point));

            RaycastHit hit = new RaycastHit();

            if (Physics.Raycast(ray, out hit))
            {
                InkSplashShaderBehavior script = hit.collider.gameObject.GetComponent <InkSplashShaderBehavior>();
                if (null != script && canCount)
                {
                    var colorType = Player.ColorType.Pink;
                    var index     = (int)colorType;
                    script.PaintOn(hit.textureCoord, SplashImages[index]);
                    string hitTag = hit.collider.tag;

                    gameDirector.AddScore(colorType);

                    int score = gameDirector.GetScore(colorType);
                    Scores[index].text = String.Format("{0}", score);
                }
            }
        }
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (obj.transform.position.y <= -1000)
     {
         GD.AddScore(score);
         Destroy(obj);
     }
 }
コード例 #3
0
    void OnHit()
    {
        var localPoint  = lastHitResult.localPoint;
        var globalPoint = lastHitResult.globalPoint;
        var score       = (10.0f - Mathf.Abs(localPoint.x) - Mathf.Abs(localPoint.z)) * ((globalPoint.z + 10.0f) / 10.0f);

        //Debug.Log(localPoint.ToString() + "/" + globalPoint.ToString() + "/" + score);

        hitAudio.Play();

        director.AddScore(score);
    }
コード例 #4
0
ファイル: sensei.cs プロジェクト: c17006/BADBOYMISCHIEF
    void Update()
    {
        if (transform.position.y == -900 && this.gameObject.tag == "kyoutou")
        {
            GetComponent <AudioSource>().PlayOneShot(recast);

            for (int i = 0; i < playersc.itemTime.Length; i++)
            {
                playersc.itemTime[i] = playersc.itemTime[i];
            }
            //playersc.gumtime = 2;
            //playersc.bakutikutime = 2.5f;
            //playersc.dogtime = 5;
            //playersc.cointime = 5;

            /*recastRan = Random.Range(0, 4);
             * if (recastRan == 0)
             * {
             *  playersc.gumtime += 1;
             *  Debug.Log("recastGAMU");
             * }
             * else if (recastRan == 1)
             * {
             *  playersc.cointime += 1;
             *  Debug.Log("recastCOIN");
             * }
             * else if (recastRan == 2)
             * {
             *  playersc.dogtime += 1;
             *  Debug.Log("recastDOG");
             *
             * }
             * else if (recastRan == 3)
             * {
             *  playersc.bakutikutime += 1;
             *  Debug.Log("recastBAKUTIKU");
             *
             * }*/
        }
        transform.Translate(new Vector2(X, xx * -10));
        if (stan || baku)
        {
            time += Time.deltaTime;
            X     = 0;
            if (stan && time >= 1.5f)
            {
                stan = false;
                xx   = speed;
                anim.SetBool("break", false);
            }
            else if (baku && time >= 1)
            {
                if (this.gameObject.tag == "Teacher")
                {
                    gumdirectorsc.AddScore(teacherscore);
                }

                else if (this.gameObject.tag == "PTTeacher")
                {
                    gumdirectorsc.AddScore(ptteacherrscore);
                }

                else if (this.gameObject.tag == "ScienceTeacher")
                {
                    gumdirectorsc.AddScore(scienceTeacherscore);
                }

                else if (this.gameObject.tag == "kyoutou")
                {
                    gumdirectorsc.AddScore(kyoutouscore);
                }
                else if (this.gameObject.tag == "HeadTeacher")
                {
                    gumdirectorsc.AddScore(headteacherscore);
                }
                Destroy(gameObject);
            }
        }

        if (transform.position.y <= -1500)
        {
            In += 1;
        }

        if (transform.position.y >= 1900 || transform.position.y <= -1500)
        {
            Destroy(gameObject);
        }
    }