예제 #1
0
 void Awake()
 {
     _particles = this.particleSystem;
     _particles.renderer.sortingLayerName = "Foreground";
     _mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
     _trackerScript = _mainCamera.GetComponent<CameraTracker> ();
 }
예제 #2
0
    void OnLevelWasLoaded(int level)
    {
        //clear the player objects list
        for (int i = 0; i < playerObjects.Count; ++i)
        {
            playerObjects[i] = null;
        }

        //find player objects in scene
        Player[] players = FindObjectsOfType <Player>();

        //initilize the array to the proper length.
        for (int i = 0; i < players.Length; ++i)
        {
            playerObjects.Add(players[i]);
        }

        //parse the names of the parents of the players for a number and add them to that index.
        for (int i = 0; i < players.Length; ++i)
        {
            string num    = Regex.Match(players[i].transform.parent.name, @"\d+").Value;
            int    result = 0;
            if (Int32.TryParse(num, out result))
            {
                playerObjects[result - 1] = players[i];
            }
        }

        cameraTracker = FindObjectOfType <CameraTracker>();
    }
예제 #3
0
 void Awake()
 {
     _particles = this.particleSystem;
     _particles.renderer.sortingLayerName = "Foreground";
     _mainCamera    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
     _trackerScript = _mainCamera.GetComponent <CameraTracker> ();
 }
예제 #4
0
파일: LevelGen.cs 프로젝트: CZSeas/Champion
    void MoveToNextRoom()
    {
        RoomGen currentRoom = rooms[currentRoomIdx];

        if (currentRoomIdx - 1 >= 0)
        {
            rooms[currentRoomIdx - 1].spawner.ClearCurrentDrops();
        }

        CameraTracker tracker = CameraController.instance.GetCurrentCam().GetComponent <CameraTracker>();

        tracker.ChangeRooms(currentRoom.roomSize.x * currentRoom.tileSize,
                            currentRoom.roomSize.y * currentRoom.tileSize, currentRoom.transform.position);

        if (enemiesEnabled)
        {
            currentRoom.spawner.minEnemies = 1 + (int)(minMaxEnemyPercent.x * currentRoom.roomSize.x * currentRoom.roomSize.y);
            currentRoom.spawner.maxEnemies = (int)(minMaxEnemyPercent.y * currentRoom.roomSize.x * currentRoom.roomSize.y);
            currentRoom.spawner.SpawnEnemies();
        }
        if (currentRoom.prevDoor != null)
        {
            currentRoom.prevDoor.CloseDoor();
        }
        currentRoomIdx++;
    }
예제 #5
0
    public void Init(PaintableWall paintableWall, CameraTracker camTracker)
    {
        playerControllerEnabled  = true;
        paintingConrollerEnabled = false;

        this.paintableWall = paintableWall;
        this.camTracker    = camTracker;
    }
예제 #6
0
        public void TestCameraTracker()
        {
            Camera2D   Camera2D  = null;
            IFocusAble focusAble = null;
            var        tracker   = new CameraTracker(Camera2D, focusAble);

            Assert.IsNotNull(tracker);
        }
예제 #7
0
 // Start is called before the first frame update
 void Start()
 {
     tracker  = gameObject.GetComponent <CameraTracker>();
     codes    = new KeyCode[8];
     codes[0] = KeyCode.Alpha1;
     codes[1] = KeyCode.Alpha2;
     codes[2] = KeyCode.Alpha3;
     codes[3] = KeyCode.Alpha4;
     codes[4] = KeyCode.Alpha5;
     codes[5] = KeyCode.Alpha6;
     codes[6] = KeyCode.Alpha7;
     codes[7] = KeyCode.Alpha8;
 }
예제 #8
0
    /* A little hacky to have this in here when this should be level-specific */
    public IEnumerator PlayLevel1EndCutscene()
    {
        yield return(new WaitForSeconds(1f));

        fighterFigure.SetActive(true);
        CameraTracker cameraScript = Camera.current.GetComponent <CameraTracker>();

        cameraScript.target = fighterFigure.transform;
        cameraScript.ZoomIn();

        yield return(new WaitForSeconds(2f));

        StartCoroutine(GetComponent <SceneController>().ChangeScene("GameShop", true, 1f, 1f));
    }
예제 #9
0
    public void Setup()
    {
        attackComponent        = GetComponent <Attack>();
        attackComponent.isUser = isUser;
        attackComponent.team   = team;
        attackComponent.Setup();

        cameraTrackerComponent        = GetComponent <CameraTracker>();
        cameraTrackerComponent.isUser = isUser;
        cameraTrackerComponent.Setup();

        widget.GetComponentInChildren <Text>().text  = displayName;
        widget.GetComponentInChildren <Text>().color = team.color;
    }
예제 #10
0
    //private LineRenderer lineRenderer;
    // Use this for initialization
    void Start()
    {
        //lineRenderer = GetComponent<LineRenderer> ();
        //lineRenderer.SetVertexCount (laserNumSegments);
        //lineRenderer.SetPosition (0, Vector3.zero);

        GameObject newGun = (GameObject)Instantiate (gun, Vector3.zero, Quaternion.identity);
        newGun.transform.parent = transform;
        newGun.transform.localPosition = Vector3.zero;
        newGun.transform.localRotation = Quaternion.identity;
        laserGun = newGun.GetComponent<LaserGun> ();

        damageTaker = GetComponent<DamageTaker> ();
        cameraTracker = Camera.main.GetComponent<CameraTracker> ();
        gameRules = Camera.main.GetComponent<GameRules> ();
    }
예제 #11
0
파일: LevelGen.cs 프로젝트: CZSeas/Champion
 void SpawnNextTeleporter()
 {
     if (currentRoomIdx > 0 && currentRoomIdx <= rooms.Count)
     {
         RoomGen currentRoom = rooms[currentRoomIdx - 1];
         currentRoom.nextDoor.OpenDoor();
         currentRoom.nextTeleporter.gameObject.SetActive(true);
         if (currentRoomIdx <= rooms.Count - 1)
         {
             RoomGen nextRoom = rooms[currentRoomIdx];
             nextRoom.prevDoor.OpenDoor();
         }
         CameraTracker tracker = CameraController.instance.GetCurrentCam().GetComponent <CameraTracker>();
         tracker.doorClosed = false;
         tracker.StartCoroutine(tracker.MoveToPlayer());
     }
 }
예제 #12
0
    IEnumerator SetupCam()
    {
        //DIRTY CHECK FeelsBadMan
        if (CameraController.instance != null)
        {
            yield return(new WaitUntil(() => CameraController.instance.GetCurrentCam().gameObject.name == "BossCam"));

            CameraTracker tracker = CameraController.instance.GetCurrentCam().GetComponent <CameraTracker>();
            if (yRot == 90 || yRot == -90)
            {
                tracker.ChangeRooms(roomSize.y, roomSize.x, bossSpawnPos.position);
            }
            else
            {
                tracker.ChangeRooms(roomSize.x, roomSize.y, bossSpawnPos.position);
            }
        }
    }
예제 #13
0
        public Safari()
        {
            graphics = new GraphicsDeviceManager(this);
            //graphics.PreferredBackBufferWidth = 1366;
            //graphics.PreferredBackBufferHeight = 768;
            //graphics.IsFullScreen = true;

            Content.RootDirectory = "Content";

            // Komponenten erstellen
            camera = new FreeLookCamera(this);
            ground = new Ground(this);
            lights = new Lights(this);
            skybox = new Skybox(this);
            tigers = new Tigers(this);
            cubes  = new Cubes(this);
            ray    = new Line(this);

            cameraTracker = new CameraTracker(this, camera);
            cameraHandler = new CameraHandler(this, camera);

            // Komponenten zur Liste hinzufügen
            Components.Add(cameraTracker);
            Components.Add(cameraHandler);
            Components.Add(camera);
            Components.Add(skybox);
            Components.Add(lights);
            Components.Add(tigers);
            Components.Add(ground);
            Components.Add(cubes);
            Components.Add(ray);

            // Services zur Liste hinzufügen
            Services.AddService(typeof(ICameraService), camera);
            Services.AddService(typeof(ILightService), lights);

            // Antialiasing aktivieren
            graphics.PreferMultiSampling = true;
        }
예제 #14
0
 void Awake()
 {
     instance = this;
 }
예제 #15
0
 private void Awake()
 {
     instance = this;
 }
예제 #16
0
    public void loadScene(int iIndex)
    {
        Application.LoadLevelAsync(iIndex);

        cameraTracker = null;
    }