void Awake() { anim = GetComponent<Animator>(); playerAudio = GetComponent<AudioSource>(); playerMovement = GetComponent<PlayerMovement>(); playerShooting = GetComponentInChildren<PlayerShooting>(); currentHealth = startingHealth; }
void Awake() { playerHealth = GetComponent<PlayerHealth>(); playerLevel = GetComponent<PlayerLevel>(); playerPerks = GetComponent<PlayerPerks>(); playerShooting = GetComponent<PlayerShooting>(); playerMovement = GetComponent<PlayerMovement>(); }
void Awake() { anim = GetComponent <Animator> (); //Gets a reference to the animator playerAudio = GetComponent <AudioSource> (); //Gets a reference to the audiosource playerMovement = GetComponent <PlayerMovement> (); //Gets a reference to the playermovement script playerShooting = GetComponentInChildren <PlayerShooting> (); //Get the components of the shooting script since it fires on the end of the gunbarrel currentHealth = startingHealth; //Sets current health to starter health }
void Awake() { anim = GetComponent<Animator>(); playerAudio = GetComponent<AudioSource>(); playerShooting = GetComponentInChildren<PlayerShooting>(); fps = GetComponent<FirstPersonController>(); currentHealth = startingHealth; }
//Animator anim; //bool shooting; // Use this for initialization void Start() { print ("cube start()"); _shooting = _gun.GetComponent<PlayerShooting>(); c_AudioSource = GetComponent<AudioSource>(); gazeAt = false; stareAt(gazeAt); }
void Awake() { rb = GetComponent<Rigidbody> (); anim = GetComponent<Animator> (); audioController = GetComponent<AudioController> (); rb.constraints = RigidbodyConstraints.FreezePositionZ | RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ; cam = Camera.main.transform; gun = transform.GetComponentInChildren<PlayerShooting> (); }
void Awake() { anim = GetComponent <Animator> (); playerAudio = GetComponent <AudioSource> (); playerMovement = GetComponent <PlayerMovement> (); playerShooting = GetComponentInChildren <PlayerShooting> (); currentHealth = startingHealth; mainCamera = GameObject.Find ("Main Camera").GetComponent<Camera>(); Player2Camera = GameObject.Find ("Main Camera 2").GetComponent<Camera>(); }
void Start() { for (int i = 0; i < 6 ; i++) { transform.GetChild (i).GetComponent<CharacterSlot> ().index = i; } player = GameObject.FindGameObjectWithTag ("Player"); playerHealth = player.GetComponent<PlayerHealth> (); playerShooting = player.GetComponentInChildren<PlayerShooting>(); }
// Use this for initialization void Start() { for (int i = PlayerPrefs.GetInt("Duplicate") - 1; i > 0; --i) { CreateDuplicate(); } playerShootingScript = GetComponent<PlayerShooting>(); lives = GameObject.Find("Lives").GetComponent<UILives>(); //eww score = GameObject.Find("PlayerInfo").GetComponent<UIScore>(); //double eww }
void Awake() { // Setting up the references. anim = GetComponent<Animator>(); playerAudio = GetComponent<AudioSource>(); playerShooting = GetComponentInChildren<PlayerShooting>(); // Set the initial health of the player. currentHealth = startingHealth; }
void Awake() { hearts = GameObject.Find("HealthUI").GetComponentsInChildren<Image>(); damageImage = GameObject.Find ("Damage Image").GetComponent<Image> (); animPlayer = GetComponent < Animator > (); playerAudio = GetComponents < AudioSource > (); playerMovement = GetComponent < PlayerMovement > (); playerShooting = GetComponentInChildren < PlayerShooting > (); }
void Awake() { floorMask = LayerMask.GetMask("Floor"); animChar = GetComponent < Animator > (); animHUD = GameObject.Find ("HUDCanvas").GetComponent < Animator > (); playerRigidbody = GetComponent < Rigidbody > (); playerAudio = GetComponents < AudioSource > (); playerGun = GetComponent < PlayerGun > (); playerShooting = GetComponentInChildren<PlayerShooting> (); }
//METHODS (OFTEN USED) void Awake() { // Setting up the references. _anim = GetComponent <Animator> (); _playerAudio = GetComponent <AudioSource> (); _playerMovement = GetComponent <Player> (); _playerShooting = GetComponentInChildren <PlayerShooting> (); //referencing to the child of Player: "gun barrel". // Set the starting health of the player. currentHealth = startingHealth; }
public void Awake() { //Initialize components player = GameObject.FindWithTag("Player"); rifleTip = GameObject.Find("RifleTip"); gunLine = rifleTip.GetComponent<LineRenderer>(); gunLight = rifleTip.GetComponent<Light>(); playerShooting = rifleTip.GetComponent<PlayerShooting>(); playerStamina = player.GetComponent<PlayerStamina>(); rend = GameObject.FindWithTag("RendPlayer").GetComponent<Renderer>(); }
void Awake() { damageImage = GameObject.FindGameObjectWithTag("DamageImage").GetComponent<Image> (); healthSlider = CreateHealthBar (); anim = GetComponent <Animator> (); playerAudio = GetComponent <AudioSource> (); playerMovement = GetComponent <PlayerMovement> (); playerShooting = GetComponentInChildren <PlayerShooting> (); capsuleCollider = GetComponent <CapsuleCollider> (); sphereCollider = GetComponent<SphereCollider> (); currentHealth = startingHealth; }
void Awake() { currentHealth = startingHealth; playerController = GetComponent<PlayerController>(); playerShooting = GetComponent<PlayerShooting>(); damaged = false; healthSlider = GameObject.FindWithTag("HealthSliderHUD").GetComponent<Slider>(); flashImage = GameObject.Find("DamageSplash").GetComponent<Image>(); }
void Awake() { gun = GameObject.FindGameObjectWithTag ("GunBarrelEnd"); playerShooting = gun.GetComponent <PlayerShooting> (); bullet = gun.GetComponent<ParticleSystem> (); yellow = bullet.startColor; bulletLine = gun.GetComponent<LineRenderer> (); lineYellow = bulletLine.material.GetColor ("_TintColor"); playerIsStrong = false; playerInRange = false; player = GameObject.FindGameObjectWithTag ("Player"); }
void Awake() { if(instance==null){ instance=this; }else if(instance!=this){ Destroy(gameObject); } shootableMask = LayerMask.GetMask ("Shootable"); gunParticles = GetComponent<ParticleSystem> (); gunLine = GetComponent <LineRenderer> (); gunAudio = GetComponent<AudioSource> (); gunLight = GetComponent<Light> (); }
void Awake() { currentHealth = InitialHealth; PlayerShooting = GetComponentInChildren <PlayerShooting> (); HealthSlider = GameObject.Find("HealthBar").GetComponent<Slider>(); PlayerSoundFX = GetComponents<AudioSource> (); //GetComponents gives multi value HurtClip = PlayerSoundFX[0]; DeadClip = PlayerSoundFX[1]; PlayerHurtImage = GameObject.Find ("PlayerHurtImage").GetComponent<RawImage>(); DeadBloodParticleSystem = GetComponentInChildren<ParticleSystem>(); PlayerManager = GameObject.Find ("PlayerMan").GetComponent<PlayerManager>(); }
/// <summary> /// Get Player Detail like Player Health, Player Movement and Player Shoot to disable when /// Game is over /// </summary> void Awake() { Player = GameObject.Find("Police"); //Find Police GameObj PoliceHealth = Player.GetComponent<PlayerHealth>(); //Get PlayerHealth Script from Police playerMovement = Player.GetComponent<PlayerMovement>(); //Get PlayerMovement playerShooting = Player.GetComponentInChildren <PlayerShooting>(); //Get the Playershooting from GunBarrel i.e child of player PlayerAnimator = Player.GetComponent<Animator>(); //Get the animator component from player LevelManager = GameObject.Find("LevelManager").GetComponent<LevelMan>(); //Get the LevelMan Script from LevelManager GameObj ZombieFinder = GameObject.FindGameObjectsWithTag("ZombieTag"); //Find all the Alive zombie HealthSlider = HUD.GetComponentInChildren<Slider>(); //Get the Health Slider from HealthBar Canvas HeartImage = GameObject.Find ("HeartImage").GetComponent<Image>(); // Get the Image from HeartImage UI //Get the Sprite Image from LifeImage Array SecondLife = LifeImage[0]; ThirdLife = LifeImage[1]; ForthLife = LifeImage[2]; MissionOver = GameObject.Find ("DayComplete").GetComponent<Image>(); //Get DayComplete Gameobj MissionOver.color = Color.clear; //Set Image transparent }
bool damaged; // True when the player gets damaged. void Awake () { playerMovement = GetComponent <PlayerMovement> (); playerShooting = GetComponentInChildren <PlayerShooting> (); currentHealth = startingHealth; // Set the initial health of the player. }
void Update() { if (blockInputTimer >= 0) { blockInputTimer -= Time.deltaTime; return; } switch (state) { case MenuState.TitleScreen: Vector2 input = GenericInput.GetLeftStickMovement(gamepads); titleScreenMovement.Move(input.x, input.y, false); if (MenuInput.GetStartKeyDown(gamepads)) { PlayerShooting shooting = titleScreenMovement.GetComponent <PlayerShooting>(); shooting.Aim(mainMenuLocation.x, mainMenuLocation.y, 0, 0); shooting.Draw(); shooting.Shoot(); //Play camera script //Load menu state = MenuState.MainMenu; //TODO: Transition time blockInputTimer = .5f; Logger.Log("Player select", this, LogLevel.Log); } break; case MenuState.MainMenu: state = MenuState.PlayerSelect; break; case MenuState.PlayerSelect: for (int i = 0; i < GM.MAXPLAYERCOUNT; i++) { if (controllerPlayerIDMapping[i] == -1) { if (MenuInput.GetSelectKeyDown(gamepads[i])) { //register player controllerPlayerIDMapping[i] = GM.GameInstance.AddPlayer(i); Logger.Log("Added controller: " + i + " to player: " + controllerPlayerIDMapping[i], this, LogLevel.Log); } } else { if (MenuInput.GetStartKeyDown(gamepads[i])) { state = MenuState.LevelSelect; Logger.Log("Players confirmed: " + GM.GameInstance.Players.Capacity, this, LogLevel.Log); } //pass on input } } break; case MenuState.LevelSelect: if (MenuInput.GetSelectKeyDown(gamepads)) { Logger.Log("Loading DevLevel3.0", this, LogLevel.Log); SceneManager.LoadScene("DevLevel3.0"); //Get current stage //load current stage return; } //Pass on input break; } }
void Start() { ph = GetComponent<PlayerHealth>(); ps = GetComponent<PlayerShooting>(); //Y = 3.5f; rb = GetComponent<Rigidbody>(); this.transform.position = new Vector3(X, Y, Z); counter = 0; }
void Awake() { anim = GetComponent <Animator> (); playerRigidbody = GetComponent <Rigidbody> (); playerShooting = GetComponentInChildren <PlayerShooting> (); }
void Awake() { //Get the StatsManager Script playerShooting = GetComponent <PlayerShooting> (); }
public ShootCommand(PlayerShooting _playerShooting) { playerShooting = _playerShooting; }
private void Awake() { playerShooting = GetComponent <PlayerShooting>(); }
void Start() { Screen.showCursor = false; timeElapsed = 0; coins = PlayerPrefsManager.GetCoins(); blockWhenNoGazeData = PlayerPrefsManager.GetControl(); GameObject.Find("Highscore").GetComponent<HighscoreScript>().UpdateCoins(coins); GameObject.Find("Highscore").GetComponent<HighscoreScript>().AddScoreValue(PlayerPrefsManager.GetScore()); lifeControl = GameObject.FindGameObjectWithTag("MainGUI").GetComponent<SubmarineLifeControl>(); movePlayer = GameObject.FindGameObjectWithTag("Player").GetComponent<MovePlayer>(); shooting = GameObject.Find("gun").GetComponent<PlayerShooting>(); powerUpSpawner = GameObject.Find("GameController").GetComponent<PowerUpSpawner>(); }
private void Awake() { _playerMovement = GetComponent <PlayerMovement> (); _playerShooting = GetComponentInChildren <PlayerShooting> (); CurrentHealth = StartingHealth; }
void Start() { _playerMovement = GetComponent <PlayerMovement>(); _playerShooting = GetComponent <PlayerShooting>(); _currentHealth = StartingHealth; }
private void Awake() { _charMovement = GetComponent <PlayerMovement>(); _playerShooting = GetComponent <PlayerShooting>(); }
void Awake () { //Get the StatsManager Script playerShooting = GetComponent<PlayerShooting> (); }
void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Enemy")) { GameMaster.Instance.Freeze(freezeDuration); if (freezeDuration < .15f) { freezeDuration += addFreezeDuration; } if (ReadWriteSaveManager.Instance.GetData("CanFlash", true, false)) { var flashInst = Instantiate(flashObj, other.transform.position, Quaternion.identity); Destroy(flashInst.gameObject, .25f); GameMaster.Instance.ChangeBackColor(colorNum); if (colorNum < .35f) { colorNum += .05f; } } AudioManager.Instance.Play("EnemyHit", pitch); pitch += .05f; HomingEnemy homingEnemy = other.gameObject.GetComponent <HomingEnemy>(); ShootingEnemy shootingEnemy = other.gameObject.GetComponent <ShootingEnemy>(); SittingEnemy sittingEnemy = other.gameObject.GetComponent <SittingEnemy>(); DashingEnemy dashingEnemy = other.gameObject.GetComponent <DashingEnemy>(); if (homingEnemy) { scoreText.SetScore(addScoreHomingHit + addScoreStacking); comboUI.SetCounter(addScoreHomingHit + addScoreStacking, homingEnemy.transform.position); homingEnemy.DamageEnemy(); defeatedHoming = true; } else if (shootingEnemy) { scoreText.SetScore(addScoreShootingHit + addScoreStacking); comboUI.SetCounter(addScoreShootingHit + addScoreStacking, shootingEnemy.transform.position); shootingEnemy.DamageEnemy(); defeatedShooting = true; } else if (sittingEnemy) { scoreText.SetScore(addScoreSittingHit + addScoreStacking); comboUI.SetCounter(addScoreSittingHit + addScoreStacking, sittingEnemy.transform.position); sittingEnemy.DamageEnemy(); defeatedSitting = true; } else if (dashingEnemy) { int dashingAdd = dashingEnemy.GetAddScore(); scoreText.SetScore(addScoreDashingHit + addScoreStacking + dashingAdd); comboUI.SetCounter(addScoreDashingHit + addScoreStacking + dashingAdd, dashingEnemy.transform.position); dashingEnemy.DamageEnemy(); defeatedDashing = true; } addScoreStacking += 100; comboCounter++; GameMaster.Instance.SpongeCheckUnlock(comboCounter); GameMaster.Instance.BounceCheckUnlock(defeatedHoming, defeatedShooting, defeatedSitting, defeatedDashing); GameMaster.Instance.HomingCheck(comboCounter); } if (other.CompareTag("Player")) { PlayerShooting playerShooting = other.GetComponent <PlayerShooting>(); if (playerShooting.isRecalling || playerShooting.canRecall) { shake.Shake(shakeDuration, shakeIntensity); AudioManager.Instance.Play("PlayerTriHit"); playerShooting.BulletHit(); Destroy(parentBul.gameObject); } } }
// Update is called once per frame void Update() { anim_current_paw = current_cat_paw.GetComponent <Animator> (); //Change to cat_paw_toast if (tScript.changeToToast) { if (!main_changed) { Debug.Log("to_toast"); changePawToToast(); is_toast = true; is_main = false; } tScript.changeToToast = false; } else if (shootingScript.changeToMain) { if (!toast_changed) { // Debug.Log("to_main"); changePawToMain(); is_toast = false; is_main = true; } shootingScript.changeToMain = false; } if ((to_toast) && (paw_main_animator.GetCurrentAnimatorStateInfo(0).IsName("paw_down_done"))) { //Disable current paw's components GameObject cat_paw_mesh = GameObject.Find("cat_paw_mesh"); mesh = cat_paw_mesh.GetComponent <MeshRenderer>(); mesh.enabled = false; cat_anim = paw_main.GetComponent <Animator>(); //cat_anim.SetTrigger("reset"); cat_anim.enabled = false; Debug.Log("anim = false"); cat_box_collider = paw_main.GetComponent <BoxCollider>(); cat_box_collider.enabled = false; cat_playerSwipe = paw_main.GetComponent <PlayerSwipe>(); cat_playerSwipe.enabled = false; main_changed = false; to_toast = false; } if ((to_main) && (paw_toast_animator.GetCurrentAnimatorStateInfo(0).IsName("paw_down_toast_done"))) { //Disable current paw's components GameObject cat_paw_toast_mesh = GameObject.Find("cat_paw_toast_mesh"); mesh = cat_paw_toast_mesh.GetComponent <MeshRenderer>(); mesh.enabled = false; cat_anim = paw_toast.GetComponent <Animator>(); //cat_anim.SetTrigger("reset"); cat_anim.enabled = false; cat_playerSwipe = paw_toast.GetComponent <PlayerSwipe>(); cat_playerSwipe.enabled = false; GameObject main_camera = GameObject.Find("Main Camera"); PlayerShooting cat_shooting = main_camera.GetComponent <PlayerShooting> (); cat_shooting.enabled = false; toast_changed = false; to_main = false; } }
//float clicked; void Awake() { _agent = GetComponent <NavMeshAgent>(); _animator = GetComponent <Animator>(); playershooting = GetComponentInChildren <PlayerShooting> (); }
// Start is called before the first frame update void Start() { ammo = FindObjectOfType <PlayerShooting>(); }
private void Awake() { playerShooting = GetComponent <PlayerShooting>(); playerShooting.WeaponChanged += UpdateGUI; }
void Start() { //weaponAudio = GetComponent<AudioSource>(); playerShootingGod = GetComponentInParent<PlayerShooting>(); colorIndex = PlayerPrefs.GetInt("crosshairColor"); crosshairColor = xhairColors[colorIndex]; SetInitialSpeed(); SetInitialCrosshair(); SetInitialAmmo(); }
void Awake() { PlayerShooting = GetComponent <PlayerShooting> (); }
void OnTriggerEnter(Collider other) { //Check if it is the player if (other.tag == "Player") { playerStats = other.GetComponent<StatsManager> (); playerShooting = other.GetComponent<PlayerShooting> (); playerMovement = other.GetComponent<PlayerMovement> (); playerPrefix = other.name; playerAugSprite = GameObject.Find (playerPrefix + "Aug"); playerWeapSprite = GameObject.Find (playerPrefix + "Weap"); if (other.name == "P1") { nextPickup = nextPickupP1; } else { nextPickup = nextPickupP2; } if (Time.time > nextPickup) { //Check which pickup it is and apply effects switch (powerupType) { // case "BeepAugment": // Augment temp = new Augment ("Sounds/beep/beep_1"); // Debug.Log (temp); // playerStats.SetAugment (temp); // playerAugSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("SpeedUpSprite"); // Debug.Log (playerStats.GetAugment()); // break; // case "GrowAugment": // GrowAugment g = new GrowAugment(); // Debug.Log (g); // playerStats.SetAugment (g); // playerAugSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("BulletSpeedUpSprite"); // Debug.Log (playerStats.GetAugment()); // break; case "FireAugment": if (playerStats.GetAugment() != null) { oldAugment = playerStats.GetAugment().Element; } FireAugment f = new FireAugment(); Debug.Log (f); playerStats.SetAugment (f); playerAugSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("Interface/Augment-Red-Blank"); audioPlacement.PlayClip("AugmentPickUp", 1f); Debug.Log (playerStats.GetAugment()); break; case "IceAugment": if (playerStats.GetAugment() != null) { oldAugment = playerStats.GetAugment().Element; } IceAugment i = new IceAugment(); Debug.Log (i); playerStats.SetAugment (i); playerAugSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("Interface/Augment-Blue-Blank"); audioPlacement.PlayClip("AugmentPickUp", 1f); Debug.Log (playerStats.GetAugment()); break; case "EarthAugment": if (playerStats.GetAugment() != null) { oldAugment = playerStats.GetAugment().Element; } EarthAugment e = new EarthAugment (); Debug.Log (e); playerStats.SetAugment (e); playerAugSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("Interface/Augment-Green-Blank"); audioPlacement.PlayClip("AugmentPickUp", 1f); Debug.Log (playerStats.GetAugment ()); break; case "Pistol": oldWeapon = playerShooting.curWeap; playerShooting.ChangeWeapon(powerupType); audioPlacement.PlayClip("WeaponPickUp", 1f); break; case "RayGun": oldWeapon = playerShooting.curWeap; playerShooting.ChangeWeapon(powerupType); //playerWeapSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("raygunsprite"); audioPlacement.PlayClip("WeaponPickUp", 1f); break; case "Sword": oldWeapon = playerShooting.curWeap; playerShooting.ChangeWeapon (powerupType); //playerWeapSprite.GetComponent<Image> ().sprite = Resources.Load<Sprite> ("swordsprite"); audioPlacement.PlayClip("WeaponPickUp", 1f); break; case "FullHealth": if (HealthManager.currentHealth < 10) { HealthManager.HealHealth (2); audioPlacement.PlayClip("ItemPickUp", 1f); } else { notUsed = true; } break; case "HalfHealth": if (HealthManager.currentHealth < 10) { HealthManager.HealHealth (1); audioPlacement.PlayClip("ItemPickUp", 1f); } else { notUsed = true; } break; } if (oldWeapon != null) { if (oldWeapon == "Pistol") { oldWeaponPickup = Instantiate (pistolPickup, transform.position, pistolPickup.transform.rotation) as GameObject; } else if (oldWeapon == "RayGun") { oldWeaponPickup = Instantiate (rayGunPickup, transform.position, rayGunPickup.transform.rotation) as GameObject; } else if (oldWeapon == "Sword") { oldWeaponPickup = Instantiate (swordPickup, transform.position, swordPickup.transform.rotation) as GameObject; } oldWeaponPickup.transform.parent = playerStats.RoomIn.transform; oldWeapon = null; } if (oldAugment != null) { if (oldAugment == "fire") { oldAugmentPickup = Instantiate (redAugmentPickup, transform.position, redAugmentPickup.transform.rotation) as GameObject; } else if (oldAugment == "ice") { oldAugmentPickup = Instantiate (blueAugmentPickup, transform.position, blueAugmentPickup.transform.rotation) as GameObject; } else if (oldAugment == "earth") { oldAugmentPickup = Instantiate (greenAugmentPickup, transform.position, greenAugmentPickup.transform.rotation) as GameObject; } oldAugmentPickup.transform.parent = playerStats.RoomIn.transform; oldAugment = null; } //Get rid of the pickup if it has been used if (!notUsed){ Destroy (gameObject); } //Reset the variable for next switch statement notUsed = false; //Check if P1 or P2 picked it up, update nextPickup time respectively if (other.name == "P1") { nextPickupP1 = Time.time + 1f; } else { nextPickupP2 = Time.time + 1f; } } } }
static public void SetPlayerShooting(PlayerShooting ps) { playerShooting = ps; }
void Start() { playerShooting = GetComponent <PlayerShooting> (); lengthReloadSound = reloadSound.length; }
//AudioSource audio; // Use this for initialization void Start () { PhotonNetwork.sendRate = 30; PhotonNetwork.sendRateOnSerialize = 15; currentWeaponIndex = 0; alive = true; photonView = GetComponent<PhotonView> (); //Disables my Character Controller interstingly enough. That way I can only enable it for the clien'ts player. transform.GetComponent<Collider>().enabled = false; //Use this to get current player this script is attached too aSources = GetComponents<AudioSource> (); audio0 = aSources [0]; audio1 = aSources [1]; audio2 = aSources [2]; lerpRate = normalLerpRate; anim = GetComponentInChildren<Animator> (); //animEthan = transform.Find("char_ethan").GetComponent<Animator> (); injuryAnim = GameObject.FindGameObjectWithTag ("InjuryEffect").GetComponent<Animator>(); GMan = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>(); NM = GameObject.FindGameObjectWithTag ("NetworkManager").GetComponent<NetworkManager>(); playerShooting = GetComponentInChildren<PlayerShooting> (); /*muzzleLightFlashGO = GameObject.FindGameObjectsWithTag("LightFlash"); //To assign the each players own muzzle flash toggle and not someone elses. for(int i = 0; i < muzzleLightFlashGO.Length; i++){ //If the weapon we find has the same ID as the player its attached to, set the tag to layer 10 if(muzzleLightFlashGO[i].GetComponentInParent<PlayerShooting>().gameObject.GetInstanceID() == playerShooting.gameObject.GetInstanceID() ){ muzzleLightFlash = muzzleLightFlashGO[i].GetComponent<Light>(); //muzzleLightFlash.enabled = false; //muzzleFlashToggle = false; } }*/ //If its my player, not anothers Debug.Log ("<color=red>Joined Room </color>" + PhotonNetwork.player.name + " " + photonView.isMine); if (photonView.isMine) { //Enable CC so we can control character. transform.GetComponent<Collider>().enabled = true; //Use for Sound toggle _characterController = GetComponent<CharacterController>(); playerName = PhotonNetwork.player.name; //enable each script just for the player being spawned and not the others GetComponent<Rigidbody>().useGravity = true; GetComponent<UnitySampleAssets.Characters.FirstPerson.FirstPersonController>().enabled = true; playerShooting.enabled = true; foreach(Camera cam in GetComponentsInChildren<Camera>()){ cam.enabled = true; } foreach(AudioListener AL in GetComponentsInChildren<AudioListener>()){ AL.enabled = true; } //So that we can see our own weapons on the second camera and not other player weapons through walls WeaponSetup(); //Change Body Part Collider Layers from default to body just for the player's own game not all players so that they can collide with others //We need to ignore colliders cause we layer a lot of them together //So we find all body parts and if it matches our own we are good to change it so it can be ignored. for(int i = 0; i < GameObject.FindGameObjectsWithTag("Body").Length; i++){ if(GameObject.FindGameObjectsWithTag("Body")[i].GetComponentInParent<PlayerNetworkMover>().gameObject.GetInstanceID() == gameObject.GetInstanceID() ){ GameObject.FindGameObjectsWithTag("Body")[i].layer = 12; } } //Now for the head for(int i = 0; i < GameObject.FindGameObjectsWithTag("Head").Length; i++){ if(GameObject.FindGameObjectsWithTag("Head")[i].GetComponentInParent<PlayerNetworkMover>().gameObject.GetInstanceID() == gameObject.GetInstanceID() ){ GameObject.FindGameObjectsWithTag("Head")[i].layer = 12; } } //If player is ours have CC ignore body parts Physics.IgnoreLayerCollision(0,12, true); InitPostProcessingEffects(); } else{ //All other players StartCoroutine ("UpdateData"); } /*if(muzzleLightFlash != null){ muzzleFlashToggle = true; if(muzzleFlashToggle){ Debug.Log ("muzzleFlash True"); muzzleLightFlash.enabled = true; } else{ muzzleLightFlash.enabled = false; } }*/ }
void Awake() { _plShoot = GetComponent <PlayerShooting>(); }
void Awake() { testText = GameObject.Find("TestText"); test = testText.GetComponent <Text> (); player = GameObject.FindGameObjectWithTag("Player"); kretanje = player.GetComponent <PlayerMovement> (); pHP = player.GetComponent <PlayerHealth> (); pEN = player.GetComponent <PlayerEnergy> (); // Center = GameObject.Find ("Center"); // Front = GameObject.Find ("Front"); // Back = GameObject.Find ("Back"); LeftWing = GameObject.Find("LeftWing"); RightWing = GameObject.Find("RightWing"); lW = LeftWing.GetComponent <PlayerShooting> (); rW = RightWing.GetComponent <PlayerShooting> (); lWLR = LeftWing.GetComponent <LineRenderer> (); rWLR = RightWing.GetComponent <LineRenderer> (); lWParticles = LeftWing.GetComponent <ParticleSystem> (); rWParticles = RightWing.GetComponent <ParticleSystem> (); klasaTekstObjekt = GameObject.Find("ClassNameText"); klasaTekst = klasaTekstObjekt.GetComponent <Text> (); abilityImageHUD1 = GameObject.FindGameObjectWithTag("Ability1"); abilityImage1 = abilityImageHUD1.GetComponent <Image> (); abilityImageHUD2 = GameObject.FindGameObjectWithTag("Ability2"); abilityImage2 = abilityImageHUD2.GetComponent <Image> (); abilityImageHUD3 = GameObject.FindGameObjectWithTag("Ability3"); abilityImage3 = abilityImageHUD3.GetComponent <Image> (); direktorij = Directory.GetCurrentDirectory(); provjera = direktorij + @"\radioaktivne_mrkve.txt"; provjera2 = direktorij + @"\radioaktivne_mrkve2.txt"; if (!File.Exists(provjera)) { klasa = 1; } else { System.IO.StreamReader file = new System.IO.StreamReader(provjera); while ((line = file.ReadLine()) != null) { if (line.Contains("Klasa: ")) { spremanje = line; spremanje = spremanje.Replace("Klasa: ", ""); } } file.Close(); klasa = int.Parse(spremanje); if (klasa < 1 || klasa > 5) { klasa = 1; } file.Close(); System.IO.StreamReader file2 = new System.IO.StreamReader(provjera); while ((line = file2.ReadLine()) != null) { provjera_load = klasa.ToString() + "Level: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); level = int.Parse(spremanje); } provjera_load = klasa.ToString() + "Experience: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); experience = int.Parse(spremanje); } provjera_load = klasa.ToString() + "hpUp: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); tempHP = int.Parse(spremanje); } provjera_load = klasa.ToString() + "pdUp: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); tempPDMG = float.Parse(spremanje); } provjera_load = klasa.ToString() + "sdUp: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); tempSDMG = float.Parse(spremanje); } provjera_load = klasa.ToString() + "enUp: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); tempEN = float.Parse(spremanje); } provjera_load = klasa.ToString() + "regUp: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); tempREG = float.Parse(spremanje); } provjera_load = klasa.ToString() + "movUp: "; if (line.Contains(provjera_load)) { spremanje = line; spremanje = spremanje.Replace(provjera_load, ""); tempMov = float.Parse(spremanje); } } file2.Close(); } if (klasa == 1) { className = "Aurelius "; fireEffect1 = 1; fireEffect2 = 2; Sprite newSprite = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Elements_Nature"); if (newSprite) { abilityImage1.sprite = newSprite; } //Heal healComp = Center.AddComponent<Heal>() as Heal; } if (klasa == 2) { className = "Bismarck "; fireEffect1 = 0; fireEffect2 = 3; MeshRenderer mesh = player.GetComponent <MeshRenderer> (); mesh.material = Resources.Load <Material>("Meshes/SciFi_Fighter_AK5-diffuse-Yellow"); Sprite newSprite = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Weapons_Bow"); if (newSprite) { abilityImage1.sprite = newSprite; } Front = (GameObject)Instantiate(Resources.Load("Parts/FrontBismarck")); Front.transform.parent = player.transform; Sprite newSprite2 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Weapons_Hammer"); if (newSprite2) { abilityImage2.sprite = newSprite2; } Center = (GameObject)Instantiate(Resources.Load("Parts/CenterBismarck")); Center.transform.parent = player.transform; Sprite newSprite3 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Equipment_Shield"); if (newSprite3) { abilityImage3.sprite = newSprite3; } Back = (GameObject)Instantiate(Resources.Load("Parts/BackBismarck")); Back.transform.parent = player.transform; } if (klasa == 3) { className = "Themistocles "; fireEffect1 = 0; fireEffect2 = 2; Sprite newSprite3 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Weapons_Bomb"); if (newSprite3) { abilityImage3.sprite = newSprite3; } Front = (GameObject)Instantiate(Resources.Load("Parts/FrontThemistocles")); Front.transform.parent = player.transform; Sprite newSprite2 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Modifiers_Time"); if (newSprite2) { abilityImage2.sprite = newSprite2; } Center = (GameObject)Instantiate(Resources.Load("Parts/CenterThemistocles")); Center.transform.parent = player.transform; Sprite newSprite1 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Equipment_Boots"); if (newSprite1) { abilityImage1.sprite = newSprite1; } Back = (GameObject)Instantiate(Resources.Load("Parts/BackThemistocles")); Back.transform.parent = player.transform; } if (klasa == 4) { className = "Tesla "; fireEffect1 = 0; fireEffect2 = 5; MeshRenderer mesh = player.GetComponent <MeshRenderer> (); mesh.material = Resources.Load <Material>("Meshes/SciFi_Fighter_AK5-diffuse-Blue"); rWParticles.startColor = Color.blue; lWParticles.startColor = Color.blue; Sprite newSprite1 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Modifiers_Accuracy"); if (newSprite1) { abilityImage1.sprite = newSprite1; } Center = (GameObject)Instantiate(Resources.Load("Parts/BackTesla")); Center.transform.parent = player.transform; Sprite newSprite2 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Elements_Air"); if (newSprite2) { abilityImage2.sprite = newSprite2; } Center = (GameObject)Instantiate(Resources.Load("Parts/CenterTesla")); Center.transform.parent = player.transform; Sprite newSprite3 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Modifiers_LevelUp"); if (newSprite3) { abilityImage3.sprite = newSprite3; } Center = (GameObject)Instantiate(Resources.Load("Parts/FrontTesla")); Center.transform.parent = player.transform; } if (klasa == 5) { className = "Archimedes "; fireEffect1 = 0; fireEffect2 = 4; Sprite newSprite1 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/Elements_Fire"); if (newSprite1) { abilityImage1.sprite = newSprite1; } Front = (GameObject)Instantiate(Resources.Load("Parts/FrontArchimedes")); Front.transform.parent = player.transform; Sprite newSprite2 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/World_RoseOfWinds"); if (newSprite2) { abilityImage2.sprite = newSprite2; } Back = (GameObject)Instantiate(Resources.Load("Parts/BackArchimedes")); Back.transform.parent = player.transform; Sprite newSprite3 = Resources.Load <Sprite>("Images/64 flat icons/png/128px/UI_Gamepad"); if (newSprite3) { abilityImage3.sprite = newSprite3; } Center = (GameObject)Instantiate(Resources.Load("Parts/CenterArchimedes")); Center.transform.parent = player.transform; //Drones dronesComp = Center.AddComponent<Drones>(); } tempStr = className + level.ToString(); klasaTekst.text = tempStr; expSlider.value = experience; rHealth = classData.RetrieveInteger(1, klasa); rHealth = rHealth + tempHP; rEnergy = classData.RetrieveFloat(1, klasa); rEnergy = rEnergy + tempEN; rRegen = classData.RetrieveFloat(2, klasa); rRegen = rRegen + tempREG; rMovement = classData.RetrieveFloat(3, klasa); rMovement = rMovement + tempMov; rPROF = classData.RetrieveFloat(4, klasa); rSROF = classData.RetrieveFloat(5, klasa); rPDMG = classData.RetrieveFloat(6, klasa); rPDMG = rPDMG + tempPDMG; rSDMG = classData.RetrieveFloat(7, klasa); rSDMG = rSDMG + tempSDMG; float tempDelay1, tempDelay2; tempDelay1 = 0.2f / (rPROF / 0.15f); tempDelay2 = 0.2f / (rSROF / 0.15f); pHP.SetHealth(rHealth); pEN.SetEnergy(rEnergy, rRegen); kretanje.SetSpeed(rMovement); lW.SetData(rPDMG, rPROF, 80f, "Fire1", tempDelay1, fireEffect1); rW.SetData(rSDMG, rSROF, 80f, "Fire2", tempDelay2, fireEffect2); string tempLineRender = "LineRenderMaterial" + klasa.ToString(); lWLR.material = Resources.Load <Material>(tempLineRender); rWLR.material = Resources.Load <Material>(tempLineRender); }
void Start() { time = GetComponent<Timeline>(); _Anim = GetComponent<Animator>(); _Rb2d = time.GetComponent<Rigidbody2D>(); _PlayerShooting = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerShooting>(); }
void Start() { shake = Camera.main.GetComponent <ScreenShake>(); player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerShooting>(); }
// Use this for initialization void Start () { playerAugment = null; if (playerPrefix == "P1") { otherPlayerPrefix = "P2"; } else { otherPlayerPrefix = "P1"; } if ((Application.platform == RuntimePlatform.OSXEditor) || (Application.platform == RuntimePlatform.OSXPlayer)) { swapButtonAug = "SwapAugMac" + playerPrefix; } else if ((Application.platform == RuntimePlatform.WindowsEditor) || (Application.platform == RuntimePlatform.WindowsPlayer)) { swapButtonAug = "SwapAugPC" + playerPrefix; } otherPlayerStats = GameObject.Find (otherPlayerPrefix).GetComponent<StatsManager> (); playerAugSprite = GameObject.Find (playerPrefix + "Aug"); otherPlayerAugSprite = GameObject.Find (otherPlayerPrefix + "Aug"); otherPlayerHudImage = GameObject.Find(otherPlayerPrefix + "Hud").GetComponent<Image>(); if (playerPrefix == "P1") { hudDefault = Resources.Load<Sprite> ("Interface/P2-slots-blank"); hudReq = Resources.Load<Sprite> ("Interface/P2-slots-prompt"); } else if (playerPrefix == "P2") { hudDefault = Resources.Load<Sprite> ("Interface/P1-slots-blank"); hudReq = Resources.Load<Sprite> ("Interface/P1-slots-prompt"); } if (roomIn != null) { transform.position = new Vector3(roomIn.transform.position.x, 0f, roomIn.transform.position.z); } playerShooting = GetComponent<PlayerShooting> (); otherPlayerShooting = GameObject.Find (otherPlayerPrefix).GetComponent<PlayerShooting> (); foreach (Transform child in transform) { if (child.tag == "Hoop") { hoopController = child.gameObject.GetComponent<HoopController>(); } } //Determine shooting buttons for OS and Player if ((Application.platform == RuntimePlatform.OSXEditor) || (Application.platform == RuntimePlatform.OSXPlayer)) { pingButton = "PingMac" + playerPrefix; } else if ((Application.platform == RuntimePlatform.WindowsEditor) || (Application.platform == RuntimePlatform.WindowsPlayer)) { pingButton = "PingPC" + playerPrefix; } }
void Awake() { playerMovement = GetComponent <PlayerController>(); playerShooting = GetComponentInChildren <PlayerShooting>(); currentHealth = startingHealth; }
public override void Shoot(float timer, PlayerShooting shootingControl) { if (timer >= timeBetweenBullets && Time.timeScale != 0 && !playerHealth.dead && !playerHealth.end) { shootingControl.ResetTimer(); effectTimer = 0f; // Play the gun shot audioclip. gunAudio.Play(); // Enable the lights. gunLight.enabled = true; faceLight.enabled = true; // Stop the particles from playing if they were, then start the particles. gunParticles.Stop(); gunParticles.Play(); // Enable the line renderer and set it's first position to be the end of the gun. gunLine1.enabled = true; gunLine1.SetPosition(0, transform.position); // Enable the line renderer and set it's first position to be the end of the gun. gunLine2.enabled = true; gunLine2.SetPosition(0, transform.position); // Enable the line renderer and set it's first position to be the end of the gun. gunLine3.enabled = true; gunLine3.SetPosition(0, transform.position); Ray shootRay1 = new Ray(); // A ray from the gun end forwards. Ray shootRay2 = new Ray(); // A ray from the gun end forwards. Ray shootRay3 = new Ray(); // A ray from the gun end forwards. RaycastHit shootHit1; // A raycast hit to get information about what was hit. RaycastHit shootHit2; // A raycast hit to get information about what was hit. RaycastHit shootHit3; // A raycast hit to get information about what was hit. // Set the shootRay so that it starts at the end of the gun and points forward from the barrel. shootRay1.origin = transform.position; shootRay1.direction = transform.forward; // Set the shootRay so that it starts at the end of the gun and points forward from the barrel. shootRay2.origin = transform.position; shootRay2.direction = Quaternion.Euler(0, -15, 0) * transform.forward; // Set the shootRay so that it starts at the end of the gun and points forward from the barrel. shootRay3.origin = transform.position; shootRay3.direction = Quaternion.Euler(0, 15, 0) * transform.forward; // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay1, out shootHit1, range, shootableMask)) { // Try and find an EnemyHealth script on the gameobject hit. EnemyHealth enemyHealth = shootHit1.collider.GetComponent <EnemyHealth>(); // If the EnemyHealth component exist... if (enemyHealth != null) { // ... the enemy should take damage. enemyHealth.TakeDamage(damagePerShot, shootHit1.point); } // Set the second position of the line renderer to the point the raycast hit. gunLine1.SetPosition(1, shootHit1.point); } // If the raycast didn't hit anything on the shootable layer... else { // ... set the second position of the line renderer to the fullest extent of the gun's range. gunLine1.SetPosition(1, shootRay1.origin + shootRay1.direction * range); } // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay2, out shootHit2, range, shootableMask)) { // Try and find an EnemyHealth script on the gameobject hit. EnemyHealth enemyHealth = shootHit2.collider.GetComponent <EnemyHealth>(); // If the EnemyHealth component exist... if (enemyHealth != null) { // ... the enemy should take damage. enemyHealth.TakeDamage(damagePerShot, shootHit2.point); } // Set the second position of the line renderer to the point the raycast hit. gunLine2.SetPosition(1, shootHit2.point); } // If the raycast didn't hit anything on the shootable layer... else { // ... set the second position of the line renderer to the fullest extent of the gun's range. gunLine2.SetPosition(1, shootRay2.origin + shootRay2.direction * range); } // Perform the raycast against gameobjects on the shootable layer and if it hits something... if (Physics.Raycast(shootRay3, out shootHit3, range, shootableMask)) { // Try and find an EnemyHealth script on the gameobject hit. EnemyHealth enemyHealth = shootHit3.collider.GetComponent <EnemyHealth>(); // If the EnemyHealth component exist... if (enemyHealth != null) { // ... the enemy should take damage. enemyHealth.TakeDamage(damagePerShot, shootHit3.point); } // Set the second position of the line renderer to the point the raycast hit. gunLine3.SetPosition(1, shootHit3.point); } // If the raycast didn't hit anything on the shootable layer... else { // ... set the second position of the line renderer to the fullest extent of the gun's range. gunLine3.SetPosition(1, shootRay3.origin + shootRay3.direction * range); } ammoCount = ammoCount - 3; if (ammoCount <= 0) { shootingControl.Switch(shootingControl.gun); } } }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); gun = GameObject.FindGameObjectWithTag("Gun"); playerHealth = player.GetComponent<PlayerHealth>(); playerMovement = player.GetComponent<PlayerMovement>(); playerShooting = gun.GetComponent<PlayerShooting>(); inventory = GameObject.FindGameObjectWithTag ("Inventory").GetComponent<Inventory> (); itemImage = gameObject.transform.GetChild(0).GetComponent<Image> (); itemAmount = gameObject.transform.GetChild (1).GetComponent<Text> (); }