Inheritance: MonoBehaviour
 private void Start()
 {
     Instance        = this;
     cam             = base.transform.GetChild(0).GetComponent <Camera>();
     cam.fieldOfView = GameState.Instance.fov;
     offset          = base.transform.position - player.transform.position;
 }
Example #2
0
 public void Start()
 {
     Registry.Islands.Add(Uid, this.gameObject);
     InitLineRender();
     Island         = GetComponent <IslandData>();
     cameraMovement = Camera.main.GetComponent <MoveCamera>();
 }
Example #3
0
    void Start()
    {
        controller = gameObject.GetComponent <CharacterController>();
        movement   = new Movement(gameObject, controller
                                  , _moveAcc: moveAcc, _moveMax: moveMax
                                  , _friction: moveFriction, _gravity: moveGravity)
        {
            isRetainMotionEnabled = true
        };

        movementProfileNormal = new MovementProfile(_moveAcc: moveAcc, _moveMax: moveMax
                                                    , _friction: moveFriction, _gravity: moveGravity, _isMoveEnabled: true
                                                    , _isFrictionEnabled: true, _isGravityEnabled: true, _isRetainMotionEnabled: false);

        movementProfileAirdash = new MovementProfile(_moveAcc: moveAccAirdash, _moveMax: moveMax
                                                     , _friction: moveFrictionAirdash, _gravity: moveGravity, _isRetainMotionEnabled: true);


        cameraScript = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MoveCamera>();

        currentGun       = transform.Find("Main Camera/Handgun").gameObject;
        currentGunScript = currentGun.GetComponent <PlayerGun>();

        thisTransform = gameObject.transform;
    }
Example #4
0
        public void NotifyGameEnd(Nexus nexus)
        {
            var losingTeam = nexus.Team;

            foreach (var p in _playerManager.GetPlayers())
            {
                var coords = _game.Map.GetEndGameCameraPosition(losingTeam);
                var cam    = new MoveCamera(p.Item2.Champion, coords[0], coords[1], coords[2], 2);
                _game.PacketHandlerManager.sendPacket(p.Item2.Peer, cam, Channel.CHL_S2C);
                _game.PacketHandlerManager.sendPacket(p.Item2.Peer, new HideUi(), Channel.CHL_S2C);
            }
            _game.PacketHandlerManager.broadcastPacket(new ExplodeNexus(nexus), Channel.CHL_S2C);

            var timer = new System.Timers.Timer(5000);

            timer.AutoReset = false;
            timer.Elapsed  += (a, b) =>
            {
                var win = new GameEnd(true);
                _game.PacketHandlerManager.broadcastPacketTeam(CustomConvert.getEnemyTeam(losingTeam), win, Channel.CHL_S2C);
                var lose = new GameEnd(false);
                _game.PacketHandlerManager.broadcastPacketTeam(losingTeam, lose, Channel.CHL_S2C);
            };
            timer.Start();
        }
 void OnCollisionEnter2D(Collision2D hit)
 {
     if (hit.collider.CompareTag(tagCollider))
     {
         MoveCamera.SetTarget(target, timeToFollow, velocityToTarget);
     }
 }
 void OnTriggerEnter2D(Collider2D hit)
 {
     if (hit.CompareTag(tagCollider))
     {
         MoveCamera.SetTarget(target, timeToFollow, velocityToTarget);
     }
 }
Example #7
0
    public void Start()
    {
        DontDestroyOnLoad(this);
        if (instance == null)
        {
            instance = this;
            Debug.Log("This is level " + level);

            moveCamera   = FindObjectOfType <MoveCamera>();
            audioManager = FindObjectOfType <AudioManager>();

            audioManager.soundTrack(musicTrack.gameSound);
            audioManager.ambianceSoundTrack(environmentalSound.ambience);

            player1 = SwapManager.instance.objPlayer1;
            player2 = SwapManager.instance.objPlayer2;

            GetStartPositions();
        }
        else
        {
            Destroy(this.gameObject);
            Debug.LogError("More than one levelmanager in scene.");
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            Debug.Log("1");
            // Init MoveCamera location
            MoveCamera moveCamera = GetComponent <MoveCamera>();
            moveCamera.UpdateLocation("espoo");
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            Debug.Log("2");
            // Init MoveCamera location
            MoveCamera moveCamera = GetComponent <MoveCamera>();
            moveCamera.UpdateLocation("church");
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            Debug.Log("3");
            // Init MoveCamera location
            MoveCamera moveCamera = GetComponent <MoveCamera>();
            moveCamera.UpdateLocation("suomenlinna");
        }

        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            Debug.Log("4");
            // Init MoveCamera location
            MoveCamera moveCamera = GetComponent <MoveCamera>();
            moveCamera.UpdateLocation("fjord");
        }
    }
Example #9
0
 private void Start()
 {
     firstY = 10f;
     SetOrthographicSize();
     SetResoultion(screenWidth, screenHeight, IsFullScreen);
     moveCamera = new MoveCamera(MouseMode);
 }
Example #10
0
        public void NotifyGameEnd(Vector3 cameraPosition, INexus nexus, List <Pair <uint, ClientInfo> > players)
        {
            var losingTeam = nexus.Team;

            foreach (var p in players)
            {
                var cam = new MoveCamera(p.Item2.Champion, cameraPosition.X, cameraPosition.Y, cameraPosition.Z, 2);
                _packetHandlerManager.SendPacket((int)p.Item2.UserId, cam, Channel.CHL_S2C);
                _packetHandlerManager.SendPacket((int)p.Item2.UserId, new HideUi(), Channel.CHL_S2C);
            }

            _packetHandlerManager.BroadcastPacket(new ExplodeNexus(nexus), Channel.CHL_S2C);

            var timer = new Timer(5000)
            {
                AutoReset = false
            };

            timer.Elapsed += (a, b) =>
            {
                var gameEndPacket = new GameEnd(losingTeam != TeamId.TEAM_BLUE);
                _packetHandlerManager.BroadcastPacket(gameEndPacket, Channel.CHL_S2C);
            };
            timer.Start();
        }
Example #11
0
    void Start()
    {
        instance = this;

        camPos = _cam.transform.position;
        Debug.Log(camPos);
    }
Example #12
0
        public void NotifyGameEnd(Nexus nexus)
        {
            var losingTeam = nexus.Team;

            foreach (var p in _playerManager.GetPlayers())
            {
                var coords = _game.Map.GetEndGameCameraPosition(losingTeam);
                var cam    = new MoveCamera(p.Item2.Champion, coords[0], coords[1], coords[2], 2);
                _game.PacketHandlerManager.sendPacket(p.Item2.Peer, cam, Channel.CHL_S2C);
                _game.PacketHandlerManager.sendPacket(p.Item2.Peer, new HideUi(), Channel.CHL_S2C);
            }

            _game.PacketHandlerManager.broadcastPacket(new ExplodeNexus(nexus), Channel.CHL_S2C);

            var timer = new System.Timers.Timer(5000)
            {
                AutoReset = false
            };

            timer.Elapsed += (a, b) =>
            {
                var gameEndPacket = new GameEnd(losingTeam != TeamId.TEAM_BLUE);
                _game.PacketHandlerManager.broadcastPacket(gameEndPacket, Channel.CHL_S2C);
            };
            timer.Start();
            Program.SetToExit();
        }
Example #13
0
    /// <summary>
    /// Set the active state of the items in use and enable the cursor.
    /// </summary>
    /// <param name="displayState"> The boolean parameter to set the display state to. </param>
    void SetActiveUI(bool displayState)
    {
        foreach (ThrowableManager throwable in throwables)
        {
            throwable.SetButtonActive(displayState);
        }

        foreach (KeyManager key in keys)
        {
            key.SetImageActive(displayState);
        }

        //Enable the cursor.
        Cursor.visible = displayState;

        //If inventory is visible, disable camera input and vice versa.
        if (displayState)
        {
            Cursor.lockState = CursorLockMode.None;
            MoveCamera.DisableInput();
            Time.timeScale = 0f;
        }
        else
        {
            Cursor.lockState = CursorLockMode.Locked;
            MoveCamera.EnableInput();
            Time.timeScale = 1f;
        }
    }
	void Awake()
	{
		if (instance == null)
			instance = this;
		else if (instance != this)
			Destroy (this);
	}
Example #15
0
 void Start()
 {
     if (isEncubadora)
     {
         MoveCamera.SetTarget(transform, 10f, 10f);
     }
 }
Example #16
0
        public void Move(MoveCamera move)
        {
            _returnToSender = move.Return;
            _returnSpeed    = move.ReturnSpeed;

            _positions.AddRange(move.Position);
        }
Example #17
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #18
0
 void Awake()                                               // Start()보다 먼저 실행
 {
     Screen.SetResolution(1440, 1660, false);
     _Instance = GetComponent <MoveCamera>();    // _sceneManager변수에 자신의 SceneChangeManager 컴포넌트를 넣는다.
     x         = -5.5f;
     y         = -2f;
     z         = 12f;
 }
Example #19
0
 public static MoveCamera GetInstance()
 {
     if (instance == null)
     {
         instance = FindObjectOfType <MoveCamera>();
     }
     return(instance);
 }
Example #20
0
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag == "EndOfScene")
     {
         Debug.Log("TriggerEnter");
         MoveCamera.GetInstance().CameraCanMove = false;
     }
 }
 private void GetColourStuff()
 {
     rend       = GetComponent <SpriteRenderer>();
     moveCamera = FindObjectOfType <MoveCamera>();
     Color c = rend.material.color;
     //c.a = 0f;
     //rend.material.color = c;
 }
Example #22
0
 void Start()
 {
     rgb2             = this.GetComponent <Rigidbody2D>();
     healthController = GameObject.FindWithTag(MyConst.PlayerBody).GetComponent <HealthController>();
     playAnimation    = GetComponentInChildren <PlayAnimation>();
     cam = GetComponentInChildren <MoveCamera>();//  GameObject.FindWithTag("MainCamera").GetComponent<MoveCamera>();
     SetStartVariables();
 }
Example #23
0
 void Start()
 {
     moveCamera    = FindObjectOfType <MoveCamera>();
     player        = FindObjectOfType <PlayerController>();
     betweenBattle = FindObjectOfType <BetweenBattle>();
     showMap       = FindObjectOfType <ShowMap>();
     rooms         = player.rooms;
 }
 private void Start()
 {
     m_Camera     = Camera.main.transform;
     m_CameraMove = m_Camera.GetComponent <MoveCamera>();
     bar          = gameObject.GetComponent <Scrollbar>();
     bar.value    = 0.7f;
     StartCoroutine("ScrollRoutine");
 }
Example #25
0
 void Start()
 {
     pausePos   = new Vector3(0, 500, 0);
     savedXPos  = 0;
     savedYPos  = 8;
     savedZPos  = 0;
     cameraMain = GetComponent <MoveCamera>();
 }
 // Use this for initialization
 void Start()
 {
     speedEnum = Speed.faster;
     startSpeed = speed;
     startVector = transform.position;
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
     moveCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MoveCamera>();
 }
Example #27
0
 void GetComponents()
 {
     rgb2             = GetComponent <Rigidbody2D>();
     healthController = GameObject.FindWithTag(MyConst.PlayerBody).GetComponent <HealthController>();
     cam = GetComponentInChildren <MoveCamera>();//  GameObject.FindWithTag("MainCamera").GetComponent<MoveCamera>();
     specialAbilities = GetComponent <SpecialAbilities>();
     weaponScript     = GetComponentInChildren <WeaponScript>();
     anim             = GetComponent <Animator>();
 }
 // Use this for initialization
 void Start()
 {
     mm       = GameObject.FindObjectOfType <ObjectSelector>();
     mc       = GameObject.FindObjectOfType <MoveCamera>();
     camObj   = GameObject.Find("Main Camera");
     cam      = mc.GetComponent <Camera>();
     mo       = GameObject.Find("MouseOver");
     selector = GameObject.Find("Selector");
 }
Example #29
0
 // Use this for initialization
 void Start()
 {
     app           = AppController.instance;
     invItemScript = gameObject.GetComponent <InventoryItem> ();
     moveCamScript = Camera.main.gameObject.GetComponent <MoveCamera> ();
     //moveDirection = rigidbody.transform.rotation.eulerAngles;
     messageRect       = new Rect(Screen.width / 2 + 300, Screen.height / 2 - 20, 200, 80);
     targetFlyRotation = rigidbody.transform.rotation.eulerAngles;
 }
Example #30
0
    void Start()
    {
        inControls = false;
        optionsPos = new Vector3(512, 384, -100);
        mainPos    = new Vector3(0, 0, -10);
        exitPos    = new Vector3(512, -384, -100);
        controlPos = new Vector3(-512, 384, -100);

        cameraMain = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <MoveCamera>();
    }
 // Use this for initialization
 void Start()
 {
     mc = GameObject.Find("MathiusEarthCam").GetComponent("MoveCamera")as MoveCamera;
     ps = GameObject.Find("MathiusEarthCam").GetComponent("PaulScore") as PaulScore;
     camera = GameObject.Find("MathiusEarthCam") as GameObject;
     mathius_cam = camera.GetComponent(typeof(Camera)) as Camera;
     delta = new Vector3(0.0f,0.0f,0.0f);
     anchor = new Vector3(0.0f,0.0f,0.0f);
     mathius = gameObject;
 }
Example #32
0
    private void Awake()
    {
        if (instance != null && instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        instance = this;
    }
Example #33
0
 void Start()
 {
     moveCam = FindObjectOfType <MoveCamera>();
     bubbles[0].GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     bubbles[1].GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     bubbles[2].GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     bubbles[3].GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     bubbles[4].GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
     bubbles[5].GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 0);
 }
Example #34
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        cameraScript = GetComponent<MoveCamera>();
        soundScript = myCamera.GetComponent<SoundManager>();
        zapScript = myCamera.GetComponent<EffectZapping>();
        videoPlayer = FindObjectOfType<VideoPlayer>();
    }
Example #35
0
 // Use this for initialization
 void Start()
 {
     this.cam = GetComponent<MoveCamera>();
 }
Example #36
0
	// Use this for initialization
	void Start () {
		m_CameraScript =Camera.main.GetComponent<MoveCamera>();
		m_CameraScript.enabled = false;
		StartCoroutine (CountDown ());
	}
        public LevelCompleteState(Serpents serpents)
        {
            _serpents = serpents;

            _homingDevice = new HomingDevice(_serpents);
            _serpents.PlayerSerpent.DirectionTaker = this;

            Vector3 toPosition, toLookAt;
            _serpents.PlayingField.GetCameraPositionForLookingAtPlayerCave(out toPosition, out toLookAt);

            _moveCamera = new MoveCamera(
                _serpents.Camera,
                4.5f.UnitsPerSecond(),
                toPosition,
                () => _serpents.PlayerSerpent.LookAtPosition);

            _serpents.PlayerCave.OpenDoor = true;

            // wait until serpent is in cave, then give length bonus
            _todo.AddOneShot(() => _homeIsNearCaveEntrance = true);
            _todo.AddWhile(time => !_serpentIsHome);
            _todo.AddOneShot(() =>
            {
                _serpents.PlayerSerpent.IsPregnant = false;
                _haltSerpents = true;
            });
            for (var i = 0; i < _serpents.PlayerSerpent.Length; i++)
                _todo.AddOneShot(1, () =>
                {
                    var tailSegement = _serpents.PlayerSerpent.RemoveTailWhenLevelComplete();
                    if (tailSegement != null)
                        _serpents.AddAndShowScore(500, tailSegement.Position);
                });

            // wait until all bonus texts gone
            _todo.AddWhile(time => _serpents.FloatingTexts.Items.Any());
            _todo.AddOneShot(() =>
            {
                _serpentIsHome = false;
                _haltSerpents = false;
                _homeIsNearCaveEntrance = false;
            });
            //_todo.AddWhile(time => !_serpentIsHome);

            _todo.AddOneShot(() =>
            {
                if (_serpents.PlayerEgg == null)
                {
                    _haltSerpents = false;
                    return;
                }
                _bonusLives = 1;
                _serpents.PlayerSerpent.DirectionTaker = null;
                var playerEggPosition = _serpents.PlayerEgg.Position;
                _moveCamera = new MoveCamera(_serpents.Camera, 2f.Time(), toPosition, () => playerEggPosition);
                // wait two sec (for camera) and then drive the baby home
                _todo.InsertNext(
                    time => time < 2,
                    time =>
                    {
                        _serpents.PlayerSerpent.Restart(_serpents.PlayingField, 0, _serpents.PlayerEgg.Whereabouts);
                        _serpents.PlayerEgg = null;
                        _serpents.PlayerSerpent.DirectionTaker = this;
                        _haltSerpents = false;
                        _serpentIsHome = false;
                        return false;
                    });
            });

            // make sure the camera aims at a serpent (the original or the new born baby)
            _todo.AddOneShot(() =>
            {
                _moveCamera = new MoveCamera(_serpents.Camera, 1f.Time(), toPosition, () => _serpents.PlayerSerpent.LookAtPosition);
            });

            _todo.AddWhile(time => (!_serpentIsHome || _serpents.FloatingTexts.Items.Any()) && time < 10);
        }
 // Use this for initialization
 void Start()
 {
     correct = 0;
     streak_mode = false;
     streak_score = 0;
     lives = 5;
     mathius_variable = (int)Mathf.Floor(Random.Range(0, 9));
     num_correct = 0;
     num_wrong = 0;
     equation = "";
     moveCamera = GameObject.Find("MathiusEarthCam").GetComponent("MoveCamera") as MoveCamera;
 }