Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 void Start()
 {
     playerManager = GameObject.FindGameObjectWithTag("Manager");
     DV = playerManager.GetComponent<DynamicVariables>();
     cameraScript = transform.parent.GetComponentInChildren<CameraMovement>();
     playerScript = transform.parent.GetComponentInChildren<PlayerMovement>();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     cameraScript = cameraObject.GetComponent<CameraMovement>();
     kmCameraScript = kmCameraObject.GetComponent<CameraMovement>();
     orbitScript = rotateObject.GetComponent<Orbit>();
     timerText.text = timeLeft.ToString("0.00");
     timerScreen.SetActive(false);
 }
Ejemplo n.º 3
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(ScriptTags.player);
     playerAnim = player.GetComponent<Animator>();
     hash = GameObject.FindGameObjectWithTag(ScriptTags.gameController).GetComponent<HashIDs>();
     camMovement = Camera.main.gameObject.GetComponent<CameraMovement>();
     sceneFadeInOut = GameObject.FindGameObjectWithTag(ScriptTags.fader).GetComponent<SceneFadeInOut>();
     liftDoorsTracking = GetComponent<liftDoorsTracking>();
 }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        m_Transform = GetComponent<Transform>();
        m_Rigidbody = GetComponent<Rigidbody2D>();
        CameraPositions = Camera.main.GetComponent<CameraMovement>();

        Vector3 dir = Quaternion.AngleAxis(m_Transform.rotation.eulerAngles.z, Vector3.forward) * Vector3.right;
        m_Rigidbody.AddForce(dir * force);
    }
Ejemplo n.º 5
0
 void Start()
 {
     _inputToggle    = GetComponent<ToggleEnableInput>();
     _attack         = GetComponent<PlayerAttack>();
     _block          = GetComponent<PlayerBlock>();
     _movement       = GetComponent<PlayerMovement>();
     _rotation       = GameObject.Find("CameraController").GetComponent<CameraMovement>();
     _dodge          = GetComponent<PlayerRoll>();
 }
Ejemplo n.º 6
0
    protected override void Awake()
    {
        base.Awake();
        m_hatch = GetComponent<DropHatch>();

        GameObject go = GameObject.Find("Input Handler");
        m_inputHandler = go.GetComponent<InputHandler>();

        m_cam = Camera.main.GetComponent<CameraMovement>();
    }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        m_CameraPosition = Camera.main.GetComponent<CameraMovement> ();
        Boss = GameObject.FindGameObjectWithTag ("Boss");
        Enemy = GameObject.FindGameObjectsWithTag ("Enemy");

        m_PlayerMovimentacao = GameObject.FindGameObjectWithTag ("Player").GetComponent<Transform> ();
        m_CameraMovimentacao = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Transform> ();
        //MoveFront = new Vector3(m_scrollvelocity, 0, 0);
    }
Ejemplo n.º 8
0
 void Awake()
 {
     // Setting up references.
     player = GameObject.Find("N40");
     playerAnim = player.GetComponent<Animator>();
     playerKey = player.GetComponent<PlayerKey>();
     camMovement = Camera.main.gameObject.GetComponent<CameraMovement>();
     sf = GameObject.Find("ScreenFader").GetComponent<ScreenFader>();
     endMenu = GameObject.Find("EndScreen").GetComponent<EndMenuScreen>();
 }
Ejemplo n.º 9
0
 void Start()
 {
     source = GetComponent<AudioSource>();
     cameraScript = cameraObject.GetComponent<CameraMovement>();
     kmCameraScript = kmCameraObject.GetComponent<CameraMovement>();
     orbitScript = rotateObject.GetComponent<Orbit>();
     infoScreen.SetActive(false);
     selectCube.SetActive(false);
     timerText.text = timeLeft.ToString("0.00");
        // loadingImage.fillAmount = 0f;      // Initally progress bar is empty
 }
Ejemplo n.º 10
0
	// Use this for initialization
	void Start ()
	{
		mainCamera = GetComponent<CameraMovement> ();
		scoreText = GameObject.FindGameObjectWithTag ("ScoreText").GetComponent<Text> ();
		gameOverText = GameObject.FindGameObjectWithTag ("GameOver").GetComponent<Text> ();
		cameraSpeed = initialCameraSpeed;
		delayDuration = initialDelayDuration;
		loopCountLevel = initialLoopCountLevel;
		scoreModifier = 1;
		playerScore = 0;
		scoreText.text = playerScore.ToString ();
	}
 void Start()
 {
     instance = this;
     try {
         transform.position = GameState.getInstance().getCameraPosition();
         transform.rotation = GameState.getInstance().getCameraRotation();
     } catch {
         GameState.getInstance().setCameraPosition(transform.position);
         GameState.getInstance().setCameraRotation(transform.rotation);
     }
     movementControl = new SineMovement(transform.position, transform.rotation);
 }
Ejemplo n.º 12
0
	void Awake()
	{
		anim = GetComponent<Animator>();
		playerRigidbody = GetComponent<Rigidbody>();
		playerItemUse = GetComponent<PlayerItemUse>();
		GameObject camera = Cache.GetCachedGameObjectByTag(Tags.CAMERA);
		cameraTransform = camera.transform;
		cameraMovement = camera.GetComponent<CameraMovement>();
		Stamina = MaxStamina;
		MoveLocked = false;
		ForceAim = false;
		sprintButton = false;
		isAiming = false;
	}
Ejemplo n.º 13
0
 void Start()                                                            //Don't Touch
 {
     theDM     = DialogueManager.instance;
     theSelect = SelectManager.instance;
     theOrder  = OrderManager.instance;
     thePlayer = PlayerManager.instance;
     theDB     = DatabaseManager.instance;
     theCamera = CameraMovement.instance;
     theMap    = MapManager.instance;
     if (theDB.trigOverList.Contains(trigNum))//트리거 실행 후 맵에 다시 돌아왔을 때 DB list에 들어가 있으면 다시 실행 안됨.
     {
         flag = true;
     }
 }
Ejemplo n.º 14
0
    void Awake()
    {
        // GetComponent<LevelGenerator>().GenerateLevel();
        for (int i = 0; i < zombieStartCount; i++)
        {
            Vector3 position = PositionHelpers.ComputeUnitPositionAroundTarget(new Vector3(0, 0, 0), i);
            Debug.Log(position);
            SpawnZombie(position);
        }

        mainCamera            = Camera.main;
        cameraMovement        = mainCamera.GetComponent <CameraMovement>();
        cameraMovement.Target = zombies[0];
    }
Ejemplo n.º 15
0
 void Start()
 {
     lockedDoorSprites.Add(Door.LockedDoorColor.red, lockedRedDoor);
     lockedDoorSprites.Add(Door.LockedDoorColor.blue, lockedBlueDoor);
     lockedDoorSprites.Add(Door.LockedDoorColor.green, lockedGreenDoor);
     lockedDoorSprites.Add(Door.LockedDoorColor.gold, lockedGoldDoor);
     lockedDoorSprites.Add(Door.LockedDoorColor.purple, lockedPurpleDoor);
     currentUnlockDelay = unlockDelay;
     currentRoom        = FindObjectOfType <CurrentRoom>();
     player             = FindObjectOfType <Player>();
     mainCamera         = FindObjectOfType <CameraMovement>();
     playerAnimator     = player.GetComponent <Animator>();
     ChangeDoorState();
 }
Ejemplo n.º 16
0
        /// <summary>
        /// moves camera with the keyboard
        /// </summary>
        /// <param name="cameraMovement">type of camera movement based on cameramovement enum</param>
        /// <param name="timeDelta">time key pressed for </param>
        public void ProcessKeyboard(CameraMovement cameraMovement, float timeDelta)
        {
            float velocity = movementspeed * timeDelta;

            if (cameraMovement == CameraMovement.CameraForward)
            {
                position += front * velocity;
            }
            if (cameraMovement == CameraMovement.CameraBackward)
            {
                position -= front * velocity;
            }
            if (cameraMovement == CameraMovement.CameraLeft)
            {
                position -= right * velocity;
            }
            if (cameraMovement == CameraMovement.CameraRight)
            {
                position += right * velocity;
            }
            if (cameraMovement == CameraMovement.CameraUp)
            {
                position += worldup * velocity;
            }
            if (cameraMovement == CameraMovement.CameraDown)
            {
                position -= worldup * velocity;
            }
            if (cameraMovement == CameraMovement.CameraPanLeft)
            {
                yaw -= velocity;
                UpdateCameraVectors();
            }
            if (cameraMovement == CameraMovement.CameraPanRight)
            {
                yaw += velocity;
                UpdateCameraVectors();
            }
            if (cameraMovement == CameraMovement.CameraTiltUp)
            {
                pitch += velocity;
                UpdateCameraVectors();
            }
            if (cameraMovement == CameraMovement.CameraTiltDown)
            {
                pitch -= velocity;
                UpdateCameraVectors();
            }
        }
Ejemplo n.º 17
0
 void Start()
 {
     GameManager.gameManager.canThrowIten = false;
     audioSource      = GetComponent <AudioSource>();
     audioSource.clip = knifeSound;
     audioSource.Play();
     cameraMovement = Camera.main.GetComponent <CameraMovement>();
     collider       = GetComponent <Collider2D>();
     renderer       = GetComponent <SpriteRenderer>();
     if (SimonActions.simon.transform.localScale.x == 1)
     {
         renderer.flipX = true;
         knifeSpeed    *= -1f;
     }
 }
Ejemplo n.º 18
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        player = GameObject.Find("Player");
        mainCamera = GameObject.Find("Main Camera");
        movement = mainCamera.GetComponent<CameraMovement>();

        if (!hasTriggered && collider.gameObject.Equals(player))
        {
            Debug.Log("player fell to his demise");

            hasTriggered = true;
            StopCamera ();
            Invoke ("ReloadLevel", 1.5f);  // delayed method call
        }
    }
Ejemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     CameraMovement     = Camera.main.GetComponent <CameraMovement>();
     mainGame           = GameObject.Find("mainGame").GetComponent <mainGame>(); //fixme:應該減少使用GameObject.find
     SelectBoxTransform = transform.Find("SelectBox");
     HighlightsFX       = Camera.main.GetComponent <HighlightsFX>();
     Depth       = Camera.main.farClipPlane;
     IsDragModel = false;
     if (IsPcControl)
     {
         IsDragModel = true;
     }
     SelectBoxInitialize();
     SelectFrameInitialize();
 }
Ejemplo n.º 20
0
    // Update is called once per frame

    protected float DetectionCheck()
    {
        float distance = Vector2.Distance(pc.transform.position, transform.position);

        if (CameraMovement.GetRoomFromPosition(transform.position) == CameraMovement.GetRoomFromPosition(pc.transform.position))
        {
            player   = pc.transform.position;
            detected = true;
        }
        else
        {
            detected = false;
        }
        return(distance);
    }
Ejemplo n.º 21
0
 void Start()
 {
     orbScript          = particles.GetComponent <OrbScript>();
     cameraMovement     = mainCameraObject.GetComponent <CameraMovement>();
     topScoreScript     = TopScoreHolder.GetComponent <TopScore>();
     GUIMainframeBody   = MainframeBody.GetComponent <SplineFollower>();
     GUImainCamera      = mainCamera.GetComponent <SplineFollower>();
     playMesh           = playIcon.GetComponent <MeshRenderer>();
     arrayTest          = gameManager.GetComponent <ArrayTest>();
     guiMainframeScript = MainframeBody.GetComponent <GUImainframeScript>();
     score            = gameManager.GetComponent <Score>();
     adManager        = Ads.GetComponent <AdManager>();
     positionOperator = MainMainframeBody.GetComponent <PositionOperator>();
     tutorialScript   = GetComponent <TutorialScript>();
 }
Ejemplo n.º 22
0
 private void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     mapVariable = map.GetComponent <AbstractMap>();
     originalLatitudeLongitude = mapVariable.CenterLatitudeLongitude;
     // originalCameraHeight = focalPoint.transform.position.y;
     StartCoroutine(Transition());
 }
Ejemplo n.º 23
0
    // Use this for initialization
    void Start()
    {
        // Initialize player fields
        player     = GameObjectLibrary.Player;
        playerBody = this.GetComponent <Rigidbody>();
        playerGame = this.GetComponent <PlayerGame>();

        // Initialize camera fields
        camera         = GameObjectLibrary.Camara;
        cameraMovement = camera.GetComponent <CameraMovement>();

        // Initialize velocity fields
        jumpVelocity    = new Vector3(0, 6.5f, 0);
        passiveVelocity = new Vector3(.17f, 0, 0);
    }
Ejemplo n.º 24
0
    // Start is called before the first frame update

    /*
     *  NAME: Start
     *  SYNOPSIS:
     *  Finds the player and tracks the position of the player
     *
     *
     *  DESCRIPTION:
     *  Gets the players position and the camerma position, tracks that position and makes
     *  sure that the camera is in the correct position.
     *
     *
     *  RETURNS:
     *
     *  AUTHOR:
     *      Thomas Furletti
     *  DATE:
     *      07/08/2020
     */


    void Start()
    {
        // get current location of player
        player1 = FindObjectOfType <PlayerMovement>();

        if (player1.startZone == loadName)
        {
            player1.transform.position = transform.position;
            player1.lastMove           = playerDirection;

            // get current location of camera
            camera1 = FindObjectOfType <CameraMovement>();
            camera1.transform.position = new Vector3(transform.position.x, transform.position.y, camera1.transform.position.z);
        }
    }
Ejemplo n.º 25
0
    private void Start()
    {
        source = GetComponent <AudioSource>();
        helper = GetComponent <GunControllerHelper>();

        input          = GetComponentInParent <PlayerInput>();
        animateFOV     = GetComponentInParent <AnimateFOV>();
        cameraMovement = GetComponentInParent <CameraMovement>();
        player         = GetComponentInParent <PlayerController>();
        player.AddToStatusChange(PlayerStatusChange);
        weaponSwaying = GetComponent <HandSway>();

        ui = FindObjectOfType <GunControllerUI>();
        ResetGuns();
    }
Ejemplo n.º 26
0
    void OnSceneGUI()
    {
        CameraMovement camera = (CameraMovement)target;

        //Draws view reach
        Handles.color = Color.black;
        Handles.DrawWireArc(camera.transform.position, Vector3.forward, Vector3.up, 360, camera.viewRadius);

        //Draws cone of view
        Vector3 viewAngleA = camera.DirFromAngle(-camera.viewAngle / 2, false);
        Vector3 viewAngleB = camera.DirFromAngle(camera.viewAngle / 2, false);

        Handles.DrawLine(camera.transform.position, camera.transform.position + viewAngleA * camera.viewRadius);
        Handles.DrawLine(camera.transform.position, camera.transform.position + viewAngleB * camera.viewRadius);
    }
Ejemplo n.º 27
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Spaceship Dock"))
        {
            collision.transform.parent.GetComponent <Spaceship>().FullyFuel();
            collision.transform.parent.gameObject.SetActive(false);

            GetComponent <Orbit>().enabled       = false;
            GetComponent <Spaceship>().inControl = true;

            CameraMovement cam = Camera.main.GetComponent <CameraMovement>();
            cam.ChangeOrthoSize(transform.lossyScale.x * transform.lossyScale.y / 30f);
            cam.target = transform;
        }
    }
Ejemplo n.º 28
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        CameraMovement cam = (CameraMovement)target;

        if (GUILayout.Button("Set Player Bounding box In All Cameras"))
        {
            cam.SetPlayerBoundingboxAllCameras();
        }

        if (GUILayout.Button("Get Player Bounding Box And Set In This Camera"))
        {
            cam.GetPlayerBoundingbox();
        }
    }
Ejemplo n.º 29
0
    void Start()
    {
	    instance = this;
        InitialPosition = gameObject.transform.position;
        TargetLocationVec3 = TargetLocation.transform.position;
        LookAtVec3 = LookAt.transform.position;

        gameObject.transform.LookAt(LookAtVec3);

        ht = new Hashtable();
        ht.Add("time", 3);
        ht.Add("easeType", "easeOutExpo");
        ht.Add("position", TargetLocationVec3);
        ht.Add("looktarget", LookAtVec3);
    }
Ejemplo n.º 30
0
    // Start is called before the first frame update
    void Start()
    {
        camMove      = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraMovement>();
        CM           = GameObject.Find("CapitulosManager").GetComponent <CapitulosManager>();
        soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager>();
        Cards.Add("Fase1", Card_n1);
        Cards.Add("Fase2", Card_n2);
        Cards.Add("Fase3", Card_n3);
        Cards.Add("Fase4", Card_n4);

        AuxIndex.Add("Fase1", 1);
        AuxIndex.Add("Fase2", 2);
        AuxIndex.Add("Fase3", 3);
        AuxIndex.Add("Fase4", 4);
    }
Ejemplo n.º 31
0
 protected void OnMouseUp()
 {
     if (launchTime)
     {
         audioSource.clip = sounds[0];
         audioSource.Play();
         Invoke("Change", 15);
         Vector2 force = initialPosition - transform.position;
         rb.bodyType = RigidbodyType2D.Dynamic;
         rb.AddRelativeForce(force * forceValue, ForceMode2D.Impulse);
         cm = GameObject.Find("Main Camera").GetComponent <CameraMovement>();
         cm.FollowMe(gameObject);
         launchTime = false;
     }
 }
    void CameraController()
    {
        CameraMovement cm = gameObject.gameObject.GetComponent <CameraMovement>();

        if (cm.IsInFirstPerson())
        {
            gameObject.GetComponent <MeshRenderer>().enabled = false;
            Camera.main.transform.position = cameraLoc.transform.position;
        }
        else
        {
            gameObject.GetComponent <MeshRenderer>().enabled = true;
            Camera.main.transform.position = GameObject.FindGameObjectWithTag("3ps").transform.position;
        }
    }
Ejemplo n.º 33
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        player     = GameObject.Find("Player");
        mainCamera = GameObject.Find("Main Camera");
        movement   = mainCamera.GetComponent <CameraMovement>();

        if (!hasTriggered && collider.gameObject.Equals(player))
        {
            Debug.Log("player fell to his demise");

            hasTriggered = true;
            StopCamera();
            Invoke("ReloadLevel", 1.5f);               // delayed method call
        }
    }
Ejemplo n.º 34
0
    public void LockCamera()
    {
        sGameEventManager.Access().AfterDeath += tryRecenter;
        this.isLocked       = true;
        this.lastLockedXPos = centerObj.transform.position.x;
        Camera         cam  = GameObject.FindObjectOfType <Camera>();
        CameraMovement move = cam.gameObject.GetComponent <CameraMovement>();

        move.DoFollow(false);
        move.DoFollowY(true);
        move.DoFollowX(false);
        Rigidbody2D camBody = cam.GetComponent <Rigidbody2D>();

        StartCoroutine(WaitTillCentered(camBody));
    }
Ejemplo n.º 35
0
 private void Initialize()
 {
     navAgent      = GetComponent <UnityEngine.AI.NavMeshAgent> ();
     v3location    = transform.position;
     v3destination = v3location;
     v3destinations.Clear();
     movementScript = GetComponent <Movement1> ();
     camMovement    = Camera.main.GetComponent <CameraMovement> ();
     v3nodes        = new Vector3[nodes.Length];
     for (int i = 0; i < nodes.Length; i++)
     {
         v3nodes [i] = nodes [i].transform.position;
         //Debug.DrawRay (v3nodes [i], new Vector3(0f, -10f, 0f), Color.red, 2f);
     }
 }
Ejemplo n.º 36
0
    private void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        animator       = GetComponent <Animator>();
        mainCamera     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
        cameraMovement = mainCamera.GetComponent <CameraMovement>();
    }
Ejemplo n.º 37
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.HelpBox("Controls for the camera movement", MessageType.Info);

        EditorGUILayout.HelpBox("This object must be tagged MainCamera for this to work", MessageType.Warning);

        base.OnInspectorGUI();

        CameraMovement myScript = (CameraMovement)target;

        if (GUILayout.Button("Update Offset"))
        {
            myScript.UpdateOffset();
        }
    }
 // Use this for initialization
 void Start()
 {
     updateAttacks();
     pointer      = 0;
     currentPoint = 0;
     justStarted  = true;
     debugger     = "";
     updateNeeded = false;
     //gets the playermovement script from the player
     pM = GameObject.FindGameObjectWithTag("Player").GetComponent(typeof(PlayerMovement)) as PlayerMovement;
     commWithIscreen = false;
     cm             = GameObject.FindGameObjectWithTag("Player").GetComponent <CameraMovement>();
     savedValuesArr = new float[8, 10];
     cooldownArr    = new float[8];
 }
Ejemplo n.º 39
0
 public override void DisplayPopup()
 {
     _canvas.enabled = true;
     _popupManager.PopupDisplayed();
     Time.timeScale = 0;
     if (_gameManager.CurrentScene == GameManager.GameScenes.Gameplay)
     {
         if (_gameplayCamera == null)
         {
             _gameplayCamera = FindObjectOfType <CameraMovement>();
         }
         _gameplayCamera.SetCameraMovement(false);
     }
     base.DisplayPopup();
 }
Ejemplo n.º 40
0
    protected bool flag;    // true 이면 다시 실행 안됨.


    /////////////////////////////////////////////////////////////////////   inspector에서 체크 가능. 1: 닿으면 자동 실행, 2: 체크시 해당 트리거 무한 반복.


    void Start()                                                            //Don't Touch
    {
        this.gameObject.GetComponent <BoxCollider2D>().isTrigger = true;
        //instance = this;
        theDM     = DialogueManager.instance;
        theSelect = SelectManager.instance;
        theOrder  = OrderManager.instance;
        thePlayer = PlayerManager.instance;
        theDB     = DatabaseManager.instance;
        theCamera = CameraMovement.instance;
        theMap    = MapManager.instance;
        thePuzzle = PuzzleManager.instance;
        item      = this.gameObject;

        if (mapNum == 0)
        {
            mapNum = -1;
        }
        if (mapCount == 0)
        {
            mapCount = -1;
        }

        if (getSound == "")
        {
            getSound = "boosruck";
        }

        if (recreatable)
        {
            if (Inventory.instance.SearchItem(itemNum))
            {
                gameObject.SetActive(false);
            }
        }

        if (onlyOnce)
        {
            if (!theDB.itemOverList.Contains(itemNum) && MapCountCheck())
            {
                gameObject.SetActive(true);
            }
            else
            {
                gameObject.SetActive(false);
            }
        }
    }
Ejemplo n.º 41
0
 // Use this for initialization
 void Update()
 {
     timer -= Time.deltaTime;
     if (timer <= 0f)
     {
         CancelInvoke();
         // Camera Lerp
         CameraMovement camMov = cam.GetComponent <CameraMovement>();
         camMov.enableCam();
         killPlayer();
     }
     else
     {
         countdown.text = (Mathf.Round(timer)).ToString();
     }
 }
Ejemplo n.º 42
0
 // Use this for initialization
 void Start()
 {
     MeteorSize = Random.Range (1f, 2.5f);
     Force = Random.Range (300f, 500f);
     m_Rigidbody = GetComponent<Rigidbody2D>();
     CameraPositions = Camera.main.GetComponent<CameraMovement>();
     if (transform.position.y > CameraPositions.middleY) {
         rotation = Random.Range(180f, 270f);
     }
     if (transform.position.y <= CameraPositions.middleY) {
         rotation = Random.Range(90f, 180f);
     }
     transform.localScale = new Vector3(MeteorSize, MeteorSize, 1);
     Vector3 dir = Quaternion.AngleAxis(rotation, Vector3.forward) * Vector3.right;
     m_Rigidbody.AddForce(dir * Force);
 }
Ejemplo n.º 43
0
    void Start()
    {
        cameraMovement = Camera.main.GetComponent <CameraMovement>();

        foreach (Vector3 pos in GetInvisibleBlockPositions(GreenBlocks))
        {
            CreateInvisibleBlock(pos, GreenBlocks);
        }

        foreach (Vector3 pos in GetInvisibleBlockPositions(RedBlocks, true))
        {
            CreateInvisibleBlock(pos, RedBlocks);
        }

        UpdateCollisionSettings();
    }
Ejemplo n.º 44
0
    public PlayerData(PlayerMovement player, CameraMovement camera, DayTimeController timeController, GameSceneManager currentScene)
    {
        playerPosition    = new float[2];
        playerPosition[0] = player.transform.position.x;
        playerPosition[1] = player.transform.position.y;

        maxPositionX = camera.maxPosition.x;
        maxPositionY = camera.maxPosition.y;
        minPositionX = camera.minPosition.x;
        minPositionY = camera.minPosition.y;
        smooting     = camera.smoothing;

        time = timeController.time;

        scene = currentScene.currentScene;
    }
Ejemplo n.º 45
0
    void Start()
    {
        joyStickVec    = Vector2.zero;
        CameraMovement = Camera.main.GetComponent <CameraMovement>();
        Stick          = transform.Find("Stick");
        Block          = transform.Find("Block");
        RectTransform  = GetComponent <RectTransform>();
        Sprite         = GetComponent <UnityEngine.UI.Image>().sprite;
        imageScale     = GetComponent <RectTransform>().localScale;


        Width      = RectTransform.sizeDelta.x;
        Height     = RectTransform.sizeDelta.y;
        WidthHalf  = Width * 0.5f;
        HeightHalf = Height * 0.5f;
    }
Ejemplo n.º 46
0
	public static CameraMovement getInstance ()
	{
		if ( _meInstance == null )
		{	
			if(Camera.main != null)
			{
				_meInstance = Camera.main.GetComponent < CameraMovement > ();
			}
			else
			{
				_meInstance = GameObject.Find("Camera").GetComponent < CameraMovement > ();
			}
		}
		
		return _meInstance;
	}
Ejemplo n.º 47
0
    void Start()
    {
        CopSetUp = GameObject.Find ("Cop").GetComponent<Cop>();
        floorHeight = GameObject.Find("PrisonFloorLowest").transform.position.y;
        catapultCamera = GameObject.Find("Camera").GetComponent<Camera>();
        prisonerCamera = GameObject.Find("PrisonerCam").GetComponent<Camera>();
        cameraMovement = GameObject.Find("PrisonerCam").GetComponent<CameraMovement>();
        prisonerCamera.transform.position = new Vector3(49.676f,21.877f,-130.41f);
        frontWall = GameObject.Find("TrackerWall");
        ui = GameObject.Find ("CatapultAnimWithoutCircle").GetComponent<UI>();

        HighestHeightAchieved = Mathf.Abs (transform.position.y - floorHeight);

        ui.resetBarAndCanFire = false;
        catapultCamera.enabled = false;
        prisonerCamera.enabled = true;
    }
Ejemplo n.º 48
0
    void Start()
    {
        spawn = FindObjectOfType<ISpawn>();
        BeforeGameStart();

        if (!player)
        {
            player = FindObjectOfType<CPlayer>();
        }

        if (!camera)
        {
            camera = FindObjectOfType<CameraMovement>();
            if (camera) camera.SetTarget(player);
        }

        OnGameStart(player);
    }
Ejemplo n.º 49
0
    public void Init()
    {
        // get camera movement
        camMovement = GetComponent<CameraMovement>();
        ThrowDisc += camMovement.StartFollowDisc;
        NewDisc += camMovement.OnNewDisc;

        // grab arm animator
        anim = throwingArm.GetComponent<Animator>();

        // grab initial rotations
        yawAngle = transform.rotation.eulerAngles.y;
        pitchAngle = transform.rotation.eulerAngles.x;

        // reset position
        SetPosition(holeStart.position);
        lastLegalGround = holeStart.position;

        // arm position
        armParent = transform.Find("ARM_PARENT");
        armParentResetPos = armParent.localPosition;
        armParentResetRot = armParent.localRotation;

        // lock cursor
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;

        init = true;

        // setup a fresh disc if one isn't assigned
        if (disc == null)
        {
            GameObject newDiscObj = Instantiate(discPrefab, Vector3.zero, Quaternion.identity) as GameObject;
            SetupNewDisc(newDiscObj.GetComponent<Disc>());
        }
    }
Ejemplo n.º 50
0
 /// <summary>
 /// Use this constructor if you are going to add more complex mouse/key combinations
 /// </summary>
 public TrackBallMapping(CameraMovement movement)
 {
     _movement = movement;
 }
Ejemplo n.º 51
0
        private static bool IsAutoScroll(CameraMovement action)
        {
            switch (action)
            {
                case CameraMovement.Orbit_AutoScroll:
                case CameraMovement.Pan_AutoScroll:
                case CameraMovement.RotateAroundLookDirection_AutoScroll:
                case CameraMovement.RotateInPlace_AutoScroll:
                case CameraMovement.Zoom_AutoScroll:
                    return true;

                default:
                    return false;
            }
        }
Ejemplo n.º 52
0
 /// <summary>
 /// The keys in this overload are an OR condition (LeftShift or RightShift)
 /// </summary>
 public TrackBallMapping(CameraMovement movement, MouseButton mouseButton, IEnumerable<Key> keys)
     : this(movement)
 {
     this.Add(mouseButton);
     this.Add(keys);
 }
Ejemplo n.º 53
0
        private static string ConvertReportMovement(CameraMovement movement)
        {
            string retVal = null;

            retVal = movement.ToString();

            switch (movement)
            {
                case CameraMovement.Pan_Keyboard_In:
                    retVal += " (sometimes used as zoom in)";
                    break;

                case CameraMovement.Pan_Keyboard_Out:
                    retVal += " (sometimes used as zoom out)";
                    break;
            }

            retVal = retVal.Replace('_', ' ');

            return retVal;
        }
Ejemplo n.º 54
0
 public TrackBallMapping(CameraMovement movement, Key key)
     : this(movement)
 {
     this.Add(key);
 }
Ejemplo n.º 55
0
 public TrackBallMapping(CameraMovement movement, IEnumerable<Key> keys)
     : this(movement)
 {
     this.Add(keys);
 }
Ejemplo n.º 56
0
 public TrackBallMapping(CameraMovement movement, MouseButton mouseButton, Key key)
     : this(movement)
 {
     this.Add(mouseButton);
     this.Add(key);
 }
Ejemplo n.º 57
0
 public bool IsSet(CameraMovement movement)
 {
     return (current & movement) != 0;
 }
Ejemplo n.º 58
0
 public UserMovedCameraArgs(CameraMovement movement)
 {
     this.Movement = movement;
 }
Ejemplo n.º 59
0
 public void SetMoving(CameraMovement movement)
 {
     current |= movement;
 }
Ejemplo n.º 60
0
 public void Reset()
 {
     current = 0;
 }