// Use this for initialization
    void Start()
    {
        //Set the Snake Movement
        SM = GameObject.FindGameObjectWithTag("TAG_4").GetComponent <SnakeMovement_25>();

        //Spawn the initial Food
        SpawnFood();
    }
    // Use this for initialization
    void Start()
    {
        SM = GameObject.FindGameObjectWithTag("TAG_4").GetComponent <SnakeMovement_25>();

        foodAmount = Random.Range(1, 8);

        transform.GetComponentInChildren <TextMesh>().text = "" + foodAmount;
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        //Set the box size depending on the resolution
        SetBoxSize();

        //Set the Snake Movement
        SM = GameObject.FindGameObjectWithTag("TAG_4").GetComponent <SnakeMovement_25>();



        //Initialize the amount of lives

        if (transform.tag == "TAG_1")
        {
            life = Random.Range(1, SM.BodyParts.Count + 2);
            transform.GetChild(4).gameObject.SetActive(false);
            transform.GetChild(5).gameObject.SetActive(false);
        }


        if (transform.tag == "TAG_5")
        {
            life = Random.Range(10, 60);
            transform.GetChild(4).gameObject.SetActive(false);
            transform.GetChild(5).gameObject.SetActive(false);
        }
        if (transform.tag == "TAG_6")
        {
            life = Random.Range(15, SM.BodyParts.Count + 5);
            transform.GetChild(4).gameObject.SetActive(true);
            transform.GetChild(5).gameObject.SetActive(false);
        }
        if (transform.tag == "TAG_8")
        {
            life = Random.Range(15, SM.BodyParts.Count + 5);
            transform.GetChild(5).gameObject.SetActive(true);
            transform.GetChild(4).gameObject.SetActive(false);
        }


        lifeForColor = life;

        //Initialize this text Mesh
        thisTextMesh      = GetComponentInChildren <TextMesh>();
        thisTextMesh.text = "" + life;



        //Set the color of the box depending on the life
        SetBoxColor();

        //Values to fix the position of the block
        initialPos = transform.position;
        dontMove   = false;
    }
Example #4
0
    public void BlockUpdate()
    {
        //Initialize the amount of lives
        SM = GameObject.FindGameObjectWithTag("TAG_4").GetComponent <SnakeMovement_25>();

        if (transform.tag == "TAG_1")
        {
            life = Random.Range(1, SM.BodyParts.Count + 2);
            transform.GetChild(4).gameObject.SetActive(false);
            transform.GetChild(5).gameObject.SetActive(false);
        }


        if (transform.tag == "TAG_5")
        {
            life = Random.Range(10, 60);
            transform.GetChild(4).gameObject.SetActive(false);
            transform.GetChild(5).gameObject.SetActive(false);
        }
        if (transform.tag == "TAG_6")
        {
            life = Random.Range(15, SM.BodyParts.Count + 5);
            transform.GetChild(4).gameObject.SetActive(true);
            transform.GetChild(5).gameObject.SetActive(false);
        }
        if (transform.tag == "TAG_8")
        {
            life = Random.Range(15, SM.BodyParts.Count + 5);
            transform.GetChild(5).gameObject.SetActive(true);
            transform.GetChild(4).gameObject.SetActive(false);
        }


        lifeForColor = life;

        //Initialize this text Mesh
        thisTextMesh      = GetComponentInChildren <TextMesh>();
        thisTextMesh.text = "" + life;

        SetBoxColor();
    }
Example #5
0
    // Use this for initialization

    void Start()
    {
        SM = transform.GetComponentInParent <SnakeMovement_25>();
    }