示例#1
0
    void ChangeTurnToCylinder()
    {
        foreach (GameObject simple_Plane2 in plane)
        {
            MatricalTerrain scr   = simple_Plane2.GetComponent <MatricalTerrain>();
            Renderer        rend  = scr.GetComponent <Renderer>();
            Vector3         s     = new Vector3(simple_Plane2.transform.position.x, simple_Plane2.transform.position.y + 13.4f, simple_Plane2.transform.position.z);
            Vector3         s_Min = new Vector3(simple_Plane2.transform.position.x, simple_Plane2.transform.position.y + 13.4f, simple_Plane2.transform.position.z + 50f);

            if (rend.material.color == new Color(0, 255, 0, 10))
            {
                if (movement_Cylinder == 2)
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        if ((s != transform.position) &&
                            (s != cylinder.transform.position) &&
                            (s != sphere.transform.position) &&
                            (s != minotaur.transform.position))
                        {
                            if ((Mathf.Abs((Mathf.Abs(cylinder.transform.position.x) - (Mathf.Abs(simple_Plane2.transform.position.x)))) < movement_Cylinder * 50) &&
                                (Mathf.Abs((Mathf.Abs(cylinder.transform.position.z) - (Mathf.Abs(simple_Plane2.transform.position.z)))) < movement_Cylinder * 50))
                            {
                                do
                                {
                                    cylinder.transform.position = Vector3.MoveTowards(cylinder.transform.position, s, speed * Time.deltaTime);
                                }while(cylinder.transform.position != s);
                            }
                            //ChangeTurnToMinotaur();
                            movement_Cylinder = 0;

                            movement_Minotaur = 4;
                        }
                        else if (minotaur.transform.position == s)
                        {
                            if ((Mathf.Abs((Mathf.Abs(cylinder.transform.position.x) - (Mathf.Abs(simple_Plane2.transform.position.x)))) < movement_Cylinder * 50) &&
                                (Mathf.Abs((Mathf.Abs(cylinder.transform.position.z) - (Mathf.Abs(simple_Plane2.transform.position.z)))) < movement_Cylinder * 50))
                            {
                                if (Input.GetMouseButtonDown(0))
                                {
                                    foreach (GameObject simple_Plane_Cylinder in plane)
                                    {
                                        Vector3 s_Min1   = new Vector3(simple_Plane_Cylinder.transform.position.x, simple_Plane_Cylinder.transform.position.y + 13.4f, simple_Plane_Cylinder.transform.position.z);
                                        Vector3 distance = s_Min - s;
                                        if (Mathf.Abs(distance.magnitude) <= 72f)
                                        {
                                            MatricalTerrain scr2  = simple_Plane_Cylinder.GetComponent <MatricalTerrain>();
                                            Renderer        rend2 = scr2.GetComponent <Renderer>();
                                            rend2.material.color = Color.yellow;
                                            if (Input.GetMouseButtonDown(0))
                                            {
                                                if (Mathf.Abs((minotaur.transform.position - cylinder.transform.position).magnitude) <= 72f)
                                                {
                                                    do
                                                    {
                                                        cylinder.transform.position = Vector3.MoveTowards(cylinder.transform.position, s_Min1, speed * Time.deltaTime);
                                                    }while(cylinder.transform.position != s_Min1);
                                                    movement_Cylinder = 0;
                                                    movement_Minotaur = 4;
                                                }
                                            }


                                            if (hp_cylinder <= 0)
                                            {
                                                Destroy(cylinder);
                                                ChangeTurnToMinotaur();
                                            }
                                        }
                                    }
                                    hp_cylinder = hp_cylinder - 8;
                                    hp_minotaur = hp_minotaur - 20;
                                    Debug.Log("Cylinder: -8hp; Minotaur: -20hp");
                                    if (hp_minotaur <= 0)
                                    {
                                        SceneManager.LoadScene("Win");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
示例#2
0
    // Update is called once per frame
    void ChangeTurnToCube()
    {
        foreach (GameObject simple_Plane in plane)
        {
            MatricalTerrain scr  = simple_Plane.GetComponent <MatricalTerrain>();
            Renderer        rend = scr.GetComponent <Renderer>();
            Vector3         s    = new Vector3(simple_Plane.transform.position.x, simple_Plane.transform.position.y + 13.4f, simple_Plane.transform.position.z);


            if (rend.material.color == new Color(0, 255, 0, 10))
            {
                if (movement_Cube == 3)
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        if ((s != sphere.transform.position) &&
                            (s != cylinder.transform.position) &&
                            (s != transform.position) &&
                            (s != minotaur.transform.position))
                        {
                            if ((Mathf.Abs((Mathf.Abs(gameObject.transform.position.x) - (Mathf.Abs(simple_Plane.transform.position.x)))) < movement_Cube * 50) &&
                                (Mathf.Abs((Mathf.Abs(gameObject.transform.position.z) - (Mathf.Abs(simple_Plane.transform.position.z)))) < movement_Cube * 50))
                            {
                                do
                                {
                                    transform.position = Vector3.MoveTowards(transform.position, s, speed * Time.deltaTime);
                                }while(transform.position != s);
                            }
                            movement_Cube   = 0;
                            movement_Sphere = 5;
                        }
                        else if (minotaur.transform.position == s)
                        {
                            if ((Mathf.Abs((Mathf.Abs(gameObject.transform.position.x) - (Mathf.Abs(simple_Plane.transform.position.x)))) < movement_Cube * 50) &&
                                (Mathf.Abs((Mathf.Abs(gameObject.transform.position.z) - (Mathf.Abs(simple_Plane.transform.position.z)))) < movement_Cube * 50))
                            {
                                //if(Input.GetMouseButtonDown(0))
                                // {
                                foreach (GameObject simple_Plane_Cube in plane)
                                {
                                    Vector3 s_Min    = new Vector3(simple_Plane_Cube.transform.position.x, simple_Plane_Cube.transform.position.y + 13.4f, simple_Plane_Cube.transform.position.z);
                                    Vector3 distance = s_Min - s;
                                    Vector3 ss       = new Vector3(minotaur.transform.position.x, minotaur.transform.position.y, minotaur.transform.position.z + 50f);
                                    if (Mathf.Abs(distance.magnitude) <= 72f)
                                    {
                                        MatricalTerrain scr1  = simple_Plane_Cube.GetComponent <MatricalTerrain>();
                                        Renderer        rend1 = scr1.GetComponent <Renderer>();
                                        rend1.material.color = Color.yellow;
                                        if (Input.GetMouseButtonDown(0))
                                        {
                                            if (Mathf.Abs((minotaur.transform.position - transform.position).magnitude) == 50f)
                                            {
                                                if (Input.GetMouseButtonDown(0))
                                                {
                                                    do
                                                    {
                                                        transform.position = Vector3.MoveTowards(transform.position, ss, speed * Time.deltaTime);
                                                    }while(transform.position != ss);
                                                    movement_Cube   = 0;
                                                    movement_Sphere = 5;
                                                }
                                            }
                                        }
                                        if (hp_cube <= 0)
                                        {
                                            Destroy(gameObject);
                                            ChangeTurnToSphere();
                                        }
                                    }
                                }
                                hp_cube     = hp_cube - 8;
                                hp_minotaur = hp_minotaur - 30;
                                Debug.Log("Cube: -8hp; Minotaur: - 30hp");
                                if (hp_minotaur <= 0)
                                {
                                    SceneManager.LoadScene("Win");
                                }
                                // }
                            }
                        }
                    }
                }
            }
        }
    }
示例#3
0
    void ChangeTurnToSphere()
    {
        foreach (GameObject simple_Plane1 in plane)
        {
            MatricalTerrain scr1 = simple_Plane1.GetComponent <MatricalTerrain>();
            Renderer        rend = scr1.GetComponent <Renderer>();
            Vector3         s1   = new Vector3(simple_Plane1.transform.position.x, simple_Plane1.transform.position.y + 13.4f, simple_Plane1.transform.position.z);

            if (rend.material.color == new Color(0, 255, 0, 10))
            {
                if (movement_Sphere == 5)
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        if ((s1 != transform.position) &&
                            (s1 != cylinder.transform.position) &&
                            (s1 != sphere.transform.position) &&
                            (s1 != minotaur.transform.position))
                        {
                            if ((Mathf.Abs(((Mathf.Abs(sphere.transform.position.x)) - (Mathf.Abs(simple_Plane1.transform.position.x)))) < movement_Sphere * 50) &&
                                (Mathf.Abs(((Mathf.Abs(sphere.transform.position.z)) - (Mathf.Abs(simple_Plane1.transform.position.z)))) < movement_Sphere * 50))
                            {
                                do
                                {
                                    sphere.transform.position = Vector3.MoveTowards(sphere.transform.position, s1, speed * Time.deltaTime);
                                }while(sphere.transform.position != s1);
                            }
                            //ChangeTurnToCylinder();
                            movement_Cylinder = 2;
                            movement_Sphere   = 0;
                        }
                        else if (minotaur.transform.position == s1)
                        {
                            if ((Mathf.Abs((Mathf.Abs(sphere.transform.position.x) - (Mathf.Abs(simple_Plane1.transform.position.x)))) < movement_Sphere * 50) &&
                                (Mathf.Abs((Mathf.Abs(sphere.transform.position.z) - (Mathf.Abs(simple_Plane1.transform.position.z)))) < movement_Sphere * 50))
                            {
                                if (Input.GetMouseButtonDown(0))
                                {
                                    foreach (GameObject simple_Plane_Sphere in plane)
                                    {
                                        Vector3 s_Min    = new Vector3(simple_Plane_Sphere.transform.position.x, simple_Plane_Sphere.transform.position.y + 13.4f, simple_Plane_Sphere.transform.position.z);
                                        Vector3 distance = s_Min - s1;
                                        if (Mathf.Abs(distance.magnitude) <= 72f)
                                        {
                                            MatricalTerrain scr2  = simple_Plane_Sphere.GetComponent <MatricalTerrain>();
                                            Renderer        rend2 = scr2.GetComponent <Renderer>();
                                            rend2.material.color = Color.yellow;
                                            if (Input.GetMouseButtonDown(0))
                                            {
                                                if (Mathf.Abs((minotaur.transform.position - sphere.transform.position).magnitude) <= 72f)
                                                {
                                                    do
                                                    {
                                                        sphere.transform.position = Vector3.MoveTowards(sphere.transform.position, s_Min, speed * Time.deltaTime);
                                                    }while(sphere.transform.position != s_Min);
                                                    movement_Sphere   = 0;
                                                    movement_Cylinder = 2;
                                                }
                                            }


                                            if (hp_sphere <= 0)
                                            {
                                                Destroy(sphere);
                                                ChangeTurnToCylinder();
                                            }
                                        }
                                    }
                                    hp_sphere   = hp_sphere - 8;
                                    hp_minotaur = hp_minotaur - 25;
                                    Debug.Log("Sphere: -8hp; Minotaur: -25hp");
                                    if (hp_minotaur <= 0)
                                    {
                                        SceneManager.LoadScene("Win");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            //ChangeTurnToCylinder();
        }
    }