void OnTriggerEnter2D(Collider2D collider)
    {
        // is it a coin?
        coinScript coin = collider.gameObject.GetComponent <coinScript>();

        if (coin != null)
        {
            _gm_.addScore(team, coin.value);
            gameObject.GetComponent <playerInfo>().coins += coin.value;
            StartCoroutine(CoinCoRoutine(coin));
        }
    }
    private IEnumerator CoinCoRoutine(coinScript coin)
    {
        // destroy the coin
        coin.gameObject.SetActive(false);
        if (coin.value == 1)
        {
            yield return(new WaitForSeconds(4));
        }
        if (coin.value == 2)
        {
            yield return(new WaitForSeconds(9));
        }
        if (coin.value == 5)
        {
            yield return(new WaitForSeconds(14));
        }
        SpecialEffectsHelper.Instance.NewCoin(coin.gameObject.transform.position);
        yield return(new WaitForSeconds(0.2f));

        coin.gameObject.SetActive(true);
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        lineTypes = GetComponent <LineTypes>();

        lineThickness = startThickness;
        scrollSpeed   = startSpeed;

        Vector3 lowerLeft  = mainCamera.ScreenToWorldPoint(new Vector3(0, 0, 0));
        Vector3 upperRight = mainCamera.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0));

        screenLeft   = lowerLeft.x;
        screenRight  = upperRight.x;
        screenTop    = upperRight.y;
        screenBottom = lowerLeft.y;
        screenWidth  = Mathf.Abs(screenRight - screenLeft);
        screenHeight = Mathf.Abs(screenTop - screenBottom);

        createLine(lineTypes.straightLine(new Vector3(0, screenBottom, 0), new Vector3(0, screenBottom + screenHeight * 2, 0)), lineThickness);

        coinGenerator = coinGen.GetComponent <coinScript>();
    }
	// Use this for initialization
	void Start () {
		//testItem = gameObject.GetComponent<ChildScript>();
		testItem = GameObject.FindGameObjectWithTag("cBlock").GetComponentInChildren<ChildScript2>();
		stop = GameObject.FindGameObjectWithTag ("cBlock").GetComponentInChildren<coinScript> ();
		
	}
 // Use this for initialization
 void Start()
 {
     //testItem = gameObject.GetComponent<ChildScript>();
     testItem = GameObject.FindGameObjectWithTag("cBlock").GetComponentInChildren <ChildScript2>();
     stop     = GameObject.FindGameObjectWithTag("cBlock").GetComponentInChildren <coinScript> ();
 }