Inheritance: MonoBehaviour
Exemplo n.º 1
0
 void Awake()
 {
     options     = new Options();
     screenshake = new Screenshake();
     particles   = new particleManager();
     level       = "doi";
 }
Exemplo n.º 2
0
 void Start()
 {
     wait         = new WaitForSeconds(fdelay);
     holdOn       = new WaitForSeconds(fdelay * 5);
     _Screenshake = cam.GetComponent <Screenshake>();
     BatteryGO    = _levelGenerator.BatteryGameOject;
     _Battery     = BatteryGO.GetComponentInChildren <Battery>();
 }
Exemplo n.º 3
0
    void Start()
    {
        ui          = FindObjectOfType <UiManager>();
        ballVis     = FindObjectOfType <BallVisuals>();
        screenshake = FindObjectOfType <Screenshake>();
        player      = GameObject.FindGameObjectWithTag("Player");

        resetLevel();
    }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        lives         = 5;
        points        = 0;
        messagePoints = 0;
        //Camera.main.aspect = (Screen.currentResolution.width / Screen.currentResolution.height); //so this would stretch the game scene in order to adjust it to the Device's screen

        screenshake = GetComponent <Screenshake>();
        head        = GameObject.Find("Head").GetComponent <SpriteRenderer>();
    }
Exemplo n.º 5
0
    void Awake()
    {
        fixedRot = transform.rotation;

        rb          = GetComponent <Rigidbody2D>();
        hitStop     = FindObjectOfType <HitStop>();
        movement    = GetComponent <BallMovement>();
        screenshake = FindObjectOfType <Screenshake>();
        trail       = GetComponentInChildren <TrailRenderer>();
        sprite      = visualBall.GetComponent <SpriteRenderer>();
    }
Exemplo n.º 6
0
 // Start is called before the first frame update
 void Start()
 {
     target = Component.FindObjectOfType <Player>();
     body   = GetComponent <Rigidbody2D>();
     aiPath = GetComponent <AIPath>();
     GetComponent <AIDestinationSetter>().target = target.transform;
     if (camera == null)
     {
         camera = FindObjectOfType <Screenshake>();
     }
 }
Exemplo n.º 7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
    public static void Shake(this Camera cam)
    {
        Screenshake shake = cam.transform.GetComponent <Screenshake>();

        if (shake != null)
        {
            shake.Shake();
        }
        else
        {
            Debug.Log("Camera doesn't have Screenshake component, adding one!");
            cam.transform.gameObject.AddComponent <Screenshake>().Shake();            //add and shake
        }
    }
Exemplo n.º 9
0
    void Start()
    {
        //almostdead = true;
        rb  = GetComponent <Rigidbody2D>();
        box = GetComponent <BoxCollider2D>();
        almostDeadCircle = GetComponentInChildren <CircleCollider2D>();
        screenshake      = Camera.main.GetComponent <Screenshake>();
        defSprScale      = sprite.localScale;
        defaultScale     = pivot.transform.localScale;
        ammoText         = GetComponentInChildren <TextMesh>();
        camera           = Camera.main.gameObject;
        reticleScale     = reticle.GetComponent <Animation>();
//		Debug.Log(InputManager.Devices);
        //player1 = InputManager.Devices[playerId];


        foreach (GameObject g in GameObject.FindGameObjectsWithTag("Player"))
        {
            PlayerMovementController p = g.GetComponent <PlayerMovementController>();
//			Debug.Log(p.playerId);
            if (p.playerId != this.playerId)
            {
                otherPlayer = p;
            }
        }

        player = ReInput.players.GetPlayer(playerId);
        PlayerTuning tuning = Resources.Load <PlayerTuning>("MyTune");

        runAccel        = tuning.runAccel;
        runMaxSpeed     = tuning.runMaxSpeed;
        groundDrag      = tuning.groundDrag;
        airAccel        = tuning.airAccel;
        airMaxSpeed     = tuning.airMaxSpeed;
        jumpSpd         = tuning.jumpSpd;
        gravity         = tuning.gravity;
        bonusGravity    = tuning.bonusGravity;
        jumpChargeTimer = tuning.jumpChargeTimer;
        jumpChargeMax   = tuning.jumpChargeMax;
        kick            = tuning.kick;
        wallFriction    = tuning.wallFriction;
        maxMana         = tuning.maxMana;
        timeManaDrain   = tuning.timeManaDrain;
        manaGain        = tuning.manaGain;
        bulletCooldown  = tuning.bulletCooldown;
        invulnMaxFrames = tuning.invulnMaxFrames;
        health          = tuning.health;
        GameMaster.me.updateUI();
    }
Exemplo n.º 10
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        m_virtualCamera = FindObjectOfType <Cinemachine.CinemachineVirtualCamera>();
        m_perlin        = FindObjectOfType <Cinemachine.CinemachineBasicMultiChannelPerlin>();
        ResetCamera();
    }
Exemplo n.º 11
0
 void Start()
 {
     instance = this;
 }
 void Awake()
 {
     screenshake   = FindObjectOfType <Screenshake>();
     carController = FindObjectOfType <CarController>();
 }
Exemplo n.º 13
0
    //----------------------------------------------------------------------------
    // Game States
    //----------------------------------------------------------------------------

    // Called by SceneManager.LoadSceneAsync when the scene is loaded (but not active yet).
    void OnGameSceneLoaded(Scene scene, LoadSceneMode mode)
    {
        SceneManager.sceneLoaded -= OnGameSceneLoaded;
        Screenshake.FrameShake(Vector2.left);
        StartCoroutine(OnGameSceneActive());
    }
Exemplo n.º 14
0
 private void Awake()
 {
     Instance = this;
     vcam     = GetComponent <CinemachineVirtualCamera>();
 }
Exemplo n.º 15
0
 private void Awake()
 {
     instance = this;
 }
Exemplo n.º 16
0
 void Awake()
 {
     current      = this;
     basePosition = transform.position;
 }
Exemplo n.º 17
0
    void Awake()
    {
        cam         = Camera.main;
        player      = FindObjectOfType <BallMovement>();
        uiManager   = FindObjectOfType <UiManager>();
        screenShake = FindObjectOfType <Screenshake>();


        // Get curr lvl
        var sceneName = SceneManager.GetActiveScene().name;
        var lvlString = sceneName.Substring(sceneName.Length - 2);

        lvl = int.Parse(lvlString);

        uiManager.updateLevelDisplay(lvlString, maxLvl);


        if (lvl == 0)
        {
            uiManager.playtutorialAnimation();
        }
        else if (PlayerPrefs.GetInt("sceneSelectToggled") == 1)
        {
            player.notInTut();
        }


        // If go back to first scene, don't show tutorial again, but still be able to move
        if (lvl == 0 && PlayerPrefs.HasKey("sceneSelectToggled") && PlayerPrefs.GetInt("sceneSelectToggled") == 1)
        {
            player.notInTut();
        }


        // Do a camera animation if changed level from last load
        if (lvl != 0 && lvl != maxLvl)
        {
            var lastLvl = PlayerPrefs.GetInt("lastLvl");

            if (lastLvl > lvl)
            {
                cam.transform.position = new Vector3(17, 0, -10);
            }
            else
            {
                cam.transform.position = new Vector3(-17, 0, -10);
            }

            screenShake.setInTransition(true);

            Sequence seq = DOTween.Sequence().SetUpdate(true);
            cam.transform.DOMoveX(0, levelCameraTrans).SetEase(Ease.OutCubic).SetUpdate(true);
            seq.AppendCallback(() => screenShake.setInTransition(false));
        }

        // Progressed one level normally
        if (lvl != 0 && (PlayerPrefs.HasKey("lastLvl") && PlayerPrefs.GetInt("lastLvl") != lvl && PlayerPrefs.GetInt("sceneSelectToggled") == 0))
        {
            Vector2 playerPos = GameObject.FindGameObjectWithTag("Player").transform.position;
            var     portal    = Instantiate(portalSpawnPrefab, playerPos + portalSpawnOffset, Quaternion.identity);
            portal.GetComponent <Portal>().spawnAnim();
        }

        PlayerPrefs.SetInt("lastLvl", lvl);
    }
Exemplo n.º 18
0
 void Awake()
 {
     Instance = this;
     zero     = transform.localPosition;
     t        = 0f;
 }
Exemplo n.º 19
0
 private void Awake()
 {
     INSTANCE = this;
 }