상속: MonoBehaviour
예제 #1
0
    public void ButtonClick(string buttonType)
    {
        Player      player     = GameObject.Find("Player").GetComponent <Player> ();
        PlayerShoot playershoo = GameObject.Find("Player").GetComponent <PlayerShoot> ();

        bool isDead    = player.isDead;
        bool isJumping = player.isJumping;

        if (buttonType == "Shoot")
        {
            // shoot
            if (isDead == false)
            {
                playershoo.ApplyFire();
            }
        }
        else if (buttonType == "Jump")
        {
            // jump
            if (
                isDead == false &&
                isJumping == false
                )
            {
                player.ApplyJump();
            }
        }

        HideTip();
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     sound     = FindObjectOfType <EffectsManager>();
     thePlayer = FindObjectOfType <PlayerShoot>();
     kill      = FindObjectOfType <Killer>();
     Items     = FindObjectOfType <Item>();
 }
예제 #4
0
    //I've moved the following functionality to a button in the Inspector (OptionsButton)
    public void EnterOptions(bool inOrFalse, PlayerShoot whosGoingIn)
    {
        joinMenu.SetActive(!inOrFalse);
        inGameOptions = inOrFalse;
        if (inOrFalse)
        {
            gOptionsMenu.SetActive(true);
            gOptionsMenu.GetComponent <Animator>().ResetTrigger("PaneOut");

            gOptionsMenu.GetComponent <Animator>().SetTrigger("PaneIn");
            whosGoingIn.m_events.SetSelectedGameObject(optionsFirstSelect.gameObject);
        }
        else
        {
            gOptionsMenu.GetComponent <Animator>().ResetTrigger("PaneIn");

            gOptionsMenu.GetComponent <Animator>().SetTrigger("PaneOut");
            whosGoingIn.m_events.SetSelectedGameObject(whosGoingIn.m_events.playerPanelFirst);
            //turn on the other players' navigation capabilities again.
            foreach (GameObject g in tempOffMods)
            {
                g.SetActive(true);
            }
        }
    }
    void Start()
    {
        // initialisation
        _PlayerMove  = _player.GetComponent <PlayerMove>();
        _PlayerShoot = _player.GetComponent <PlayerShoot>();

        _thirdPersonGunHolderPosition = _gunHolder.transform.localPosition;

        // hide mouse cursor and lock it to the middle of the screen
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        _player = GameObject.FindGameObjectWithTag("Player").transform;

        if (_graphicsHolder == null)
        {
            _graphicsHolder = _player.GetComponent <Rigidbody> ();
        }

        if (_cameraHolder == null)
        {
            _cameraHolder = this.transform;
        }

        InitialiseCamera();
    }
예제 #6
0
        public override void OnAbilityRemove()
        {
            base.OnAbilityRemove();
            PlayerShoot pShoot = gameObject.GetComponent <PlayerShoot>();

            pShoot.shoot -= OnShoot;
        }
예제 #7
0
    void InstantiatePlayer()
    {
        playCustomProperties = PhotonNetwork.LocalPlayer.CustomProperties;
        if (playCustomProperties["Team"].ToString().Equals("redTeam"))
        {
            localPlayer = PhotonNetwork.Instantiate("EthanPlayer", teamOneSpawnTransform[(int)playCustomProperties["TeamNum"]], Quaternion.identity, 0);
        }
        else if (playCustomProperties["Team"].ToString().Equals("blueTeam"))
        {
            localPlayer = PhotonNetwork.Instantiate("RobotPlayer", teamTwoSpawnTransform[(int)playCustomProperties["TeamNum"]], Quaternion.identity, 0);
        }

        localPlayer.GetComponent <PlayerMove>().enabled = true;
        PlayerShoot  playerShoot  = localPlayer.GetComponent <PlayerShoot>();
        PlayerHealth playerHealth = localPlayer.GetComponent <PlayerHealth>();
        // TODO  显示玩家生命值
        Transform tempTransform = localPlayer.transform;

        mainCamera.transform.parent        = tempTransform;
        mainCamera.transform.localPosition = playerShoot.shootingPosition;
        mainCamera.transform.rotation      = Quaternion.identity;
        for (int i = 0; i < tempTransform.childCount; i++)
        {
            if (tempTransform.GetChild(i).name.Equals("Gun"))
            {
                tempTransform.GetChild(i).parent = mainCamera.transform;
                break;
            }
        }
    }
예제 #8
0
        /// <summary>
        /// Update inventory slots to match the player's actual available
        /// weapons. Also called by the ShopScript when the player purchases
        /// a weapon.
        /// </summary>
        public void updateWeaponSlots()
        {
            if (playerShoot == null)
            {
                // try to find it again
                playerShoot = GameObject.FindGameObjectWithTag("Player")?.GetComponentInChildren <PlayerShoot>(true);
            }

            if (playerShoot == null || playerShoot.guns == null)
            {
                return;
            }

            // filled slots
            for (int i = 0; i < playerShoot.guns.Count; ++i)
            {
                updateWeaponSlot(i);
            }
            // empty slots
            for (int i = playerShoot.guns.Count; i < inventorySlots.Count; ++i)
            {
                PlayerInventorySlot p = inventorySlots[i];
                p.sprite.color = new Color(0, 0, 0, 0);
                p.infoBlock.SetActive(false);
            }
            updateSelectedGrid();
        }
예제 #9
0
 void Awake()
 {
     animator     = this.GetComponent <Animator> ();
     playerMove   = this.GetComponent <PlayerMove> ();
     playerShoot  = this.GetComponentInChildren <PlayerShoot> ();
     bodyRenderer = transform.Find("Player").GetComponent <Renderer>() as SkinnedMeshRenderer;
 }
예제 #10
0
 void Start()
 {
     pMotor  = GetComponent <PlayerMotor>();
     pShoot  = GetComponent <PlayerShoot>();
     pHealth = GetComponent <PlayerHealth>();
     pSetup  = GetComponent <PlayerSetup>();
 }
예제 #11
0
 void Awake()
 {
     _anim                = this.GetComponent <Animator>();
     _playerMove          = this.GetComponent <PlayerMove>();
     _skinnedMeshRenderer = this.transform.Find("Player").GetComponent <SkinnedMeshRenderer>();
     _playerShoot         = this.GetComponentInChildren <PlayerShoot>();
 }
예제 #12
0
파일: Player.cs 프로젝트: 1107676855/dgx
 private void Start()
 {
     animator_Input = GetComponent <PlayerAnimation>();
     move_Input     = GetComponent <PlayerMove>();
     shoot_Input    = GetComponent <PlayerShoot>();
     weapon_Input   = GetComponent <ReWeapon>();
 }
예제 #13
0
        private void OnTriggerEnter(Collider collider)
        {
            if (collider.gameObject.tag == "Player")
            {
                StateManager.selectedDungeon = (DungeonTypeEnum)(-1);
                GameObject player  = collider.gameObject;
                SpawnPoint spawner = GameObject.FindGameObjectWithTag("Spawn Point").GetComponent <SpawnPoint>();

                // Disable shoot script, since player is entering town
                PlayerShoot shootScript = player.GetComponentInChildren <PlayerShoot>();
                shootScript.enabled = false;
                player.GetComponentInChildren <Light>().intensity = 0;

                // Set player at the dungeon door
                spawner.transform.position = new Vector3(28, 1, -9);
                spawner.transform.LookAt(new Vector3(6, 1, -9));
                spawner.autoSpawn = false;
                spawner.spawnPlayer();

                // Manually kill the music box, since it isn't destroyed naturally
                GameObject musicPlayer = GameObject.Find("DungeonMusic");
                Destroy(musicPlayer);
                GameObject.Find("HUD").GetComponentInChildren <HUD>().escapeHatch = null;

                // Apply interest
                StateManager.startNewDay();
                loadScript.startLoadingScreen("Hub");
            }
        }
예제 #14
0
    void Start()
    {
        //Start the player off at their teams spawn point.
        if (photonView.isMine)
        {
            if (photonView.owner.GetTeam() == PunTeams.Team.blue)
            {
                team = "blue";
            }
            else if (photonView.owner.GetTeam() == PunTeams.Team.red)
            {
                team = "red";
            }

            playerMesh = GameObject.Find("WaterPistol_Idle");
        }
        //Get references to objects in the scene.
        gameManager = GameObject.Find("GameManager").GetComponent <GameManager> ();

        if (photonView.isMine)
        {
            respawnTxt      = GameObject.Find("RespawnText").GetComponent <Text>();
            respawnTxt.text = "";
        }

        cameraLook        = GetComponent <CameraLook>();
        shoot             = GetComponent <PlayerShoot> ();
        storedRespawnTime = respawnTime;
        movement          = GetComponent <PlayerMovement> ();
        health            = GetComponent <PlayerHealth> ();
        body     = GetComponentInChildren <SkinnedMeshRenderer> ();
        collider = GetComponent <CharacterController>();
        nameTag  = GetComponentInChildren <Canvas>();
    }
예제 #15
0
    private void OnGUI()
    {
        if (_ps == null)
        {
            if (GameObject.FindGameObjectWithTag("Player"))
            {
                _ps = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShoot>();
            }
            return;
        }

        if (overHeatText == null)
        {
            overHeatText = transform.GetChild(0).gameObject;
            return;
        }

        if (_ps.coolingDown)
        {
            overHeatText.SetActive(true);
        }
        else
        {
            overHeatText.SetActive(false);
        }
    }
예제 #16
0
    private void Start()
    {
        storyCamera = GameObject.FindGameObjectWithTag("MainCamera");
        mouseLook   = storyCamera.GetComponent <MouseLook>();
        playerShoot = player.GetComponentInChildren <PlayerShoot>();
        player.GetComponentInChildren <PlayerMovement>().enabled = false;

        StateManager.inStoryTutorial = true;

        playerShoot.enabled = false;
        introStory1         = storiesTop[storyPosition];
        introStory2         = storiesBottom[storyPosition];
        Time.timeScale      = 0;
        mouseLook.enabled   = false;
        foreach (GameObject weapon in tutorialWeapons)
        {
            GameObject realWeapon = Instantiate(weapon);
            playerInventory.addWeapon(realWeapon);
        }
        foreach (GameObject target in targets)
        {
            TargetBehavior behaviorScript = target.GetComponent <TargetBehavior>();
            behaviorScript.story = this;
        }
    }
예제 #17
0
 private void Awake()
 {
     playerShoot = GetComponent <PlayerShoot>();
     playerShoot.OnAttackEvent += OnAttack;
     characterController        = GetComponent <CharacterController>();
     animator = GetComponent <Animator>();
 }
예제 #18
0
    //初始化玩家实例
    public void InstantiatePlayer()
    {
        var playerCustomProperties = PhotonNetwork.player.customProperties;     //获取玩家自定义属性

        //如果玩家属于进攻阵营,生成AttackerPlayer对象
        if (playerCustomProperties["Team"].ToString().Equals("AttackerTeam"))
        {
            localPlayer = PhotonNetwork.Instantiate("AttackerPlayer",
                                                    attackerTeamSpawnTransform[(int)playerCustomProperties["TeamNum"]].position, Quaternion.identity, 0);
        }
        //如果玩家属于防守阵营,生成DefenderPlayer对象
        else if (PhotonNetwork.player.customProperties["Team"].ToString().Equals("DefenderTeam"))
        {
            localPlayer = PhotonNetwork.Instantiate("DefenderPlayer",
                                                    defenderTeamSpawnTransform[(int)playerCustomProperties["TeamNum"]].position, Quaternion.identity, 0);
        }
        localPlayer.GetComponent <PlayerMove>().enabled = true;                          //启用PlayerMove脚本,使玩家对象可以被本地客户端操控
        PlayerShoot playerShoot = localPlayer.GetComponent <PlayerShoot>();              //获取玩家对象的PlayerShoot脚本

        playerHealth = localPlayer.GetComponent <PlayerHealth>();                        //获取玩家对象的PlayerHealth脚本

        Transform tempTransform = localPlayer.transform;

        mainCamera.transform.parent        = tempTransform;                             //将场景中的摄像机设为玩家对象的子对象
        mainCamera.transform.localPosition = playerShoot.shootingPosition;              //设置摄像机的位置,为PlayerShoot脚本中的射击起始位置
        mainCamera.transform.localRotation = Quaternion.identity;                       //设置摄像机的朝向

        UIController.initPlayerHpLabel(playerHealth.maxHP, 0);
        UIController.updatePlayerHPLabel(playerHealth.currentHP);
    }
예제 #19
0
 void Awake()
 {
     anim            = this.GetComponent <Animator>();
     playMove        = this.GetComponent <PlayerMove>();
     this.bodyRender = GameObject.FindWithTag(Tags.PlayerSkin).GetComponent <Renderer>() as SkinnedMeshRenderer;
     playerShoot     = this.GetComponentInChildren <PlayerShoot>();
 }
 void Start()
 {
     master    = GameObject.FindGameObjectWithTag("MasterScript").GetComponent <MasterScript>();
     inventory = GetComponent <PlayerInventory>();
     shoot     = GetComponent <PlayerShoot>();
     stats     = GetComponent <PlayerStats>();
 }
예제 #21
0
    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);
        }
    }
예제 #22
0
 void instantiatePlayerComponents()
 {
     player     = GameObject.Find("Perso");
     attackDist = player.GetComponent <PlayerShoot>();
     attackCaC  = player.GetComponent <PlayerAttack>();
     health     = player.GetComponent <PlayerHealth>();
 }
예제 #23
0
 void HandleOnLocalPlayerJoined(Player player)
 {
     playerShoot             = player.PlayerShoot;
     reloader                = playerShoot.ActiveWeapon.Reloader;
     reloader.OnAmmoChanged += HandleOnAmmoChanged;
     //playerShoot.ActiveWeapon.reloader.OnAmmoChanged += HandleOnAmmoChanged;
 }
예제 #24
0
    public void UpdateAmmoDisplay()
    {
        if (_shootScript == null)
        {
            if (PlayerMovement.instance != null)
            {
                _shootScript = PlayerMovement.instance.gameObject.GetComponent <PlayerShoot> ();
            }
            else
            {
                return;
            }
        }

        foreach (Transform child in transform)
        {
            if (child.gameObject != ReloadHintText)
            {
                Destroy(child.gameObject);
            }
        }

        int index = 0;

        for (; index < _shootScript.ammo; index++)
        {
            SpawnAmmo(index, LoadedColor);
        }
        for (; index < _shootScript.maxAmmo; index++)
        {
            SpawnAmmo(index, DepletedColor);
        }

        ReloadHintText.SetActive(_shootScript.ammo == 0);
    }
예제 #25
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;
    }
예제 #26
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        PlayerShoot playerShot = collision.gameObject.GetComponent <PlayerShoot>();

        if (playerShot != null)
        {
            ChangeEnemyLife(playerShot.damage);
            Destroy(playerShot.gameObject);
        }

        Player player = collision.gameObject.GetComponent <Player>();

        if (player != null)
        {
            canShoot = true;
            InvokeRepeating("EnemyShotAttack", 0, 1f);
        }

        PlayerPunch punch = collision.gameObject.GetComponent <PlayerPunch>();

        if (punch != null)
        {
            if (Gary.CurrentWeapon == "Macana")
            {
                punch.damage = punch.damage + 10;
            }
            ChangeEnemyLife(punch.damage);
        }
    }
예제 #27
0
 void HandleOnLocalPlayerJoined(Player player)
 {
     playerShoot = player.gameObject.GetComponent <PlayerShoot>();
     playerShoot.OnWeaponSwich += HandleOnWeaponSwich;
     playerShoot.ActiveWeapon.Reloader.OnAmmoChanged += HandleOnAmmoChanged;
     HandleOnAmmoChanged();
 }
예제 #28
0
        /// <summary>
        /// Add a weapon to the player's inventory. Updates the PlayerShoot list
        /// of available weapons, as well as the inventory screen.
        /// </summary>
        /// <param name="selection"></param>
        public void addWeapon(GameObject selection)
        {
            if (playerShoot == null)
            {
                // try to find it again
                playerShoot = GameObject.FindGameObjectWithTag("Player")?.GetComponentInChildren <PlayerShoot>(true);
            }
            if (playerShoot.guns.Count > 9)
            {
                Debug.Log("You don't have enough arms and bags of holding for another weapon.");
                return;
            }
            // add the gun models!
            // when the camera is parented to the gun, the gun's transform is reset to be relative to the camera, so we need to fix it after the parenting
            Vector3    correctPosition = selection.transform.localPosition;
            Vector3    correctScale    = selection.transform.localScale;
            Quaternion correctRotation = selection.transform.localRotation;

            selection.transform.parent        = GameObject.FindGameObjectWithTag("MainCamera").transform;
            selection.transform.localPosition = correctPosition;
            selection.transform.localRotation = correctRotation;
            selection.transform.localScale    = correctScale;
            // The gun model itself that needs to be added to the list is not the topmost object
            GameObject actualGun = selection.GetComponentInChildren <WeaponStats>(true).gameObject;

            playerShoot.guns.Add(actualGun);
            updateWeaponSlots();
        }
예제 #29
0
    void Start()
    {
        GM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();

        switch (GM.planeType)
        {
        case GameManager.PLANETYPE.F16:
            F16.SetActive(true);
            mr = F16;
            break;

        case GameManager.PLANETYPE.A10:
            A10.SetActive(true);
            mr = A10;
            break;

        case GameManager.PLANETYPE.GYRO:
            Gyro.SetActive(true);
            mr = Gyro;
            break;
        }
        SetCalibration();
        menuController    = GameObject.FindGameObjectWithTag("GameManager").GetComponent <MenuController>();
        moveSpeed         = defaultMoveSpeed * GM.sensitivity * 2;
        playerShootScript = gameObject.GetComponent <PlayerShoot>();
        cameraScript      = Camera.main.GetComponent <CameraFollow>();
        // get player's collider
        hitbox = GetComponent <BoxCollider>();
    }
예제 #30
0
        void RemovePlayer(PlayerShoot player)
        {
            if (GameManager.GM.onJoinScreen)
            {
                //turn the join image back on:
                playerPanels[players.IndexOf(player)].joinImage.SetActive(true);
                playerPanels[players.IndexOf(player)].myP = null;
            }
            //store the autoplaying board and get it to stop if a controller was disconnected.
            foreach (Board b in FindObjectsOfType <Board>())
            {
                if (b.autoPlay)
                {
                    b.autoPlay   = false;
                    refAutoPlayB = b;
                }
            }
            spawnPoses.Insert(0, player.transform.parent.position);
            players.Remove(player);
            player.Device = null;
            UIManager.UIM.ContDiscon(true);
            GameManager.GM.everythingPause = true; //pause the whole game if a controller was disconnected.
            rTimeScale     = Time.timeScale;
            Time.timeScale = 0;


            Destroy(player.transform.parent.gameObject);
        }
예제 #31
0
    public virtual bool Pickup(PlayerShoot player)
    {
        if (isHeld)
        {
            return(false);
        }

        if (isInSpawner)
        {
            isInSpawner = false;
            weaponSpawner.SpawnedWeaponIsGrabbed();
        }
        this.player        = player;
        playerNumber       = player.playerNumber;
        isHeld             = true;
        transform.parent   = this.player.gunParentTransform;
        canShoot           = true;
        transform.position = this.player.gunParentTransform.position;
        transform.right    = this.player.gunOriginTransform.right;

        if (rigidbody != null)
        {
            Destroy(rigidbody);
        }

        collider.enabled = false;

        return(true);
    }
예제 #32
0
 // Start is called before the first frame update
 void Awake()
 {
     playerMovement = GetComponent <PlayerMovement>();
     currentHealth  = startingHealth;
     playerAudio    = GetComponent <AudioSource>();
     playerShoot    = GetComponentInChildren <PlayerShoot>();
 }
    public void FindPlayer()
    {
        playerShoot = GetComponent<PlayerShoot>();
        statController = GetComponent<StatController>();
        playerFound = true;

        
    }
예제 #34
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;
 }
예제 #35
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);
		}
	}
예제 #37
0
    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();
        }
    }
예제 #38
0
    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();
    }
예제 #39
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);
             }
         }
     }
 }
예제 #40
0
    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>();
    }
예제 #41
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);
		}
	}
예제 #42
0
    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 ) ;
        }
    }
예제 #43
0
    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 ;
    }
예제 #44
0
    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 ;
    }
예제 #45
0
	void Awake(){
		anim = this.GetComponent<Animator> ();
		playerMove = this.GetComponent<PlayerMove> ();
		playerShoot = this.GetComponentInChildren<PlayerShoot> ();
		this.bodyRenderer = transform.Find ("Player").renderer as SkinnedMeshRenderer;
	}
예제 #46
0
 // Use this for initialization
 void Start()
 {
     ps1 = gun1.GetComponent<PlayerShoot>();
     ps2 = gun2.GetComponent<PlayerShoot>();
 }
예제 #47
0
 // Use this for initialization
 void Start()
 {
     CurrentHealth = StartingHealth;
     controller = gameObject.GetComponent<PlayerMove>();
     playerShooter = gameObject.GetComponent<PlayerShoot>();
 }
예제 #48
0
 void Start()
 {
     playerShoot = GameObject.Find ("player").GetComponent<PlayerShoot> ();
 }
예제 #49
0
 private void Awake()
 {
     Shoot = GetComponent<PlayerShoot>();
     ResetPosition = GetComponent<ResetPosition>();
 }
예제 #50
0
파일: MainManage.cs 프로젝트: ayim1124/East
 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 >();
 }