Ejemplo n.º 1
0
    // Update is called once per frame
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            if (cameraturn == CameraTurn.Main)
            {
                cameraturn = CameraTurn.Sub;
            }
            else
            if (cameraturn == CameraTurn.Sub)
            {
                cameraturn = CameraTurn.Main;
            }
        }

        switch (cameraturn)
        {
        case CameraTurn.Main:

            Maincamera.camera.depth         = 1;
            subjectivitycamera.camera.depth = 0;
            break;

        case CameraTurn.Sub:
            Maincamera.camera.depth         = 0;
            subjectivitycamera.camera.depth = 1;
            break;
        }
    }
Ejemplo n.º 2
0
        async public void OnGameStart()
        {
            Debug.Log("[CameraService] Game Started");
            List <Vector3> cameraPos = playerService.GetCameraPositions();

            if (cameraPos.Count >= 2)
            {
                turn1Pos = cameraPos[0] + offset;
                turn2Pos = cameraPos[1] + offset;
                Debug.Log("[CameraService] Camera Pos1:" + cameraPos[0] +
                          " Camera Pos1:" + cameraPos[1]);
                //if (!playerService.IsCurrentPlayerTurn())
                //{
                //    Vector3 tempPos = turn1Pos;
                //    turn1Pos = turn2Pos;
                //    turn2Pos = turn1Pos;
                //}

                mainCamera.orthographicSize = 7f;
                //iTween.MoveTo(mainCamera.gameObject, turn2Pos, 0.2f);
                //await new WaitForSeconds(0.2f);
                iTween.MoveTo(mainCamera.gameObject, turn1Pos, 0.2f);
                currentTurn = CameraTurn.TURN1;
            }
            await new WaitForSeconds(0.2f);
        }
Ejemplo n.º 3
0
 void Start()
 {
     cameraTurn     = player.GetComponentInChildren <CameraTurn>();
     closedPosition = transform.position;
     openedPosition = closedPosition + movement;
     speed          = movement.magnitude / closeDelay;
     mySound        = GetComponent <AudioSource>();
 }
Ejemplo n.º 4
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     playerStamina = player.GetComponent<PlayerStamina>();
     ground = GameObject.FindGameObjectWithTag("ground");
     anim = GetComponent<Animator>();
     CameraTurn = GetComponent<CameraTurn>();
     ButtonTurn = GetComponent<ButtonTurn>();
 }
Ejemplo n.º 5
0
        async public void OnGameStart()
        {
            Vector3 cameraPosPlayer = _playerService.GetCameraPosition();
            Vector3 cameraPosNpc    = _npcService.GetCameraPosition();

            turnPlayerPos = cameraPosPlayer + offset;
            turnNpcPos    = cameraPosNpc + offset;
            mainCamera.orthographicSize = 10;
            iTween.MoveTo(mainCamera.gameObject, turnNpcPos, 1f);
            currentTurn = CameraTurn.TURN2;
            await new WaitForSeconds(3f);
            iTween.MoveTo(mainCamera.gameObject, turnPlayerPos, 1f);
        }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        if (GameObject.FindWithTag("scoreSystem").GetComponent <Score>().isGameOver() == true)
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene(7);
        }


        if (Input.GetKeyUp(KeyCode.UpArrow) && GameObject.Find("Main Camera").GetComponent <CameraTurn>().canThrow)
        {
            CameraTurn camClass = GameObject.Find("Main Camera").GetComponent <CameraTurn>() as CameraTurn;   //instantiate for cross script use

            //Food Thrown Sound
            audio.Play();

            Vector3 movement = food.transform.rotation * Vector3.forward;
            Vector3 startpos = food.transform.GetChild(0).position;                                     //initial food position
            Vector3 endpos   = customers[camClass.get_curr_obj()].transform.position + movement * 100f; //position of customer

            //food tossing algorithm
            float currTime = 0;

            currTime += Time.deltaTime;
            if (currTime > timeTaken)
            {
                currTime = timeTaken;
                //Debug.Log("currTime");
            }

            float perc = currTime / timeTaken;
            food.transform.position = Vector3.Lerp(startpos, endpos, perc);

            holdingFood = false;    //update player status
            GenRandom();
        }

        //trash can functionality
        if (Input.GetKeyUp(KeyCode.DownArrow))
        {
            Destroy(this.food);
            GenRandom();
        }

        if (inUse[this.food.tag] == false)
        {
            Destroy(this.food);
            GenRandom();
        }
    }
Ejemplo n.º 7
0
 async public void SwitchCamera()
 {
     if (currentTurn == CameraTurn.TURN2)
     {
         iTween.MoveTo(mainCamera.gameObject, turn2Pos, 0.2f);
         await new WaitForSeconds(0.2f);
         mainCamera.orthographicSize = 7f;
         currentTurn = CameraTurn.TURN1;
     }
     else if (currentTurn == CameraTurn.TURN1)
     {
         iTween.MoveTo(mainCamera.gameObject, turn1Pos, 0.2f);
         await new WaitForSeconds(0.2f);
         mainCamera.orthographicSize = 7f;
         currentTurn = CameraTurn.TURN2;
     }
 }
Ejemplo n.º 8
0
 async public void SwitchCamera()
 {
     if (currentTurn == CameraTurn.TURN2)
     {
         iTween.MoveTo(mainCamera.gameObject, turnNpcPos, 1f);
         await new WaitForSeconds(1.2f);
         mainCamera.orthographicSize = 10f;
         currentTurn = CameraTurn.TURN1;
     }
     else if (currentTurn == CameraTurn.TURN1)
     {
         iTween.MoveTo(mainCamera.gameObject, turnPlayerPos, 1f);
         await new WaitForSeconds(2f);
         mainCamera.orthographicSize = 10f;
         currentTurn = CameraTurn.TURN2;
     }
 }
Ejemplo n.º 9
0
        public static CameraDirection Turn(this CameraDirection direction, CameraTurn turn)
        {
            if (direction == CameraDirection.Up && turn == CameraTurn.Left)
            {
                return(CameraDirection.Left);
            }

            if (direction == CameraDirection.Up && turn == CameraTurn.Right)
            {
                return(CameraDirection.Right);
            }

            if (direction == CameraDirection.Right && turn == CameraTurn.Left)
            {
                return(CameraDirection.Up);
            }

            if (direction == CameraDirection.Right && turn == CameraTurn.Right)
            {
                return(CameraDirection.Down);
            }

            if (direction == CameraDirection.Down && turn == CameraTurn.Left)
            {
                return(CameraDirection.Right);
            }

            if (direction == CameraDirection.Down && turn == CameraTurn.Right)
            {
                return(CameraDirection.Left);
            }

            if (direction == CameraDirection.Left && turn == CameraTurn.Left)
            {
                return(CameraDirection.Down);
            }

            if (direction == CameraDirection.Left && turn == CameraTurn.Right)
            {
                return(CameraDirection.Up);
            }

            throw new System.Exception($"Unable to turn {turn} from {direction}");
        }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        ButtonTurn = GetComponent<ButtonTurn>();
        CameraTurn = GetComponent<CameraTurn>();
        animator = GetComponent<Animator>();
        capsule = GetComponent<CapsuleCollider>();
        //box = GetComponent<BoxCollider>();

        run = false;
        if(animator.layerCount >= 2)
        {
            animator.SetLayerWeight(1, 1);
        }
    }
Ejemplo n.º 11
0
 public void MoveCamera(CameraTurn turn)
 {
     _direction = _direction.Turn(turn);
     Position   = _direction.RePositionCamera(Position);
 }