Inheritance: MonoBehaviour
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.name.Substring(0, 6) == "Player")
        {
            Script = other.GetComponent<PlayerShoot>();

            if (this.gameObject.name == "Munition3(Clone)")
            {
                AudioSource.PlayClipAtPoint(pickUpSound, transform.position, 10f);
                Instantiate(pickUPFeedBack[0], transform.position, Quaternion.identity);
                Script.munition += 3;
            }

            if (this.gameObject.name == "Munition5(Clone)")
            {
                AudioSource.PlayClipAtPoint(pickUpSound, transform.position, 10f);
                Instantiate(pickUPFeedBack[1], transform.position, Quaternion.identity);
                Script.munition += 5;
            }

            if (this.gameObject.name == "Munition10(Clone)")
            {
                AudioSource.PlayClipAtPoint(pickUpSound, transform.position, 10f);
                Instantiate(pickUPFeedBack[2], transform.position, Quaternion.identity);
                Script.munition += 10;
            }

            Destroy(this.gameObject);
        }
    }
Beispiel #2
0
    void Awake()
    {
        VariableResourcesScript vrs = GetComponent<VariableResourcesScript>();

        players = GameObject.FindGameObjectsWithTag("Player");

        objPlayer1 = vrs.objPlayer1;
        scrPlayerScript1 = objPlayer1.GetComponent<PlayerScript>();
        scrPlayerExperience1 = objPlayer1.GetComponent<PlayerStats>();
        scrPlayerHealthScript1 = objPlayer1.GetComponent<PlayerHealthScript>();
        scrPlayerShoot1 = objPlayer1.GetComponent<PlayerShoot>();
        //objPlayer2 = vrs.objPlayer2;

        playersTag = objPlayer1.tag;
        // 8: Enemy, 15: Spawn Point, 20: Flying, 24: Neutral, 25: Immune
        intEnemyLayerMask = 1 << LayerMask.NameToLayer("Enemy") | 1 << LayerMask.NameToLayer("Flying") | 1 << LayerMask.NameToLayer("Neutral") | 1 << LayerMask.NameToLayer("Immune") | 1 << LayerMask.NameToLayer("Spawn Point");
        intHostileLayerMask = 1 << LayerMask.NameToLayer("Enemy") | 1 << LayerMask.NameToLayer("Spawn Point") | 1 << LayerMask.NameToLayer("Immune");
        intPlayerUnitsLayerMask = 1 << LayerMask.NameToLayer("Player");

        objBullet = vrs.objBullet;
        objExplodingShot = vrs.objExplodingShot;
        objArrow = vrs.objArrow;
        objFire = vrs.objFire;
        objExplosion = vrs.objExplosion;

        objTemp = vrs.objTemp;

        objText = vrs.objText;

        texAttribute = vrs.texAttribute;

        matLineOfSightSolid = vrs.matLineOfSight;
        matLineOfSightTransparent = vrs.matLineOfSightTransparent;
        matSkull = vrs.matSkull;
    }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     this.player = GetComponentInParent<PlayerController>();
     this.shoot = this.player.GetComponentInChildren<PlayerShoot>();
     this.melee = GetComponentInParent<PlayerMeleeAttack>();
     this.pushingMovementButton = false;
     this.movingRight = true;
 }
    public void FindPlayer()
    {
        playerShoot = GetComponent<PlayerShoot>();
        statController = GetComponent<StatController>();
        playerFound = true;

        
    }
Beispiel #5
0
 void Awake()
 {
     _isSlowMod = false;
     _shoot = GetComponent< PlayerShoot > ();
     ChangeMoveMod ();
     _moveToPoint = GetComponent< MoveToPoint > ();
     _moveToPoint.enabled = false;
     _pauseMenu = GameObject.Find ("Pause");
     _pauseMenu.SetActive (false);
 }
	public void OnGlobalEnable()
	{
		PlayerShoot.isChangingUIBorder += ChangingArrow;
		_giveAllObjectsToManagers = GameObject.FindGameObjectWithTag("GiveAllObjectsToManagers").GetComponent<GiveAllObjectsToManagers>();
		_arrowType = _giveAllObjectsToManagers.player.GetComponent<PlayerShoot>();
		_UIBorder  = this.GetComponent<SortGameObjectsChildrenByName>().sortArrayFromName(_giveAllObjectsToManagers.showCurrentAmmo);

		for(int i = 0; i < _UIBorder.Length; i++)
		{
			_UIBorder[i].gameObject.SetActive(false);
			_UIBorder[0].gameObject.SetActive(true);
		}
	}
    void Update()
    {
        //Debug.Log( "MenuManager Update" ) ;

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            //ZMIENIAMY STAN MENU
            menu = !menu ;
            if( menu )
            {
                //WLACZAMY INTERAKCJE ORAZ BLOKUJEMY RAYCAST
                canvasGroup.interactable = true ;
                canvasGroup.blocksRaycasts = true ;
                //WLACZAMY SCREEN MENU
                canvasMenu.SetActive( true ) ;

                //PONOWNIE POBIERAMY KOMPONENT PlayerShoot ( MOGLISMY ZMIENIC BRON )
                playerShoot = PlayerComponent.GetComponentInChildren<PlayerShoot>() ;

                //WYLACZAMY STRZELANIE
                playerShoot.enabled = false ;

                //WLACZAMY SKRYPTY ZMIANY GLOSNOSCI DZWIEKU
                changeAudioVolumeEffect.enabled = true ;
                changeAudioVolumeSound.enabled = true ;
            }
            else
            {
                //WYLACZAMY INTERAKCJE ORAZ ODBLOKOWUJEMY RAYCAST
                canvasGroup.interactable = false ;
                canvasGroup.blocksRaycasts = false ;
                //WYLACZAMY SCREEN MENU
                canvasMenu.SetActive( false ) ;

                //WLACZAMY STRZELANIE
                playerShoot.enabled = true ;

                //WYLACZAMY SKRYPTY ZMIANY GLOSNOSCI DZWIEKU
                changeAudioVolumeEffect.enabled = false ;
                changeAudioVolumeSound.enabled = false ;

                //WYLACZAMY OKNO AUDIO
                WindowInMenuTurnOFF.SetActive( false ) ;
            }

            //WLACZAMY / WYLACZAMY PAUZE
            Pause();
        }
    }
Beispiel #8
0
 void OnTriggerEnter(Collider col)
 {
     if(col.tag == VariableScript.playersTag){
         pam = col.GetComponent<PlayerAbilityManager>();
         psh = col.GetComponent<PlayerShoot>();
         pstat = col.GetComponent<PlayerStats>();
         if(Time.time >= ready && pam != null){
             int index = pam.AddAbility(gameObject);	// Adds the ability and returns the index of the slot added into (else returns -1)
             if(index != -1){
                 gameObject.SetActive(false);
                 SetUp(index);
             }
         }
     }
 }
    public void Start() {
        controller = GetComponent<CharacterController>();
        movement = GetComponent<PlayerMovement>();
		playerShoot = GetComponent<PlayerShoot>();
		networkManager = GameObject.Find("NetworkManager").GetComponent<NetworkManager>();

		if(!isLocalPlayer) {
			DisableComponents();
			AssignRemoteLayer();
		} else {
			GameManager.instance.localPlayer = this;
		}

		SetDefaults();
    }
    void Awake()
    {
        //SZUKAMY GRACZA I POBIERAMY SKRYPT
        PlayerComponent = GameObject.FindGameObjectWithTag("Player") ;
        //JESLI SZUKANIE SIE POWIODLO TO PRZYPISUJEMY COMPONENT DO OBIEKTU
        if( PlayerComponent != null )
        {
            playerShoot = PlayerComponent.GetComponentInChildren<PlayerShoot>() ;
        }
        //JESLI NIE ZNALEZLISMY LUB PRZYPISANIE SIE NIE POWIODLO WYSWIETLAMY TEKST
        if(playerShoot == null)
        {
            Debug.Log( " can't find Player PlayerShoot (MenuManager) " ) ;
        }

        canvasGroup = GetComponent<CanvasGroup>();
    }
Beispiel #11
0
	public void OnGlobalEnable()
	{
		PlayerShoot.isChangingArrow += ChangingArrow;
	
		_giveAllObjectsToManagers = GameObject.FindGameObjectWithTag("GiveAllObjectsToManagers").GetComponent<GiveAllObjectsToManagers>();
		_displayArrayHook = this.GetComponent<SortGameObjectsChildrenByName>().sortArrayFromName(_giveAllObjectsToManagers.UIArrayArrowHook);
		_displayArrayTripleArrow = this.GetComponent<SortGameObjectsChildrenByName>().sortArrayFromName(_giveAllObjectsToManagers.UIArrayArrowTriple);

		_ammo = _giveAllObjectsToManagers.player.GetComponent<PlayerShoot>();
		
		for(int i = 0; i < _displayArrayHook.Length; i++)
		{
			_displayArrayHook[i].gameObject.SetActive(false);
		}
		
		for(int i = 0; i < _displayArrayTripleArrow.Length; i++)
		{
			_displayArrayTripleArrow[i].gameObject.SetActive(false);
		}
	}
    void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Player")
        {
            //POBIERAMY SKRYPT OD GRACZA ( MOGLISMY ZMIENIC BRON )
            player = PlayerComponent.GetComponentInChildren<PlayerShoot>() ;

            //JESLI NIE ZNALEZLISMY LUB PRZYPISANIE SIE NIE POWIODLO WYSWIETLAMY TEKST
            if(player == null)
            {
                Debug.Log( " can't find Player PlayerShoot ( FastShoot )" ) ;
            }

            // player.StartCoroutine( "SpeedUP" , TimeActivate ) ;
            player.shootSpeedUP( TimeActivate ) ;

            //ODNAWIAMY SPAWN
            spawnItem.StartRespawn() ;
            //NISZCZYMY OBIEKT
            Destroy( gameObject ) ;
        }
    }
	void Awake(){
		anim = this.GetComponent<Animator> ();
		playerMove = this.GetComponent<PlayerMove> ();
		playerShoot = this.GetComponentInChildren<PlayerShoot> ();
		this.bodyRenderer = transform.Find ("Player").renderer as SkinnedMeshRenderer;
	}
    void HeIsDeath()
    {
        //GRACZ NIE ZYJE
        PlayerDead = true ;

        //USTAWIAMY ZMIENNA ANIMACJI NA TRUE
        animationPlayer.SetTrigger ("Die") ;

        //USTAWIAMY NOWY DZWIEK (SMIERC GRACZA) PO CZYM ODPALAMY GO
        playerAudio.clip = playerDeath ;
        playerAudio.Play() ;

        //POBIERAMY SKRYPT BRONI ( BO MOGLA SIE ZMIENIC )
        playerShoot = GetComponentInChildren<PlayerShoot>() ;

        //WYLACZAMY SKRYPT PORUSZANIA SIE GRACZA ORAZ STRZELANIA ( SKORO NIE ZYJE TO LEPIEJ ZEBY SIE NIE RUSZAL I NIE STRZELAL )
        if ( playerMove.enabled )
            playerMove.enabled = false ;
        if ( playerShoot.enabled )
            playerShoot.enabled = false ;
    }
    void Awake()
    {
        //PRZYPISUJEMY KOMPONENTY ZMIENNYM
        animationPlayer = GetComponent<Animator>() ;
        playerAudio = GetComponent<AudioSource>() ;
        playerMove = GetComponent<PlayerMove>() ;
        playerShoot = GetComponentInChildren<PlayerShoot>() ;

        //USTAWIAMY POCZATKOWE ZYCIE GRACZA
        currentHealthPlayer = playerHealth ;

        //USTAWIAMY MAXYMALNA WIELKOSC HealthBar
        healthBar.maxValue = playerHealth ;
        healthBar.value = playerHealth ;
    }
Beispiel #16
0
 void Start()
 {
     playerShoot = GameObject.Find ("player").GetComponent<PlayerShoot> ();
 }
 // Use this for initialization
 void Start()
 {
     CurrentHealth = StartingHealth;
     controller = gameObject.GetComponent<PlayerMove>();
     playerShooter = gameObject.GetComponent<PlayerShoot>();
 }
Beispiel #18
0
 // Use this for initialization
 void Start()
 {
     ps1 = gun1.GetComponent<PlayerShoot>();
     ps2 = gun2.GetComponent<PlayerShoot>();
 }
Beispiel #19
0
 private void Awake()
 {
     Shoot = GetComponent<PlayerShoot>();
     ResetPosition = GetComponent<ResetPosition>();
 }
Beispiel #20
0
 void Awake()
 {
     if(_instance == null)
         _instance = GetComponent< MainManage >();
     Bullet = GetComponentInChildren< BulletManage > ();
     Record = GetComponentInChildren< RecordManage > ();
     Bonus = GetComponentInChildren< BonusManage > ();
     Player = GetComponentInChildren< PlayerControl > ();
     Enemy = GetComponentInChildren< EnemyManage > ();
     Sound = GetComponentInChildren< SoundManage > ();
     _shoot = Player.GetComponent< PlayerShoot > ();
     Output = GameObject.Find ("Output").GetComponent< UILabel >();
 }