예제 #1
0
 private void Awake()
 {
     self      = this;
     visuals   = GetComponent <gamestateVisuals>();
     camShaker = Camera.main.GetComponent <cameraShake>();
     gameTimer = self.gameTime;
 }
예제 #2
0
 void Start()
 {
     shake          = Camera.main.GetComponent <cameraShake> ();
     col            = gameObject.GetComponent <SpriteRenderer> ().color;
     small_astroid  = Resources.Load("Prefabs/Enemies/small_astroid") as GameObject;
     medium_astroid = Resources.Load("Prefabs/Enemies/medium_astroid") as GameObject;
     large_astroid  = Resources.Load("Prefabs/Enemies/large_astroid") as GameObject;
 }
예제 #3
0
 void Start()
 {
     camShake = GameScript.gm.GetComponent <cameraShake> ();
     if (camShake == null)
     {
         Debug.LogError("No Camera Shake");
     }
 }
예제 #4
0
    }                                                 //Easier to debug

    void Start()
    {
        camShake = GameScript.gm.GetComponent <cameraShake> ();
        if (camShake == null)
        {
            Debug.LogError("No Camera Shake");              //Get camera shake component, if not found, return error
        }
    }
예제 #5
0
 void Start()
 {
     dashTime     = startDashTime;
     currentState = "Idle";
     SetCharacterState(currentState);
     SceneIndex  = SceneManager.GetActiveScene().buildIndex;
     cameraShake = GameObject.Find("CameraControllerContainer").GetComponent <cameraShake>();
     //Infoscript.instance.UpdateDashAmulette();
 }
예제 #6
0
    // Start is called before the first frame update
    void Start()
    {
        bulletDir   = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        bulletDir.z = 0;
        bulletDir.Normalize();

        cameraShake = GameObject.Find("Main Camera").GetComponent <cameraShake>();

        Destroy(gameObject, 3f);
    }
예제 #7
0
    // Use this for initialization
    void Start()
    {
        crate = GameObject.Find("crate1");

        cratesound1 = GetComponent <AudioSource>();

        cameraShake = new cameraShake();

        fx_fire_a = GetComponent <ParticleSystem>();

        inputGiven = false;
        speed      = 0.5f;
    }
예제 #8
0
    void Start()
    {
        camShake = GameScript.gm.GetComponent <cameraShake> ();
        if (camShake == null)
        {
            Debug.LogError("No Camera Shake");              //Checks if camShake has a value
        }

        firePointBoss = transform.Find("firePointBoss");          //Find the firePos object
        if (firePointBoss == null)
        {
            Debug.LogError("No Fire Point for boss");              //Return an error if not found
        }
    }
예제 #9
0
    private void Start()
    {
        //progressManager = GameObject.Find("ProgressManager").GetComponent<ProgressSave>();

        //HealthPoints = progressManager.playerHP;
        //maxDash = progressManager.playerMaxdash;
        currDash = maxDash;

        //Infoscript.instance.UpdateHealthpoints();
        //Infoscript.instance.UpdateDashAmulette();
        cameraShake = GameObject.Find("CameraControllerContainer").GetComponent <cameraShake>();

        ProgressCollectables = GameObject.Find("CollectablesProgress").GetComponent <NoDestruction>();
        Infoscript.instance.UpdateDashAmulette();
    }
예제 #10
0
    void Start()
    {
        //NEW CODE HERE
        GameObject shieldControllerObject   = GameObject.FindWithTag("ShieldController");
        GameObject playerHealthObject       = GameObject.FindWithTag("Health");
        GameObject gameControllerObject     = GameObject.FindWithTag("GameController");
        GameObject shotSpawnObject          = GameObject.FindWithTag("ShotSpawn");
        GameObject camShakeControllerObject =
            GameObject.FindWithTag("MainCamera");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent <GameController>();
            camShake       =
                camShakeControllerObject.GetComponent <cameraShake>();
        }
        if (playerHealthObject != null)
        {
            playerHealth = playerHealthObject.GetComponent <PlayerHealth>();
        }
        if (shieldControllerObject != null)
        {
            shieldController = shieldControllerObject.GetComponent <ShieldController>();
        }
        if (shotSpawnObject != null)
        {
            shotSpawnController = shotSpawnObject.GetComponent <ShotSpawn>();
        }


        fileName = "shoot";
        file     = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt");
        //LoadShot();
        if (PlayerPrefs.HasKey("Shot"))
        {
            loadedFireType = PlayerPrefs.GetInt("Shot");
        }
        else
        {
            loadedFireType = 1;
        }


        fireType  = loadedFireType;
        rigidBody = gameObject.GetComponent <Rigidbody2D>();
    }
예제 #11
0
    public void Die()
    {
        Global pg = GameObject.FindGameObjectWithTag("FGlobal").GetComponent <Global>();

        if (pg.playerlifeGlobal == 3)
        {
            Instantiate(explosion, gameObject.transform.position, Quaternion.identity);
            AudioSource.PlayClipAtPoint(deathclip, gameObject.transform.position, 20);
            RawImage pi = GameObject.FindGameObjectWithTag("lifeimg1").GetComponent <RawImage>();
            pi.color = Color.red;
            pg.playerlifeGlobal--;
            gameObject.transform.transform.position = new Vector3(0, 0, -13.2f);
            cameraShake cs = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <cameraShake>();
            cs.shouldShake = true;
        }
        else if (pg.playerlifeGlobal == 2)
        {
            Instantiate(explosion, gameObject.transform.position, Quaternion.identity);

            AudioSource.PlayClipAtPoint(deathclip, gameObject.transform.position, 20);
            RawImage pi = GameObject.FindGameObjectWithTag("lifeimg2").GetComponent <RawImage>();
            pi.color = Color.red;
            pg.playerlifeGlobal--;
            gameObject.transform.transform.position = new Vector3(0, 0, -13.2f);
            cameraShake cs = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <cameraShake>();
            cs.shouldShake = true;
        }
        else if (pg.playerlifeGlobal == 1)
        {
            playertime = 0;
            Instantiate(explosion, gameObject.transform.position, Quaternion.identity);
            AudioSource.PlayClipAtPoint(deathclip, gameObject.transform.position, 20);
            RawImage pi = GameObject.FindGameObjectWithTag("lifeimg3").GetComponent <RawImage>();
            pi.color = Color.red;
            pg.playerlifeGlobal--;
            cameraShake cs = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <cameraShake>();
            cs.shouldShake = true;
            GetComponent <Renderer>().enabled = !GetComponent <Renderer>().enabled;
            jetsrc sss = GameObject.FindGameObjectWithTag("playerengine").GetComponent <jetsrc>();
            sss.Die();
            StartCoroutine(LoadLevelAfterDelay(1.0f));
            //SceneManager.LoadScene("gameover");
        }
    }
예제 #12
0
    // Start is called before the first frame update
    private void Start()
    {
        shake = GameObject.FindGameObjectWithTag("CameraShake").GetComponent <cameraShake>();

        playerController = GameObject.FindWithTag("Player");
        if (playerController != null)
        {
            pc = playerController.GetComponent <playerController>();
        }

        if (pc.facingRight == true)
        {
            orientation = 1;
        }
        else
        {
            orientation = -1;
        }

        Invoke("destroyProjectile", duration);
    }
예제 #13
0
    // Start is called before the first frame update
    void Start()
    {
        anim           = GetComponent <Animator>();
        rb             = GetComponent <Rigidbody2D>();
        shake          = GameObject.FindGameObjectWithTag("CameraShake").GetComponent <cameraShake>();
        dashTime       = startDashTime;
        originalSpeed  = speed;
        lowHealthColor = new Color(0.53725490196f, 0.21176470588f, 0.21176470588f, 1.0f);

        //sets collectible amount in UI and reads from playerprefs
        if (collectibleExists == true)
        {
            collectibleCounter.text = PlayerPrefs.GetFloat(collectibleType).ToString() + "/" + maxCollectibles.ToString();
        }
        collectibleCount = PlayerPrefs.GetFloat(collectibleType);

        if (PlayerPrefs.GetFloat("health") > 0)
        {
            health = PlayerPrefs.GetFloat("health");
        }
    }
예제 #14
0
 public override void star()
 {
     shake = cameraShake.instance;
 }
예제 #15
0
 void Start()
 {
     cameraShake = GameObject.Find("Main Camera").GetComponent <cameraShake>();
 }
예제 #16
0
 void Awake()
 {
     instance = this;
 }
예제 #17
0
 void Start()
 {
     instance = this;
 }
예제 #18
0
 // Use this for initialization
 void Awake()
 {
     score = GameObject.Find("Player").GetComponent <PlayerClass> ();
     sez   = GameObject.Find("Main Camera").GetComponent <cameraShake> ();
     //prefab = Resources.Load ("Prefabs/explosion") as GameObject;
 }
예제 #19
0
    void Start()
    {
        //NEW CODE HERE
        GameObject shieldControllerObject = GameObject.FindWithTag("ShieldController");
        GameObject playerHealthObject = GameObject.FindWithTag("Health");
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        GameObject shotSpawnObject = GameObject.FindWithTag("ShotSpawn");
        GameObject camShakeControllerObject =
          GameObject.FindWithTag("MainCamera");

        if (gameControllerObject != null)
        {
            gameController = gameControllerObject.GetComponent<GameController>();
            camShake =
              camShakeControllerObject.GetComponent<cameraShake>();
        }
        if (playerHealthObject!=null)
        {
            playerHealth = playerHealthObject.GetComponent<PlayerHealth>();
        }
        if (shieldControllerObject != null)
        {
            shieldController = shieldControllerObject.GetComponent<ShieldController>();
        }
        if (shotSpawnObject != null)
        {
            shotSpawnController = shotSpawnObject.GetComponent<ShotSpawn>();
        }

        fileName = "shoot";
        file = new FileInfo(Application.persistentDataPath + "\\" + fileName + ".txt");
        //LoadShot();
        if (PlayerPrefs.HasKey("Shot"))
        {
            loadedFireType = PlayerPrefs.GetInt("Shot");
        }
        else
        {
            loadedFireType = 1;
        }

        fireType = loadedFireType;
        rigidBody = gameObject.GetComponent<Rigidbody2D>();
    }
예제 #20
0
    public static cameraShake instance; // creates a new instance of this class, we make this static so that we can access it from outside of this class without needing a reference
    #endregion

    #region Constructor
    public cameraShake()
    {
        instance = this; // initialises the variable "instance" to this class
    }