Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     player          = GameObject.FindGameObjectWithTag("Player");
     playerPrefab    = GameObject.FindGameObjectWithTag("Player");
     playerCollider  = GameObject.FindGameObjectWithTag("Player").GetComponent <CapsuleCollider2D>();
     playerBehaviour = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
     ammoBehaviour   = GameObject.FindGameObjectWithTag("Player").GetComponent <AmmoBehaviour>();
     ReduceAmmoBar();
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     playerBehaviour = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
     if (playerBehaviour.uiActive)
     {
         spawnInk = GameObject.Find("InkSpray").GetComponent <SpawnInk>();
     }
     ammoBehaviour = FindObjectOfType <AmmoBehaviour>();
 }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     GM = GameObject.Find("GameManager").GetComponent <GameManager>();
     playerBehaviour     = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
     PrS                 = GameObject.Find("InkSpray").GetComponent <ParticleSystem>();
     collisionEvents     = new List <ParticleCollisionEvent>();
     settings            = PrS.main;
     settings.startColor = new ParticleSystem.MinMaxGradient(ClearColour);
     ammoBehaviour       = FindObjectOfType <AmmoBehaviour>();
 }
Exemplo n.º 4
0
    private void shoot()
    {
        shootsfx        = GetComponent <AudioSource>();
        shootsfx.volume = 0.5f;
        shootsfx.PlayOneShot(shootsfx.clip);

        GameObject    NewAmmo = (GameObject)Instantiate(ammo, ammospawner.transform.position, this.transform.rotation);
        AmmoBehaviour AMMO    = NewAmmo.GetComponent <AmmoBehaviour>();

        if (AMMO != null)
        {
            AMMO.ConfirmEnemy(currentTarget.transform, damageMultiplier);
        }
    }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        if (gameManager == null)
        {
            gameManager = this;
        }

        playerScale = player.transform.localScale;
        Debug.Log(playerScale);
        player          = GameObject.FindGameObjectWithTag("Player");
        playerPrefab    = GameObject.FindGameObjectWithTag("Player");
        playerCollider  = GameObject.FindGameObjectWithTag("Player").GetComponent <CapsuleCollider2D>();
        playerBehaviour = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerBehaviour>();
        ammoBehaviour   = GameObject.FindGameObjectWithTag("Player").GetComponent <AmmoBehaviour>();
    }
Exemplo n.º 6
0
 void Start()
 {
     Time.timeScale = 1;
     if (mainUI == null)
     {
         mainUI = GameObject.FindGameObjectWithTag("UI");
     }
     UICheck();
     playerScale   = Player.transform.lossyScale;
     anim          = GetComponent <Animator>();
     Player        = GameObject.FindGameObjectWithTag("Player");
     gameManager   = GameObject.FindGameObjectWithTag("GM").GetComponent <GameManager>();
     groundCheck   = GameObject.Find("Ground Check").transform;
     ammoBehaviour = FindObjectOfType <AmmoBehaviour>();
 }
Exemplo n.º 7
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            // Damage the Player
            playerInjure.Play();
            other.gameObject.GetComponent <PlayerController>().TakeDamage(damageAmount);
            // Shake screen when player gets hit.
            cameraObject.GetComponent <CameraShaker>().TriggerShake();
            // Destroy the Virus.
            Destroy(this.gameObject);
        }

        if (other.gameObject.CompareTag("Bullet"))
        {
            // Make the splash effect.
            Instantiate(splashEffect, transform.position, Quaternion.identity);
            // Destroy the bullet.
            Destroy(other.gameObject);
            // Take damage from the bullet.
            AmmoBehaviour bullet = other.gameObject.GetComponent <AmmoBehaviour>();
            TakeDamage(bullet.damageAmount);
        }
    }
Exemplo n.º 8
0
 void Start()
 {
     Projectilebehaviour = GameObject.Find("Test block").GetComponent <ProjectileBehaviour> ();
     Ammobehaviour       = GameObject.Find("Cannon").GetComponent <AmmoBehaviour> ();
 }