Esempio n. 1
0
    /// <summary>
    /// Create a text mesh at given position
    /// </summary>
    /// <param name="pos"></param>
    /// <param name="bonusScore"></param>
    public void CreateTextMesh(Vector3 pos, int bonusScore)
    {
        TextMeshController textMeshControl = GetTextMeshControl();

        textMeshControl.transform.position = pos;
        textMeshControl.gameObject.SetActive(true);
        textMeshControl.SetScoreAndMoveUp(bonusScore, textMeshMovingUpSpeed);
    }
Esempio n. 2
0
 protected void AttachTextMeshController(string message, Color color)
 {
     if (textMeshController != null)
     {
         Destroy(textMeshController.gameObject);
     }
     textMeshController = ResourceManager.CreateWorldMessage(new Vector3(transform.position.x, transform.position.y + 1.5f, transform.position.z), message, color, 36);
     textMeshController.transform.parent = transform;
 }
 void InitalizeMesh()
 {
     mesh = gameObject.GetComponent<TextMesh>();
     if (mesh == null)
     {
         mesh = gameObject.AddComponent<TextMesh>();
     }
     controller = gameObject.GetComponent<TextMeshController>();
     if (controller == null)
     {
         controller = gameObject.AddComponent<TextMeshController>();
     }
 }
Esempio n. 4
0
 public void Jam()
 {
     if (Target != null && Target.activeSelf && SecondaryWeapon != null)
     {
         FireSecondaryWeapon();
         Die();
     }
     else
     {
         Jammed            = true;
         JamTargetPosition = new Vector3(Random.Range(-200f, 200f), Random.Range(-200f, 200f), Random.Range(-200f, 200f)) + transform.position;
         TextMeshController popupObject = ResourceManager.CreateWorldMessage(transform.position, "Jammed", Color.red, 18);
         popupObject.transform.parent = transform;
     }
 }
Esempio n. 5
0
    //Get an inactive TextMeshControl
    private TextMeshController GetTextMeshControl()
    {
        //Find in the list
        foreach (TextMeshController o in listTextMeshControl)
        {
            if (!o.gameObject.activeInHierarchy)
            {
                return(o);
            }
        }

        //Didn't find one -> create new one
        TextMeshController textMeshControl = Instantiate(textMeshPrefab, Vector3.zero, Quaternion.identity).GetComponent <TextMeshController>();

        textMeshControl.gameObject.SetActive(false);
        listTextMeshControl.Add(textMeshControl);
        return(textMeshControl);
    }
Esempio n. 6
0
    // --- START ---
    private void Start()
    {
        Scores.Instance.NeverMind();
        scores       = FindObjectOfType <Scores>();
        particles    = FindObjectOfType <ParticleSystem>();
        theBall      = FindObjectOfType <Ball>();
        theClub      = FindObjectOfType <Club>();
        tmController = FindObjectOfType <TextMeshController>();

        audioSource    = GetComponent <AudioSource>();
        shotCount      = 0;
        goalAt7thSwing = false;
        courseIndex    = SceneManager.GetActiveScene().buildIndex;

        // So player can continue from this course between sessions
        if (SceneManager.GetActiveScene().name != "Scoreboard")
        {
            PlayerPrefs.SetInt("lastPlayedCourse", courseIndex);
        }
    }