Inheritance: MonoBehaviour
Example #1
0
        public void Draw()
        {
            Graphics g = Game.Graphics;

            NextFigure.Draw(g);
            ScoreUI.Draw(g);

            int rowoff = -Y;

            g.DrawLine(BorderPen, X, Y + rowoff, X, Y + Rows * BlockWH + rowoff);
            g.DrawLine(BorderPen, X, Y + Rows * BlockWH + rowoff, X + Cols * BlockWH, Y + Rows * BlockWH + rowoff);
            g.DrawLine(BorderPen, X + Cols * BlockWH, Y + Rows * BlockWH + rowoff, X + Cols * BlockWH, Y + rowoff);//border

            int nextFigureBorderOffsetY = 20;
            int y = nextFigureBorderOffsetY + BlockWH * 2;

            g.DrawRectangle(BorderPen, RightX, y, BlockWH * 5, BlockWH * 6);//next figure border
            nextFigure.X = RightX + BlockWH;
            nextFigure.Y = y + BlockWH;
            nextFigure.Draw(g);

            for (int i = 0; i < Cols; i++)
            {
                for (int j = 0; j < Rows; j++)
                {
                    if (Grid[i][j] != null)
                    {
                        int posx = i * BlockWH + X;
                        int posy = j * BlockWH;
                        g.FillRectangle(Grid[i][j].Brush, posx, posy, BlockWH, BlockWH);
                    }
                }
            }
        }
Example #2
0
    IEnumerator SendCheck(WWW data)
    {
        yield return(data); // Wait until the download is done

        if (data.error == null)
        {
            BlockManager   m_blockManager = GameObject.Find("GameManager").GetComponent <BlockManager>();
            ScoreUI        scoreUI        = GameObject.Find("ScoreUI").GetComponent <ScoreUI>();
            List <Vector2> listPos        = SaveNLoad.GetInstance.GetListPos();

            JsonData mapData = JsonMapper.ToObject(data.text);

            GameObject goBlockManager = new GameObject("BlockManager");
            m_iPreScore = int.Parse(mapData["bestScore"]["score"].ToString());
            scoreUI.SetScore(m_iPreScore);

            Debug.Log(mapData.Count);
            for (int i = 0; i < mapData.Count; ++i)
            {
                m_blockManager.CreateBlock(goBlockManager
                                           , listPos[int.Parse(mapData["mapData"][i]["iIndex"].ToString())]
                                           , int.Parse(mapData["mapData"][i]["blockID"].ToString())
                                           , int.Parse(mapData["mapData"][i]["itemID"].ToString())); //아이템 ID 넘길것
            }
        }
        else
        {
            Debug.Log("Net Load Failed");
        }
    }
Example #3
0
 private void Awake()
 {
     Instance = this;
     Level    = transform.Find("Level").GetComponent <Text>();
     Score    = transform.Find("Score").GetComponent <Text>();
     gameObject.SetActive(false);
 }
    public void Init(ScoreUI scoreUI)
    {
        this.uiScore = scoreUI;

        OnPlayerHitChain.AddListener(UpdateHitCount);
        OnScoreEvent.AddListener(UpdateScoreCount);
    }
Example #5
0
    private void Start()
    {
        scoreUI = FindObjectOfType <ScoreUI>();
        int randomSprite = Random.Range(0, 2);

        GetComponent <SpriteRenderer>().sprite = sprites[randomSprite];
    }
Example #6
0
    void OnTriggerEnter2D(Collider2D c)
    {
        if (c.gameObject.name == "Character")
        {
            ScoreUI.addScore(5000);

            if (windPowerUp)
            {
                cs.windForce = cs.windForce * windPowerUpMultiplier;

                Destroy(gameObject);
            }
            if (speedPowerUp)
            {
                cs.horizontalSpeed    = cs.horizontalSpeed * speedPowerUpMultiplier;
                ControlScript.hasWind = true;                // fixes an issue with powerups disabling this, shouldnt need it once we implement wind
                Destroy(gameObject);
            }
            if (scorePowerUp)
            {
                ScoreUI.addScore(scorePowerUpAmount);

                Destroy(gameObject);
            }
        }
    }
    public void startGame()
    {
        gameStarted = true;
        lives       = 3;
        score       = 0;
        level       = 0;
        //upperBoundPos.z = topLimit + 0.5f;
        lowerBoundPos.z = botLimit - 0.4f;
        //GameObject upperBound = Instantiate(boundary, upperBoundPos, Quaternion.identity) as GameObject;
        GameObject lowerbound = Instantiate(boundary, lowerBoundPos, Quaternion.identity) as GameObject;

        setInvaders();
        GameObject pbObj = Instantiate(playerBase, spawnpos, Quaternion.identity) as GameObject;

        pb            = pbObj.GetComponent <PlayerBase>();
        pb.controller = gameObject;
        GameObject scoreUIobj = Instantiate(scoreUI, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
        ScoreUI    s_UI       = scoreUIobj.gameObject.GetComponent <ScoreUI>();

        s_UI.controller = gameObject.GetComponent <GameController>();
        GameObject livesUIobj = Instantiate(livesUI, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;

        l_UI            = livesUIobj.gameObject.GetComponent <LivesUI>();
        l_UI.controller = gameObject.GetComponent <GameController>();
        l_UI.pb         = pb;
        createBases();
    }
Example #8
0
    private void Start()
    {
        score_ = FindObjectOfType <ScoreUI>();
        flashlightRenderer_       = flashlight.GetComponent <SpriteRenderer>();
        smackSound_               = FindObjectOfType <BumpsAndSounds>();
        flashlightRenderer_.color = yellow_;
        strokeScript_             = FindObjectOfType <BallControl>();
        player_       = GameObject.FindGameObjectWithTag("Player").transform;
        gangsterAnim_ = GetComponent <Animator>();
        if (gangsterAnim_ == null)
        {
            Debug.LogError("no animator on: " + gameObject.name);
        }


        waypoints = new Vector3[pathHolder_.childCount];
        for (int i = 0; i < waypoints.Length; i++)
        {
            waypoints[i] = pathHolder_.GetChild(i).position;
            waypoints[i] = new Vector3(waypoints[i].x, transform.position.y, waypoints[i].z);
        }

        targetWaypoint = waypoints[targetWaypointIndex];
        transform.LookAt(targetWaypoint);
        StartCoroutine(FollowPath(waypoints));
    }
Example #9
0
 void Awake()
 {
     scoreManager = GetComponent <ScoreManager>();
     pinSet       = GameObject.FindObjectOfType <PinSet>();
     ball         = GameObject.FindObjectOfType <BallControl>();
     scoreUI      = GameObject.FindObjectOfType <ScoreUI>();
 }
Example #10
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #11
0
    public override void Load()
    {
        localPaddleGO  = Instantiate(localPaddlePrefab);
        localPaddle    = localPaddleGO.GetComponent <Paddle>();
        remotePaddleGO = Instantiate(remotePaddlePrefab);
        remotePaddle   = remotePaddleGO.GetComponent <Paddle>();
        ballGO         = Instantiate(ballPrefab);
        ball           = ballGO.GetComponent <Ball>();
        ballGO.SetActive(false);

        arrow = Manager.UI.Arrow;
        arrow.gameObject.SetActive(false);
        localScoreUI  = Manager.UI.SouthScore;
        remoteScoreUI = Manager.UI.NorthScore;
        localScoreUI.SetScore(0);
        remoteScoreUI.SetPlayerName("Player 2");
        remoteScoreUI.SetScore(0);

        clock        = timeLimit;
        clockRunning = false;
        localScore   = 0;
        remoteScore  = 0;

        int time = Mathf.RoundToInt(clock);

        Manager.UI.Clock.text = string.Format("{0}:{1:00}", time / 60, time % 60);
    }
Example #12
0
 private void Start()
 {
     ui       = GetComponent <ScoreUI> ();
     gameOver = GetComponent <GameOver> ();
     score    = 2;
     ui.UpdateUI(score);
     StartCoroutine("UsePaint");
 }
Example #13
0
 // Use this for initialization
 void Start()
 {
     facingRight = true;
     isGrounded  = false;
     rb          = GetComponent <Rigidbody2D>();
     addToScore  = GameObject.Find("ScoreText").GetComponent <ScoreUI>();
     isPaused    = GameObject.Find("PauseMenu").GetComponent <PauseMenu>();
 }
Example #14
0
 private void Awake()
 {
     if (Instance != null)
     {
         Destroy(this);
     }
     Instance = this;
 }
Example #15
0
    void OnEnable()
    {
        register.SetActive(true);
        rankingBoard.SetActive(false);

        resultTime.text = TimeUI.ToTimeString(timeUI.lapTimeValue);
        resultExp.text  = ScoreUI.ToScoreString(scoreUI.expValue);
    }
Example #16
0
 // Use this for initialization
 void Start()
 {
     uiData     = GameObject.FindGameObjectWithTag("UIData").GetComponent <ScoreUI>();
     currentPos = startPoint;
     CreateLvl(GetComponent <LvlData>().lvl1);
     uiData.SetCandyINeed(GetComponent <LvlData>().lvl1candyNeeded);
     uiData.timeLeft = GetComponent <LvlData>().lvl1Time;
 }
Example #17
0
 // Use this for initialization
 void Start()
 {
     uiData = GameObject.FindGameObjectWithTag("UIData").GetComponent<ScoreUI>();
     currentPos = startPoint;
     CreateLvl(GetComponent<LvlData>().lvl1);
     uiData.SetCandyINeed(GetComponent<LvlData>().lvl1candyNeeded);
     uiData.timeLeft = GetComponent<LvlData>().lvl1Time;
 }
Example #18
0
    void Start()
    {
        scoreUI      = FindObjectOfType <ScoreUI>();
        heartsUI     = FindObjectOfType <HeartsUI>();
        playerHealth = FindObjectOfType <PlayerHealth>();
        int roseIndex = Random.Range(0, 2);

        GetComponent <SpriteRenderer>().sprite = roseSprites[roseIndex];
    }
Example #19
0
    protected void IncreaseScore()
    {
        ScoreUI scoreUI = SceneUtils.FindObjectOf <ScoreUI>();

        if (scoreUI)
        {
            scoreUI.IncreaseNormalScore(1);
        }
    }
 // Use this for initialization
 void Start()
 {
     toggleEndScreen = GameObject.FindGameObjectWithTag("ToggleEndGameScreen").GetComponent<ToggleEndGameScreen>();
     cooldownDelay = GameObject.FindGameObjectWithTag("GameSpeed").GetComponent<GameSpeed>().gameSpeed;
     uiData = GameObject.FindGameObjectWithTag("UIData").GetComponent<ScoreUI>();
     gridHandler = GameObject.FindGameObjectWithTag("GridHandler").GetComponent<Tilegrid>();
     currentLvlData = gridHandler.lvl;
     mainCamera = GameObject.FindGameObjectWithTag("MainCamera");
 }
 // Use this for initialization
 void Start()
 {
     toggleEndScreen = GameObject.FindGameObjectWithTag("ToggleEndGameScreen").GetComponent <ToggleEndGameScreen>();
     cooldownDelay   = GameObject.FindGameObjectWithTag("GameSpeed").GetComponent <GameSpeed>().gameSpeed;
     uiData          = GameObject.FindGameObjectWithTag("UIData").GetComponent <ScoreUI>();
     gridHandler     = GameObject.FindGameObjectWithTag("GridHandler").GetComponent <Tilegrid>();
     currentLvlData  = gridHandler.lvl;
     mainCamera      = GameObject.FindGameObjectWithTag("MainCamera");
 }
Example #22
0
 public void Dispose()
 {
     FigureChange -= OnFigureChange;
     FigureChange -= OnRowDestroy;
     GoFast        = false;
     ScoreUI.Dispose();
     NextFigure.Dispose();
     SoundPlayer.Dispose();
 }
Example #23
0
 void Start()
 {
     score           = GameObject.Find("woodScore").GetComponent <ScoreUI>();
     lvlScore        = GameObject.Find("woodScore").GetComponent <Text>();
     totalScore      = GameObject.Find("woodTotalScore").GetComponent <Text>();
     score._scoreUI  = Settings.lvlScore;
     tempSc          = score._scoreUI;
     tempTot         = Settings.totalScore;
     totalScore.text = Settings.totalScore.ToString();
 }
Example #24
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            Destroy(this.gameObject);
            FindObjectOfType <SoundManager>().Play("coin");

            ScoreUI.IncrementScore(score);
        }
    }
Example #25
0
 void Start()
 {
     Stick           = GameObject.Find("StickParent").gameObject;
     Player          = GameObject.Find("Player").gameObject;
     Eyes            = GameObject.Find("Eyes").gameObject;
     Ground          = GameObject.Find("FirstGround").gameObject;
     PlayerRigidbody = Player.GetComponent <Rigidbody>();
     scoreUI         = gameObject.GetComponent <ScoreUI>();
     MusicManager    = Eyes.GetComponent <MusicControll>();
 }
Example #26
0
    // Use this for initialization
    void Start()
    {
        paused         = false;
        Time.timeScale = 1;

        GameEnd = GameObject.Find("ScoreText").GetComponent <ScoreUI>();
        speed   = 1000000;

        transform.position = Vector3.MoveTowards(transform.position, End.position, speed);
    }
Example #27
0
    void ListScores()
    {
        foreach (KeyValuePair <string, int> score in scores)
        {
            Debug.Log("Player: " + score.Key + " Score: " + score.Value);
        }

        //Update the scores in the UI
        ScoreUI.UpdateScoresUI(scores["Player"], scores["Opponent"]);
    }
Example #28
0
    private void Start()
    {
        groundY      = RhythmManager.Instance.targetY + transform.position.y - hitbox.transform.position.y;
        jumpY        = RhythmManager.Instance.jumpY + transform.position.y - hitbox.transform.position.y;
        hitting      = false;
        _playerState = PlayerState.Grounded;
        xVel         = 0;

        _scoreUi = (playerNumber == SongProfiler.PlayerNumber.Player1) ? ScoreUI.p1Score : ScoreUI.p2Score;
    }
Example #29
0
    public void Shrink()
    {
        score = score * 2;
        GameObject score_UI = GameObject.Instantiate(scoreUI) as GameObject;

        score_UI.transform.parent = canvas.transform;
        score_UI.GetComponent <RectTransform>().localPosition = new Vector3(-380, 200, 0);
        ScoreUI ui = score_UI.GetComponent <ScoreUI>();//スコアを取得

        ui.type = 2;
    }
Example #30
0
 void MakeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #31
0
 public void Refresh()
 {
     order.text = orderValue.ToString();
     if (iconImage != null)
     {
         icon.sprite = iconImage;
     }
     lapTime.text = TimeUI.ToTimeString(lapTimeValue);
     exp.text     = ScoreUI.ToScoreString(expValue);
     name.text    = nameValue;
 }
Example #32
0
 // Use this for initialization
 void Start()
 {
     sprite       = GetComponent <SpriteRenderer>();
     boxColl      = GetComponent <BoxCollider2D>();
     trans        = GetComponent <Transform>();
     m_asSound    = GetComponent <AudioSource>();
     color        = new Color();
     color        = sprite.color;
     m_scScoreUI  = GameObject.Find("ScoreUI").GetComponent <ScoreUI>();
     blockManager = GameObject.Find("GameManager").GetComponent <BlockManager>();
 }
 void Start()
 {
     uiData = GameObject.FindGameObjectWithTag("UIData").GetComponent<ScoreUI>();
 }
	public void Initialize(ScoreUI scoreUI){
		this.scoreUI = scoreUI;
	}