Inheritance: MonoBehaviour
    public bool CR_RUNNING;       //Is the animation Coroutine running?

    void Start()
    {
        _transform       = transform;
        _cameraBehaviour = gameController.GetComponent <CameraBehaviour>();
        xAxis            = _transform.GetChild(0);
        offset           = xAxis.GetChild(0);
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        camBeh = cam.GetComponent <CameraBehaviour>();
        canvas = GetComponent <Canvas>();

        LayoutRects();
    }
Esempio n. 3
0
    IEnumerator TransitionToBehaviour(CameraBehaviour newBehaviour, bool awake = false)
    {
        if (ShowDebug)
        {
            Debug.Log("(Camera Master) Blending behaviors.");
            if (!newBehaviour.BlendOnEnter)
            {
                Debug.Log("No blend settings, using Default");
            }
        }

        if (awake)
        {
            SetNewBehaviourValues(newBehaviour);
            yield break;
        }

        CameraBlendSettings blend = newBehaviour.BlendOnEnter ? newBehaviour.BlendOnEnter : CameraBlendSettings.Default;

        _isTransitingBehaviours = true;

        for (float f = 0; f < 1; f += Time.deltaTime / blend.Duration)
        {
            _height        = Mathf.Lerp(_lastHeight, newBehaviour.Height, EasedLerp.EaseLerp(f, blend.Easing));
            _maxDistance   = Mathf.Lerp(_lastMaxDistance, newBehaviour.MaxDistance, EasedLerp.EaseLerp(f, blend.Easing));
            _localOffset   = Vector3.Lerp(_lastLocalOffset, newBehaviour.LocalOffset, EasedLerp.EaseLerp(f, blend.Easing));
            _localRotation = Vector3.Lerp(_lastLocalRotation, newBehaviour.LocalRotation, EasedLerp.EaseLerp(f, blend.Easing));

            yield return(null);
        }

        SetNewBehaviourValues(newBehaviour);
        _isTransitingBehaviours = false;
    }
Esempio n. 4
0
    void Awake()
    {
        gameManager     = FindObjectOfType <GameManager> ();
        cameraBehaviour = FindObjectOfType <CameraBehaviour> ();
        playerInput     = FindObjectOfType <PlayerInput> ();

        boxCollider    = GetComponent <BoxCollider2D> ();
        spriteRenderer = GetComponentInChildren <SpriteRenderer> ();

        if (playerInput == null)
        {
            playerInput = gameObject.AddComponent <PlayerInput> ();
        }

        itemLayerMask = LayerMask.GetMask("Item");

        rigid = GetComponent <Rigidbody2D> ();

        controller = GetComponent <Controller2D> ();

        facingRight = true;

        LaguesAwake();

        lastJumpRequest = -jumpRequestTime;
    }
Esempio n. 5
0
 public static WorldEntity InstantiateClientEntity(WorldEntity entity, ClientPlayer owner, ClientTile tile)
 {
     var knownEntity = owner.GetKnownEntity(entity.Id);
     if (entity is Party)
     {
         var party = (Party)entity;
         var clientParty = knownEntity==null ? new ClientParty(owner, party) : ((ClientParty)knownEntity).Update(party);
         owner.Parties[party.PartyIndex] = clientParty;
         clientParty.Id = party.Id;
         clientParty.GetGameObject().SetActive(true);
         owner.KnowAbout(clientParty);
         return clientParty;
     } else if (entity is Building)
     {
         var building = (Building)entity;
         var clientBuilding = knownEntity==null ?new ClientBuilding(building.SpecID, owner, tile) : (ClientBuilding)knownEntity;
         clientBuilding.Id = building.Id;
         tile.StaticEntity = clientBuilding;
         if (building.SpecID == StrategyGame.Specs.InitialBuilding && clientBuilding.IsMine())
             CameraBehaviour.FocusOnTile(tile);
         clientBuilding.GetGameObject().SetActive(true);
         owner.KnowAbout(clientBuilding);
         return clientBuilding;
     }
     else if (entity is Dungeon)
     {
         var clientDungeon = knownEntity == null ? new ClientDungeon((Dungeon)entity, tile) : (ClientDungeon)knownEntity;
         tile.StaticEntity = clientDungeon;
         owner.KnowAbout(clientDungeon);
         clientDungeon.GetGameObject().SetActive(true);
         return clientDungeon;
     } else
         throw new Exception($"Entity Factory does not know how to instantiate {entity.GetType().Name}");
 }
 void Start()
 {
     cb = Camera.main.GetComponent<CameraBehaviour> ();
     lsc = GetComponent<CQE_level3_showComic> ();
     aus = audioObj.GetComponent<AudioSource> ();
     amount = aus.volume / 10;
 }
Esempio n. 7
0
 void Awake()
 {
     pj  = GetComponent <PlayerJumpBehaviour>();
     rb  = GetComponent <Rigidbody2D>();
     ait = GetComponent <ActiveInTimeLayerBehaviour>();
     cb  = GetComponent <CameraBehaviour>();
 }
 public CameraController()
 {
     _cameraServices  = Services.Instance.CameraServices;
     _cameraBehaviour = _cameraServices.CameraMain.GetComponent <CameraBehaviour>();
     _enemiesData     = Data.Instance.EnemiesData;
     _characterData   = Data.Instance.Character;
 }
Esempio n. 9
0
    public void Kill()
    {
        CameraBehaviour cb = Camera.main.gameObject.GetComponent <CameraBehaviour>();

        if (cb != null)
        {
            cb.Shake(1f, 20.0f);
        }

        // Set these to zero to hide the GUI elements
        numCharges  = 0;
        thrustTimer = 0.0f;

        GameObject.Find("SoundManager").GetComponent <FmodBehaviour>().RockImpact();

        try {
            GameObject.Find("SoundManager").GetComponent <FmodBehaviour>().RockImpact();
        } catch (System.Exception e) {
        }


        // Send message to the GameController that we died
        gameController.StartLevelReset();

        explodeparts();

        // Quick hack, because we're already destroyed before the level reset message comes to use
        gameObject.SendMessage("OnLevelReset", null, SendMessageOptions.DontRequireReceiver);

        // Destroy ourself
        Destroy(gameObject);
    }
Esempio n. 10
0
 void Awake()
 {
     CameraManager = FindObjectOfType <CameraBehaviour>();
     MyDictionary  = FindObjectOfType <DictionaryManager>();
     //ColourManager = FindObjectOfType<ColourManager>();
     ScoreHistoryManager = FindObjectOfType <ScoreHistoryManager>();
 }
Esempio n. 11
0
    public void SetMode(CameraBehaviour mode, Transform target, bool interpolate = true, UnityAction interpolateCallback = null)
    {
        state = mode;
        switch (state)
        {
        case CameraBehaviour.Anchored:
            motion.Kill();
            if (interpolate)
            {
                motion = transform.DOMove(target.position, 1f);
                if (interpolateCallback != null)
                {
                    interpolateCallback();
                }
            }
            else
            {
                transform.position = target.position;
            }
            break;

        case CameraBehaviour.FollowTarget:
            SetTarget(target, interpolate);
            break;
        }
    }
Esempio n. 12
0
 private void InterpreterOnZoomOut()
 {
     cameraBehaviour = cameraBehaviour.ZoomOut(pathElementsList[actualElementIndex]);
     #region DEBUG
         Debug.Log("Zoom out. Actual state is" + cameraBehaviour.GetType().Name);
     #endregion
 }
Esempio n. 13
0
    private void Awake()
    {
        if (_instance == null)
        {
            _instance = this;
        }
        else
        {
            Destroy(this);
        }

        inputs.Add("Move_North", KeyCode.W);
        inputs.Add("Move_South", KeyCode.S);
        inputs.Add("Move_West", KeyCode.A);
        inputs.Add("Move_East", KeyCode.D);
        inputs.Add("Move_North_2", KeyCode.UpArrow);
        inputs.Add("Move_South_2", KeyCode.DownArrow);
        inputs.Add("Move_West_2", KeyCode.LeftArrow);
        inputs.Add("Move_East_2", KeyCode.RightArrow);

        inputs.Add("Zoom_In", KeyCode.PageUp);
        inputs.Add("Zoom_Out", KeyCode.PageDown);


        inputs.Add("SpeedUp_Time", KeyCode.Period);
        inputs.Add("SlowDown_Time", KeyCode.Comma);
        inputs.Add("TimeScale_1", KeyCode.Alpha1);
        inputs.Add("TimeScale_2", KeyCode.Alpha2);
        inputs.Add("TimeScale_3", KeyCode.Alpha3);


        mainCamera = Camera.main.GetComponent <CameraBehaviour>();
    }
Esempio n. 14
0
 void Awake()
 {
     //Static instance reference
     instance = this;
     //Reference to camera
     camera = GetComponentInChildren <Camera>();
 }
    public bool OpenDoorAnimation()
    {
        if (isDoorOpen && currentDoorType == DoorType.Normal)
        {
            lightsSwitched = false;

            if (!GameManager.Instance.IsDirectLightActivated())
            {
                GameManager.Instance.SwitchMainLight();
                lightsSwitched = true;
            }

            ActiveBothRooms();

            HideDoors();
            GameManager.Instance.player.StartCrossingDoor();

            //Perform the opening
            if (isSideDoor)
            {
                CameraBehaviour cb = CameraBehaviour.Instance;
                cb.ChangeCameraBehaviourState(CameraBehaviour.CameraState.CrossDoor);
                cb.MoveAtPoint(transform.position, GameManager.Instance.GetPlayer().position.x > transform.position.x);
            }
            return(true);
        }
        else
        {
            //Sound deny opening
            return(false);
        }
    }
Esempio n. 16
0
 void Start()
 {
     Random.seed = (int)Time.realtimeSinceStartup;
     _camera     = Camera.main.GetComponent <CameraBehaviour>();
     _spawner    = GameObject.FindGameObjectWithTag("AliensSpawner").GetComponent <AliensSpawner>();
     SoldierInfo.SetActive(false);
 }
Esempio n. 17
0
    void Start()
    {
        _c  = GetComponent <CharacterController>();
        Cam = GameObject.FindObjectOfType <CameraBehaviour>();

        CameraPlacement();
    }
Esempio n. 18
0
    private void Start()
    {
        input   = GetComponent <ShipInput>();
        physics = GetComponent <ShipPhysics>();

        mainCamera = Camera.main.GetComponent <CameraBehaviour>();

        alive = true;

        InitColliders();

        inputState = State.playerInputs;
        lastState  = State.playerInputs;

        deathUI.SetActive(false);
        transform.position = GameObject.Find("worldCenter").transform.position - new Vector3(0f, 0f, GameObject.Find("worldCenter").GetComponent <outZone>().GetRadius() * 0.95f);
        possibleTargets    = new List <GameObject>();
        selectedTarget     = null;
        lockTimer          = 0f;

        GameObject[] allTurrets = GameObject.FindGameObjectsWithTag("TurretT2");
        foreach (GameObject go in allTurrets)
        {
            if (go.transform.root.gameObject == gameObject)
            {
                turret = go;
                GetComponentInChildren <WeaponShootManager>().AddTurret(turret);
                maxHealth = 2000f;
                health    = maxHealth;
                break;
            }
        }
    }
Esempio n. 19
0
 void Start()
 {
     controller   = GetComponent <CharacterController>();
     maincamera   = GameObject.FindGameObjectWithTag("MainCamera");
     camerascript = maincamera.GetComponent <CameraBehaviour>();
     anim         = this.GetComponent <Animator>();
 }
Esempio n. 20
0
 private void FindComponents()
 {
     _hud    = GameObject.FindWithTag("HUD").GetComponent <HUD>();
     _camera = GameObject.FindWithTag("MainCamera").GetComponent <CameraBehaviour>();
     _core   = GameObject.FindWithTag("Core").GetComponent <Core>();
     _audio  = GetComponent <AudioSource>();
 }
Esempio n. 21
0
    protected override void Start()
    {
        base.Start();
        EnableRandomCough();

        currentHp                = 0;
        sr.enabled               = false;
        cameraBehaviour          = FindObjectOfType <CameraBehaviour>();
        damageKnockbackThreshold = maxHp / 3;
        uiManager.UpdatePlayerHp(currentHp, currentHp, maxHp);

        if (startInTheSkies)
        {
            Respawn();
        }
        else
        {
            firstSpawn = false;
            sr.enabled = true;
            if (deferInitialization && firstSpawn)
            {
                return;
            }

            Initialize();
            MoveTo(moveToOnSpawn.transform.position);
        }
        deferInitialization = false;
    }
Esempio n. 22
0
 protected void Awake()
 {
     mainCam      = Camera.main;
     camBehaviour = mainCam.GetComponent <CameraBehaviour>();
     cannons      = new List <CannonController>();
     // Get charge bar's default values
 }
Esempio n. 23
0
 private void SetupTest()
 {
     _cameraBehaviour = GameObject.FindWithTag("Lab").GetComponent <CameraBehaviour>();
     _world           = GameObject.FindWithTag("World").GetComponent <World>();
     _character       = GameObject.FindObjectOfType <Character>();
     _cameraBehaviour.AttachToCharacter(_character);
     _uiPopup = _character.GetComponentInChildren <UIPopup>();
 }
Esempio n. 24
0
 /// <summary>
 /// Initialize core essential values at Start
 /// </summary>
 private void Start()
 {
     self_col           = GetComponent <Collider>();
     camScript          = GetComponent <CameraBehaviour>();
     collisionDetection = GetComponent <PlayerCollisionDetection>();
     playerCam          = GameObject.FindGameObjectWithTag("MainCamera");
     Physics.gravity    = Vector3.up * -GRAVITY;
 }
Esempio n. 25
0
    public void SetUp(ref SO_GameState _currentState)
    {
        player = ReInput.players.GetPlayer(0);

        currentState = _currentState;

        cameraController = Camera.main.GetComponent <CameraBehaviour>();
    }
Esempio n. 26
0
    public State()
    {
        Name = GetType().Name.Replace("State", "");

        Previous = StateMachine.State;
        player   = GameManager.Player;
        camera   = GameManager.Camera;
    }
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.name == "Player")
     {
         CameraBehaviour camBehaviour = Camera.main.GetComponent <CameraBehaviour>();
         camBehaviour.DisableFocus();
     }
 }
Esempio n. 28
0
 void Update()
 {
     if (cameraBehaviour == null)
     {
         cameraBehaviour = Camera.main.GetComponent <CameraBehaviour>();
     }
     cameraBehaviour.HandleCameraMovement();
 }
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.name == "Player")
     {
         CameraBehaviour camBehaviour = Camera.main.GetComponent <CameraBehaviour>();
         camBehaviour.EnableFocus(positionToHold);
     }
 }
Esempio n. 30
0
 protected virtual void Awake()
 {
     _audioSource     = GetComponent <AudioSource>();
     _audioManager    = AudioManager.Instance;
     _poolManager     = PoolManager.Instance;
     _characterLight  = GetComponentInChildren <CharacterLight>();
     _cameraBehaviour = CameraBehaviour.Instance;
     Image            = GetComponent <Image>();
 }
Esempio n. 31
0
    private void Awake()
    {
        self      = (CameraBehaviour)target;
        playerCam = GameObject.Find("Main Camera");
        camAnchor = GameObject.Find("Camera Anchor");

        self.playerCam = playerCam;
        self.camAnchor = camAnchor;
    }
    public void StartTest(PlayerPlatformController param0, CameraBehaviour param1)
    {
        player       = param0;
        cameraObject = param1;

        RestartTest();

        StartCoroutine(Introduction(0.5f, 0.5f, 0.5f, 6.0f));
    }
Esempio n. 33
0
    public void ExplodeAndInstantiate(GameObject obj)
    {
        StartCoroutine(ExplodeAction(obj));

        if (screen == null) {
            screen = (CameraBehaviour) FindObjectOfType(typeof(CameraBehaviour));
        }

        screen.ShakeTime(0.5f);
    }
Esempio n. 34
0
    public void Explode()
    {
        StartCoroutine(ExplodeAction(null));

        if (screen == null) {
            screen = (CameraBehaviour) FindObjectOfType(typeof(CameraBehaviour));
        }

        screen.ShakeTime(0.5f);
    }
Esempio n. 35
0
    private void placePlayerAndCamera(Transform player, Dungeon dungeon, CameraBehaviour mainCameraBehaviour)
    {
        Vector3 initialPosition;

        ConcreteRoom initialRoom = dungeon.getInitialRoom();

        initialPosition = new Vector3(initialRoom.getRoomPrefab().localScale.x * initialRoom.x, 1.1f, initialRoom.getRoomPrefab().localScale.z * initialRoom.y);
        mainCameraBehaviour.setInitialPosition(initialPosition);

        player.transform.position = initialPosition;
    }
Esempio n. 36
0
 private void CheckInput() {
     if(Input.GetKeyDown(KeyCode.Space)) {
         
         if(currentBehaviour is FollowHeroCam) {
             currentBehaviour = new TacticalViewCam();
         }
         else {
             currentBehaviour = new FollowHeroCam(GameObject.Find("Hero"), GameObject.Find("Main Camera Base"));
         }
     }
 }
Esempio n. 37
0
 private void FindComponents()
 {
     _hud = GameObject.FindWithTag("HUD").GetComponent<HUD>();
     _camera = GameObject.FindWithTag("MainCamera").GetComponent<CameraBehaviour>();
     _core = GameObject.FindWithTag("Core").GetComponent<Core>();
     _audio = GetComponent<AudioSource>();
 }
Esempio n. 38
0
 public void SlideClicked(string targetName)
 {
     actualElementIndex = pathElementsList.IndexOfFirst(x => x.name == targetName);
     cameraBehaviour.Swipe(pathElementsList[actualElementIndex]);
     cameraBehaviour = cameraBehaviour.ZoomIn(pathElementsList[actualElementIndex]);
 }
Esempio n. 39
0
 void Start()
 {
     Random.seed = (int) Time.realtimeSinceStartup;
     _camera = Camera.main.GetComponent<CameraBehaviour>();
     _spawner = GameObject.FindGameObjectWithTag("AliensSpawner").GetComponent<AliensSpawner>();
     SoldierInfo.SetActive(false);
 }
Esempio n. 40
0
 private void FindComponents()
 {
     _camera = GameObject.FindWithTag("MainCamera").GetComponent<CameraBehaviour>();
     _character = GameObject.FindWithTag("PlayerCharacter").GetComponent<PlayerCharacter>();
 }
Esempio n. 41
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
     var gallerySlotsUnorder = GameObject.FindGameObjectsWithTag("PathElement");
     pathElementsList = (from element in gallerySlotsUnorder
         let number = int.Parse(element.name.Split('_')[1])
         orderby number
         select element.transform).ToArray();
     actualElementIndex = 0;
     Interpreter = new UserMovesInterpreter(touchSettings);
     CameraSettings.Camera = transform;
     cameraBehaviour = new Zoom0Behaviour(CameraSettings);
     Interpreter.panGesture += InterpreterOnPanGesture;
     Interpreter.swipe += InterpreterOnSwipe;
     Interpreter.zoomIn += InterpreterOnZoomIn;
     Interpreter.zoomOut += InterpreterOnZoomOut;
 }
Esempio n. 42
0
    // Use this for initialization
    void Start()
    {
        colors = gameObject.GetComponentsInChildren<ColorItem>();

        foreach (ColorItem curColor in colors)
        {
            curColor.SetManager(this);
        }

        m_Manager = GameObject.FindGameObjectWithTag("Level").GetComponent<LevelManager>();
        cameras = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraBehaviour> ();
        pandaColor = GameObject.FindGameObjectWithTag("Player").GetComponent<PandaColor> ();

        ColorShift (eColor.White);
    }
Esempio n. 43
0
	// Use this for initialization
	void Start () {
        //currentBehaviour = new FollowHeroCam(GameObject.Find("Hero"), GameObject.Find("Main Camera Base"));

        currentBehaviour = new TacticalViewCam();
	}
Esempio n. 44
0
    public void takeDamage()
    {
        if (screen == null) {
            screen = (CameraBehaviour) FindObjectOfType(typeof(CameraBehaviour));
        }
        screen.HeavyShakeTime(0.7f);
        audio.PlayOneShot(subHit);
        hitParticles.Play();

        Debug.Log("Taking Damage!");
        leakMultiplyer = leakMultiplyer + damageInc;

        float hullHealth = getHullHealth();
        if (hullHealth < 100f && damageLeaks.Length > 0 && !damageLeaks[0].isPlaying) {
            damageLeaks[0].Play();
        }

        if (hullHealth <= 70f && damageLeaks.Length > 1 && !damageLeaks[1].isPlaying) {
            damageLeaks[1].Play();
        }

        if (hullHealth <= 50f && damageLeaks.Length > 2 && !damageLeaks[2].isPlaying) {
            damageLeaks[2].Play();
            audio.PlayOneShot(geiserSound);
        }

        if (hullHealth <= 20f && damageLeaks.Length > 3 && !damageLeaks[3].isPlaying) {
            damageLeaks[3].Play();
            audio.PlayOneShot(geiserSound);
        }

        if (hullHealth <= 20) {
            hullText.color = Color.red;
        }
        hullText.text = "hull: " + Mathf.RoundToInt(hullHealth / 10f) + "0";
    }
Esempio n. 45
0
 void Awake()
 {
     m_camera = GameObject.Find(CameraName).GetComponent<CameraBehaviour>();
     m_razor = GameObject.Find(RazorName).GetComponent<RazorBehaviour>();
 }
Esempio n. 46
0
 void Start()
 {
     controller = GetComponent<CharacterController>();
     maincamera = GameObject.FindGameObjectWithTag("MainCamera");
     camerascript = maincamera.GetComponent<CameraBehaviour>();
     anim = this.GetComponent<Animator>();
 }