示例#1
0
    /// <summary>
    /// Updates score display on HUD
    /// </summary>
    public void Call_UpdateScore()
    {
        //Deprecated
        if (GameObject.Find("ScoreGM") != null)
        {
            //Debug.Log("Usage of deprecated function");
            ScoreGM scoreGM  = GameObject.Find("ScoreGM").GetComponent <ScoreGM>();
            int     scoreBlu = scoreGM.score_blue;
            int     scoreRed = scoreGM.score_red;
            playerHUD.UpdateScore(scoreBlu, scoreRed);
        }

        //New (Globalization of GMS)
        if (GameObject.Find("SceneGM") != null)
        {
            SceneOverlord sceneOverlord = GameObject.Find("SceneGM").GetComponent <SceneOverlord>();
            int           scoreBLU      = sceneOverlord.scoreBLU;
            int           scoreRED      = sceneOverlord.scoreRED;
            playerHUD.UpdateScore(scoreBLU, scoreRED);
        }
        else
        {
            Debug.Log("Did not find \"SceneGM\" when trying to update score");
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        CircleBomb           = GetComponent <CircleCollider2D>();
        RigiBomb             = GetComponent <Rigidbody2D>();
        RigiBomb.isKinematic = true;

        slingshot = GameObject.Find("slingshot_1");
        SlingPos  = Camera.main.ScreenToWorldPoint(slingshot.transform.position);

        Sprite = GetComponent <SpriteRenderer>();

        ThisPos  = this.transform;
        GameCont = GameObject.Find("GameManager").GetComponent <ScoreGM>();

        Up    = GameObject.Find("Sky").transform;
        Down  = GameObject.Find("Floor").transform;
        Left  = GameObject.Find("Border_L").transform;
        Right = GameObject.Find("Border_R").transform;

        MaxUp    = Up.position.y;
        MaxDown  = Down.position.y;
        MaxLeft  = Left.position.x;
        MaxRight = Right.position.x;

        //ExplosionArea = GameObject.Find("Exp_Area_Effect").transform;
    }
    // Start is called before the first frame update
    void Start()
    {
        ColliRock = GetComponent <Collider2D>();
        RigiRock  = GetComponent <Rigidbody2D>();
        MaxHP     = HP;

        GameCont   = GameObject.Find("GameManager").GetComponent <ScoreGM>();
        SpriteRend = this.GetComponent <SpriteRenderer>();

        if (SpriteRend.color == new Color(255, 0, 0, 230))
        {
            Ungravitie = true;
        }
        else
        {
            Ungravitie = false;
        }


        Up    = GameObject.Find("Sky").transform;
        Down  = GameObject.Find("Floor").transform;
        Left  = GameObject.Find("Border_L").transform;
        Right = GameObject.Find("Border_R").transform;

        MaxUp    = Up.position.y;
        MaxDown  = Down.position.y;
        MaxLeft  = Left.position.x;
        MaxRight = Right.position.x;
    }
    // Start is called before the first frame update
    void Start()
    {
        ColliWood = GetComponent <Collider2D>();
        RigiWood  = GetComponent <Rigidbody2D>();
        MaxHP     = HP;
        GameCont  = GameObject.Find("GameManager").GetComponent <ScoreGM>();


        Up    = GameObject.Find("Sky").transform;
        Down  = GameObject.Find("Floor").transform;
        Left  = GameObject.Find("Border_L").transform;
        Right = GameObject.Find("Border_R").transform;

        MaxUp    = Up.position.y;
        MaxDown  = Down.position.y;
        MaxLeft  = Left.position.x;
        MaxRight = Right.position.x;
    }