예제 #1
0
    // Use this for initialization
    void Start()
    {
        var game = GameObject.FindGameObjectWithTag(Tags.Game);

        game_identity = GetComponent <GameIdentity>();

        UpdateTailColor();

        game_identity.EventIdSet += game_identity_EventIdSet;

        ownership_mgr = GameObject.FindGameObjectWithTag(Tags.Master).GetComponent <OwnershipMgr>();
    }
예제 #2
0
    private void AddScoreIndicator(GameObject ship)
    {
        // Instantiate and place in the correct position
        GameObject textPoint = (GameObject)GameObject.Instantiate(Resources.Load(pathPointsPrefab));

        textPoint.transform.parent        = gameObject.transform;
        textPoint.transform.localPosition = new Vector3(xOrigin + distanceBetweenScoresX * gameIdentityTextMeshes.Count, yOrigin, 0f);

        // Change color
        TextMesh     textMesh     = textPoint.GetComponent <TextMesh>();
        GameIdentity gameIdentity = ship.GetComponent <GameIdentity>();

        textMesh.color = gameIdentity.Color;

        // Retrieve points
        textMesh.text = string.Format("{0:0000}", gameIdentity.Score);

        // Attach event
        gameIdentity.EventScore += OnEventScore;
        gameIdentityTextMeshes.Add(gameIdentity, textMesh);
    }