コード例 #1
0
 // Use this for initialization
 void Start()
 {
     scoreTextManager = textScore.GetComponent <ScoreTextManager>();
     unityChanManager = unityChan.GetComponent <UnityChanManager>();
     changeTime       = 0.0f;
     rockBody.drag    = 3;
 }
コード例 #2
0
    //Check the current state of the game.
    void CheckState()
    {
        if (ball.isInGoal)           // Is ball in goal
        //attempts++; //add extra attempt
        {
            isBallInGame = false;
            StartCoroutine(TriggerEventAndRetry("Goal", 2));
            StartCoroutine(ScoreTextManager.ComputeScore(10));
        }

        //Has ball missed?
        else if (ball.transform.position.z > 0.5)
        {
            //close one
            if (Mathf.Abs(ball.transform.position.x) < 5 && ball.transform.position.y < 3)
            {
                //Debug.Log ("Close One!");
                StartCoroutine(TriggerEventAndRetry("CloseOne", 1));
            }


            //Killed a bird with that one
            else if (Mathf.Abs(ball.transform.position.y) > 6)
            {
                //Debug.Log ("Killed a bird with that one");
                StartCoroutine(TriggerEventAndRetry("GraveMiss", 1.5f));
            }
            //That ball is going way out west
            else if (Mathf.Abs(ball.transform.position.x) > 10)
            {
                //Debug.Log ("That ball is going way out west");
                StartCoroutine(TriggerEventAndRetry("GraveMiss", 1.5f));
            }
            //Average miss
            else
            {
                //Debug.Log ("Missed!");
                StartCoroutine(TriggerEventAndRetry("Miss", 1));
            }


            isBallInGame = false;
            //isResetActive = true;
        }
        //Poor shot
        else if (t > 3)
        {
            //Debug.Log ("Poor Attempt!");
            StartCoroutine(TriggerEventAndRetry("GraveMiss", 1.5f));
            ball.Stop();
            isBallInGame = false;
            //isResetActive = true;
        }
    }
コード例 #3
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        // Get the shopmanager script off of the object
        manager = GameObject.FindGameObjectWithTag("ShopManager").GetComponent <ShopManager>();
        // Find the gamecontroller object and get its GameController script
        controller = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        // Get the spriterenderer
        sr = gameObject.GetComponent <SpriteRenderer>();

        // Get the scoretextmanager
        scoreTextMan = GameObject.FindGameObjectWithTag("ScoreText").GetComponent <ScoreTextManager>();

        // Get the text that's attached to the item
        itemText = gameObject.GetComponentInChildren <Text>();

        // Set up the powerup
        createPowerup(gameObject.name);
    }
コード例 #5
0
    void Awake()
    {
        instance = this;

        SimplePool.Preload(textPrefab, 5); //Preload 5 instances
    }
コード例 #6
0
ファイル: ScoreTextManager.cs プロジェクト: xinwei2016/test
 void Awake()
 {
     _instance = this;
     scoreText = this.GetComponent<Text>();
 }