示例#1
0
    IEnumerator interuptPath()
    {
        path.PausePath();
        path.points = new List <CPC_Point>();
        CPC_Point start;


        if (color == Color.red || color == Color.green)
        {
            StopCoroutine(running);
        }
        start = new CPC_Point(main.GetComponent <Camera>().transform.position, main.GetComponent <Camera>().transform.rotation);

        path.points.Add(start);
        path.points.Add(robot);
        path.SetCurrentTimeInWaypoint(0);
        path.SetCurrentWayPoint(0);
        path.looped = false;
        path.UpdateTimeInSeconds(1);
        path.ResumePath();
        yield return(new WaitForSeconds(1));

        path.points = new List <CPC_Point>();
        main.GetComponent <cameraCollision>().focus      = false;
        player.GetComponent <PlayerController>().canMove = true;
    }
示例#2
0
    public void green()
    {
        if (color == Color.green && bridge)
        {
            path.points = new List <CPC_Point>();
            CPC_Point start = new CPC_Point(main.GetComponent <Camera>().transform.position, main.GetComponent <Camera>().transform.rotation);
            path.points.Add(start);
            robot = start;
            Camera    bridgeCam = bridge.GetComponent <Camera>();
            CPC_Point end       = new CPC_Point(bridgeCam.transform.position, bridgeCam.transform.rotation);
            path.points.Add(end);
            path.looped = true;
            path.PlayPath(6);

            StartCoroutine(buildBridge());
            running = StartCoroutine(cameraPathGreen());
        }
        Icon.GetComponent <Image>().color  = Color.white;
        Icon.GetComponent <Image>().sprite = Icon.plateform;

        Material m = transform.gameObject.GetComponent <Renderer>().material;

        m.SetColor("_EmissionColor", Color.green);
        EngineAbility.color = Color.green;
        Ability.color       = Color.green;
        Ability.text        = "Build";
    }
示例#3
0
    IEnumerator cameraPathRed()
    {
        playing = true;
        yield return(new WaitForSeconds(3));

        path.points = new List <CPC_Point>();
        CPC_Point newPos = new CPC_Point(floatCamera.transform.position, floatCamera.transform.rotation);

        path.points.Add(newPos);
        robot.position = player.transform.position - off;
        yield return(new WaitForSeconds(0.1f));

        if (ps.y - player.transform.position.y > 0.01)
        {
            robot.position += new Vector3(0, -16, 0);
        }
        else if (ps.y - player.transform.position.y < -0.01)
        {
            robot.position += new Vector3(0, 16, 0);
        }
        path.points.Add(robot);
        path.PlayPath(3);
        yield return(new WaitForSeconds(3));

        playing = false;
        player.GetComponent <PlayerController>().msgDispTimer = 0;
        main.GetComponent <cameraCollision>().focus           = false;
        player.GetComponent <PlayerController>().canMove      = true;
    }
示例#4
0
    public void blue()
    {
        if (color == Color.blue && yellowbox1 && yellowbox2)
        {
            path.points = new List <CPC_Point>();
            CPC_Point start = new CPC_Point(main.GetComponent <Camera>().transform.position, main.GetComponent <Camera>().transform.rotation);
            path.points.Add(start);
            robot = start;
            GameObject temp1 = new GameObject();
            temp1.transform.position = yellowbox1.transform.position + 25 * yellowbox1.transform.TransformDirection(Vector3.up) + new Vector3(0, 0, 30);
            temp1.transform.LookAt(yellowbox1.transform.position + new Vector3(0, 15, 0));
            path.points.Add(new CPC_Point(temp1.transform.position, temp1.transform.rotation));

            temp1.transform.position = yellowbox2.transform.position + 25 * yellowbox2.transform.TransformDirection(Vector3.up) + new Vector3(0, 0, 30);
            temp1.transform.LookAt(yellowbox2.transform.position + new Vector3(0, 15, 0));
            path.points.Add(new CPC_Point(temp1.transform.position, temp1.transform.rotation));
            path.looped = true;
            path.PlayPath(7.5f);
            //slideDoors(true);
            StartCoroutine(buildTele(temp1));
            StartCoroutine(cameraPathBlue());
        }
        Icon.GetComponent <Image>().color  = Color.white;
        Icon.GetComponent <Image>().sprite = Icon.Teleport;

        Material m = transform.gameObject.GetComponent <Renderer>().material;

        m.SetColor("_EmissionColor", Name.blue);
        EngineAbility.color = Name.blue;
        Ability.color       = Name.blue;
        Ability.text        = "Portal";
    }
示例#5
0
    public void red()
    {
        if (color == Color.red && objectToFloat)
        {
            if (objectToFloat.transform.childCount <= 0)
            {
                return;
            }
            path.points = new List <CPC_Point>();
            ps          = player.transform.position;
            CPC_Point start = new CPC_Point(main.GetComponent <Camera>().transform.position, main.GetComponent <Camera>().transform.rotation);
            path.points.Add(start);
            robot = start;
            off   = player.transform.position - main.GetComponent <Camera>().transform.position;
            CPC_Point end = new CPC_Point(floatCamera.transform.position, floatCamera.transform.rotation);
            path.points.Add(end);
            path.looped = false;
            player.GetComponent <PlayerController>().canMove = false;

            main.GetComponent <cameraCollision>().focus = true;
            path.PlayPath(3);

            StartCoroutine(startFloat());
            running = StartCoroutine(cameraPathRed());

            Icon.GetComponent <Image>().color  = Color.white;
            Icon.GetComponent <Image>().sprite = Icon.Float;
        }

        Material m = transform.gameObject.GetComponent <Renderer>().material;

        m.SetColor("_EmissionColor", Color.red);
        EngineAbility.color = Color.red;
        Ability.color       = Color.red;
        Ability.text        = "Float";
    }