Ejemplo n.º 1
0
    void Start()
    {
        swipe_obj = transform.GetComponent <swipe> ();

        // pick a random direction to start game
        int snake_rand_rotation = Rotation_list [Random.Range(0, Rotation_list.Length)];

        if (snake_rand_rotation == 0)
        {
            Dir = direction.Up;
            transform.eulerAngles = new Vector3(0, 0, 0);
        }

        if (snake_rand_rotation == 90)
        {
            Dir = direction.Righ;
            transform.eulerAngles = new Vector3(0, 90, 0);
        }

        if (snake_rand_rotation == 180)
        {
            Dir = direction.Down;
            transform.eulerAngles = new Vector3(0, 180, 0);
        }

        if (snake_rand_rotation == 270)
        {
            Dir = direction.Left;
            transform.eulerAngles = new Vector3(0, 270, 0);
        }

        snake_head = body_list [0];
    }
Ejemplo n.º 2
0
    void toggleSetPath()
    {
        swipe pathSwipe = GetComponent <swipe>();

        pathSwipe.setPath             = true;
        pathSwipe.previousPoint       = selectedShip.transform.position;
        pathSwipe.currentPathAnimator = selectedShip.GetComponent <pathAnimator>();
        waitingUnclick = false;
    }
Ejemplo n.º 3
0
    void Start()
    {
        //Disable everything before game starts
        M         = GameObject.Find("character").GetComponent <Movement> ();
        M.enabled = false;

        pc         = GameObject.Find("Main Camera").GetComponent <PlayerCamera> ();
        pc.enabled = false;

        S         = GameObject.Find("character").GetComponent <swipe> ();
        S.enabled = false;

        E         = GameObject.Find("platform").GetComponent <Endless> ();
        E.enabled = false;

        E1         = GameObject.Find("Cube1").GetComponent <Endless> ();
        E1.enabled = false;

        E2         = GameObject.Find("Cube2").GetComponent <Endless> ();
        E2.enabled = false;

        E3         = GameObject.Find("Death").GetComponent <Endless> ();
        E3.enabled = false;

        r         = GameObject.Find("GameOver").GetComponent <restart> ();
        r.enabled = false;

        tt         = GameObject.Find("misc").GetComponent <Timer> ();
        tt.enabled = false;

        TapToStart     = GameObject.Find("Button");
        Gear           = GameObject.Find("Button1");
        GameOverScreen = GameObject.Find("GameOver");
        SelectScreen   = GameObject.Find("CSS");
        Score          = GameObject.Find("Score");
        BestScore      = GameObject.Find("Best");

        GameOverScreen.SetActive(false);
        SelectScreen.SetActive(false);
        Score.SetActive(false);
    }
Ejemplo n.º 4
0
    void Start()
    {
        swipe_obj = transform.GetComponent <swipe> ();

        int snake_rand_rotation = Rotation_list [Random.Range(0, Rotation_list.Length)];

        //print (snake_rand_rotation);
        if (snake_rand_rotation == 0)
        {
            Dir = direction.Up;
            transform.eulerAngles = new Vector3(0, 0, 0);
        }

        if (snake_rand_rotation == 90)
        {
            Dir = direction.Righ;
            transform.eulerAngles = new Vector3(0, 90, 0);
        }

        if (snake_rand_rotation == 180)
        {
            Dir = direction.Down;
            transform.eulerAngles = new Vector3(0, 180, 0);
        }

        if (snake_rand_rotation == 270)
        {
            Dir = direction.Left;
            transform.eulerAngles = new Vector3(0, 270, 0);
        }


        for (int i = 0; i < begain_size - 1; i++)
        {
            add_bodypart();
        }
    }