// Use this for initialization
 void Start()
 {
     camMovementScript         = Camera.main.GetComponentInParent <CamMovement>();
     camMovementScript.enabled = false;
     currentList = dialogList;
     showDialog();
 }
Exemple #2
0
    public static void UseCam(Camera cam)
    {
        bool foundCam = false;
        int  indexer  = 0;

        foreach (Camera c in cameras)
        {
            if (c == cam)
            {
                c.gameObject.SetActive(true);
                currentCameraIndex = indexer;
                foundCam           = true;
                currentCamMovement = GetCurrentCameraMover();
            }

            else
            {
                c.gameObject.SetActive(false);
            }
            indexer++;
        }

        if (!foundCam)
        {
            throw new System.ArgumentException("Could not find camera: " + cam.gameObject.name);
        }
        return;
    }
Exemple #3
0
    void Start()
    {
        GameObject cam = GameObject.FindGameObjectWithTag("MainCamera");

        CamMovement camMove = cam.GetComponent <CamMovement>();

        camMove.player = gameObject;
    }
Exemple #4
0
    // Start is called before the first frame update
    void Start()
    {
        this.camMovement = cameraContainer.GetComponent <CamMovement>();

        CreateRotateGesture();
        CreateScaleGesture();
        CreateTapGesture();
        CreatePanGesture();
    }
Exemple #5
0
    void Shoot()
    {
        SpriteRenderer temp = Instantiate(bullet, sightDirection.Find("Cannon").position, sightDirection.rotation).GetComponent <SpriteRenderer>();

        temp.color = spriteRenderer.color;
        Destroy(temp.gameObject, 2);

        CamMovement cam = Camera.main.GetComponent <CamMovement>();

        cam.speed            = 25;
        cam.impulseDirection = sightDirection.up;
    }
Exemple #6
0
 public void ChangeNextCam_()
 {
     cameras[currentCameraIndex].gameObject.SetActive(false);
     currentCameraIndex++;
     if (currentCameraIndex >= cameras.Count)
     {
         currentCameraIndex = 0;
     }
     cameras[currentCameraIndex].gameObject.SetActive(true);
     currentCamMovement = GetCurrentCameraMover();
     UpdateTextUI();
 }
Exemple #7
0
 public static void ChangeNextCam()
 {
     cameras[currentCameraIndex].gameObject.SetActive(false);
     currentCameraIndex++;
     if (currentCameraIndex >= cameras.Count)
     {
         currentCameraIndex = 0;
     }
     cameras[currentCameraIndex].gameObject.SetActive(true);
     currentCamMovement = GetCurrentCameraMover();
     UpdateTextUI();
     Debug.Log("Changing camera to " + cameras[currentCameraIndex].transform.root.gameObject.name);
 }
Exemple #8
0
    void Start()
    {
        GameObject cam = GameObject.FindGameObjectWithTag("MainCamera");

        CamMovement camMove = cam.GetComponent <CamMovement>();

        camMove.player = gameObject;

        m = gameObject.GetComponent <Movement>();

        m.canMoveUp    = true;
        m.canMoveDown  = true;
        m.canMoveLeft  = true;
        m.canMoveRight = true;
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        CamMovement camMove = cam.GetComponent <CamMovement>();

        if (stop)
        {
            camMove.enabled = false;
        }
        else
        {
            if (camMove.enabled == false)
            {
                camMove.enabled = true;
            }
        }
    }
    void Death()
    {
        StopCoroutine(Bandage());
        Debug.Log("player died");
        alive = false;
        transform.GetComponent <PhotonView>().RPC("setMouseDeath", PhotonTargets.AllBuffered);
        alive = false;
        GetComponent <MouseMovement>().enabled = false;
        CamMovement cam = gameObject.GetComponentInChildren <CamMovement>();

        cam.enabled = false;
        transform.GetComponent <PhotonView>().RPC("PlayAnim", PhotonTargets.All, "Unarmed-Death1");
        GetComponent <MouseMovement>().enabled = false;
        WaitForAnimation(5f);
        transform.GetComponent <PhotonView>().RPC("respawn", PhotonTargets.AllBuffered);
    }
    IEnumerator respawn()
    {
        yield return(new WaitForSeconds(spawnDelay));

        //spawns at random mouse spawn location
        SpawnM mys = sm[Random.Range(0, 2)];

        transform.position = mys.transform.position;
        transform.rotation = mys.transform.rotation;
        //enable movement and cam movement again
        alive         = true;
        currentHealth = maxHealth;
        GetComponent <MouseMovement>().enabled = true;
        CamMovement cam = gameObject.GetComponentInChildren <CamMovement>();

        cam.enabled = true;
        transform.GetComponent <PhotonView>().RPC("PlayAnim", PhotonTargets.All, "Unarmed-Idle");
    }
Exemple #12
0
    private IEnumerator ApplyMovement(CamMovement cm)
    {
        float l = (cm.startPos.magnitude + cm.newPos.magnitude) / 2f;

        for (float i = 0; i < cm.duration; i += Time.deltaTime)
        {
            Vector3 nPos = Vector3.Lerp(cm.startPos, cm.newPos, i / cm.duration);

            if (cm.smooth)
            {
                transform.position = new Vector3(nPos.normalized.x * l, nPos.y, nPos.normalized.z * l);
            }
            else
            {
                transform.position = nPos;
            }
            transform.LookAt(Vector3.Lerp(cm.startGaze, cm.newGaze, i / cm.duration));
            yield return(new WaitForEndOfFrame());
        }
        transform.position = cm.newPos;
        transform.LookAt(cm.newGaze);

        transformInAction = false;
    }
Exemple #13
0
 void Start()
 {
     cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CamMovement>();
 }
Exemple #14
0
 // Start is called before the first frame update
 void Start()
 {
     cam = Camera.main.GetComponent <CamMovement>();
 }
 public void Start()
 {
     camMovementScript     = cameraContainer.GetComponent <CamMovement>();
     initialCameraPosition = cameraContainer.position;
 }