// Use this for initialization void Start() { maxXBoundary *= unit; maxYBoundary *= unit; minXBoundary *= unit; minYBoundary *= unit; healthRegen = 5; regenDelay = 7; //get rigidbody component of player object rb2d = GetComponent <Rigidbody2D> (); //get particle system partSys = transform.FindChild("ParticleTrail").GetComponent <ParticleSystem>(); trailColor = partSys.startColor; //get shield script shield = GetComponentInChildren <PlayerShield>(); //set player health to starting health playerHealth = playerStartingHealth; mainCam = Camera.main.GetComponent <CameraShake>(); currentFuel = MAX_FUEL; if (joystick == null && GameObject.Find("VirtualJoystickMovement") != null) { joystick = GameObject.Find("VirtualJoystickMovement").GetComponentInChildren <VirtualJoystickMovement>(); } StartCoroutine(healthDamageCoroutine()); }
public void Shield() { PowerUp.Play(); PlayerShield.SetActive(true); ShieldActive = true; GCS.Score += 200; }
private void Awake() { // Needed for runtime modification of emission colour _batonRenderer.material.EnableKeyword("_EMISSION"); _batonLineRenderer = _batonRenderer.transform.parent.parent.GetChild(0).GetComponent <LineRenderer>(); _batonLineRenderer.enabled = true; _pointerOrigin = _batonLineRenderer.transform; _attackLineRenderer = _batonRenderer.transform.parent.parent.GetChild(1).GetComponent <LineRenderer>(); _batonParticleSystem = _pointerOrigin.transform.GetChild(0).GetComponent <ParticleSystem>(); _audioSource = GetComponent <AudioSource>(); _batonLineRenderer.SetPosition(0, _pointerOrigin.InverseTransformPoint(_pointerOrigin.position)); _batonLineRenderer.SetPosition(1, _pointerOrigin.InverseTransformPoint(_pointerOrigin.position + _pointerOrigin.forward * _pointerLineLength)); _vignette = GameObject.Find("PostProcessing").GetComponent <PostProcessVolume>().profile.GetSetting <Vignette>(); _playerShield = GetComponentInChildren <PlayerShield>(); _shieldUpgrades = Resources.Load <ShieldUpgrades>("ScriptableObjects/PlayerUpgrades/ShieldUpgrades"); _batonUpgrades = Resources.Load <BatonUpgrades>("ScriptableObjects/PlayerUpgrades/BatonUpgrades"); _maxLevel = _shieldUpgrades._shieldUpgrades.Count + _batonUpgrades._batonUpgrades.Count - 2; _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _quizManager = GameObject.Find("CaveQuizManager").GetComponent <CaveQuizManager>(); UpdatePlayerUpgrades(); ResetBaton(); }
void Start() { rb2d = GetComponent <Rigidbody2D>(); coll = GetComponent <Collider2D>(); Anim = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); shieldController = GetComponentInChildren <PlayerShield>(); magnetController = GetComponentInChildren <Magnet>(); AnimationLoseBee = transform.Find("LoseAnimation_Bee").GetComponent <PlayableDirector>(); AnimationLoseExplosion = transform.Find("LoseAnimation_Explosion").GetComponent <PlayableDirector>(); AnimationWin = transform.Find("WinAnimation").GetComponent <PlayableDirector>(); Transform jetpack = transform.Find("Jetpack"); burstAnim1 = jetpack.Find("JetpackBurst1").GetComponent <Animator>(); burstAnim2 = jetpack.Find("JetpackBurst2").GetComponent <Animator>(); smokes = jetpack.GetComponentsInChildren <ParticleSystem>(); // if(DataManager.Shield) shieldController.Show(); // if(DataManager.MagnetCount > 0) magnetController.Show(); }
// Start is called before the first frame update void Awake() { playerAnimation = GetComponent <CharacterAnimations>(); shield = GetComponent <PlayerShield>(); soundFX = GetComponentInChildren <CharacterSoundFX>(); }
void Awake() { playerShield = GetComponentInParent <PlayerShield>(); gunLine = GetComponent <LineRenderer>(); blasterSource = GetComponent <AudioSource>(); blasterSource.clip = blasterClip; }
void Start() { InventoryGUI = GameObject.FindGameObjectWithTag("InventoryGUI"); weaponSlot = GameObject.FindGameObjectWithTag("Player").transform.Find("SwordSlot").gameObject; weaponToolTip = InventoryGUI.transform.Find("Weapon Tool Tip").gameObject; playerSwordSlot = GameObject.FindGameObjectWithTag("SwordSlot").GetComponent <PlayerSword>(); playerShieldSlot = GameObject.FindGameObjectWithTag("ShieldSlot").GetComponent <PlayerShield>(); }
// Use this for initialization void Start() { float time = Time.time; //Get the playerShield component and store it in a variable playerShield = GetComponent <PlayerShield>(); PlayerPrefs.GetInt(highScoreKey, 0); }
private void Awake() { playerShield = FindObjectOfType <PlayerShield>(); animator = GetComponentInChildren <Animator> (); body2d = GetComponent <Rigidbody2D>(); isBlasting = false; }
// Use this for initialization void Start() { PullOBJ = GetComponent <Transform> (); playerShip = GameObject.FindGameObjectWithTag("Player"); if (playerShip != null) { _playerShield = playerShip.GetComponent <PlayerShield> (); } }
void Awake() { playerAnimation = GetComponent <CharacterAnimations>(); playerShield = GetComponent <PlayerShield>(); attackMovement = new AttackMovement(); attackMovement.soundFX = GetComponentInChildren <CharacterSoundFX>(); }
void Awake() { source = GetComponent <AudioSource>(); player = GameObject.FindWithTag("Player"); if (player != null) { _playerShield = player.GetComponent <PlayerShield> (); } }
// Use this for initialization void Start() { // make sure the GameManager gets the player's instance GameManager.Instance.SetPlayer(gameObject); shield = GetComponent <PlayerShield>(); currentHP = maxHP; HPbar.value = calcHPpercentage(); }
void Awake() { // Setting up references. anim = GetComponent <Animator>(); t = GetComponent <Transform>(); r = GetComponent <Rigidbody2D>(); _playerHealth = GetComponent <PlayerHealth> (); _playerShield = GetComponent <PlayerShield> (); _playerEnergy = GetComponent <PlayerEnergy> (); }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "PlayerBullet") { playerBullet = col.gameObject.GetComponent <Bullet>(); //Beem = col.gameObject.GetComponent<Bullet>(); Debug.Log("敵Hit"); // ヒットポイントを減らす hp = hp - playerBullet.power; // hp = hp - playerBullet.power; if (hp <= 0) { PlayerDes(); Destroy(gameObject); Debug.Log("敵死亡"); } } if (col.gameObject.tag == "Beem") { playerBullet = col.gameObject.GetComponent <Bullet>(); Debug.Log("敵Hit"); // ヒットポイントを減らす hp = hp - playerBullet.power; if (hp <= 0) { PlayerDes(); Destroy(gameObject); Debug.Log("敵死亡"); } } //if (col.gameObject.tag == "Beem") //{ // playerBullet = col.gameObject.GetComponent<Bullet>(); // Debug.Log("敵Hit"); // // ヒットポイントを減らす // hp = hp - playerBullet.power; // if (hp <= 0) // { // Destroy(gameObject); // Debug.Log("敵死亡"); // } //} if (col.gameObject.tag == "PlayerShield") { playerShield = col.gameObject.GetComponent <PlayerShield>(); Destroy(gameObject); Debug.Log("敵死亡"); } }
void OnTriggerEnter(Collider other) { if (other.gameObject == si_rudo) { var ef_shiled = Instantiate(Ef_shiled, transform.position, Quaternion.identity); Destroy(ef_shiled, 1f); PS = player.GetComponent <PlayerShield>(); PS.ShieldDamage(EB_damage); Destroy(gameObject); } }
// Start is called before the first frame update void Start() { m_Rb = GetComponent <Rigidbody>(); playerQuetzal = this.transform; rotation = transform.localRotation; rotation.y = 1f; myShield = GetComponent <PlayerShield>(); myShield.ChangeShield(i); }
private void Awake() { playerShield = FindObjectOfType <PlayerShield>(); animator = GetComponentInChildren <Animator> (); body2d = GetComponent <Rigidbody2D>(); SetStateMoving(); aimTransform = transform.Find("Aim"); turtlesprite = transform.Find("turtlesprite"); isMoving = true; HideAim(); }
// Use this for initialization void Start() { timeLeft = 60; updateOn = true; knockback = false; floorLayer = LayerMask.GetMask("Floor"); //healthList= new Stack(GameObject.FindGameObjectsWithTag("Healthbar")); manaTimer = 0; animationTimer = 0; _rigidbody = GetComponent <Rigidbody2D>(); _animator = GetComponent <Animator>(); _animator.SetBool("Idle2", false); airborn = false; _rigidbody.transform.localScale = new Vector3(2f, 2f, 0f); _rigidbody.mass = WEIGHT; _rigidbody.gravityScale = GRAVITY; health = STARTHEALTH; mana = STARTMANA; shield = false; manabar.value = getMana(); for (int i = 0; i < health; i++) { GameObject testing = Instantiate(itemprefab); testing.transform.SetParent(Healthbar.transform, false); } ps = GetComponentInChildren <PlayerShield>(); pb = GetComponentInChildren <Blink>(); pp = GetComponentInChildren <Projectile>(); string scene = SceneManager.GetActiveScene().name; if (scene != "game") { GameObject tmp = Instantiate(GameObject.FindGameObjectWithTag("item1")); tmp.transform.SetParent(Inventory.transform, false); pp.itemFound = true; GameObject.Find("item1").GetComponent <Image>().enabled = true; GameObject tmp1 = Instantiate(GameObject.FindGameObjectWithTag("item2")); tmp1.transform.SetParent(Inventory.transform, false); ps.itemFound = true; GameObject.Find("item2").GetComponent <Image>().enabled = true; GameObject tmp2 = Instantiate(GameObject.FindGameObjectWithTag("item3")); tmp2.transform.SetParent(Inventory.transform, false); pb.itemFound = true; GameObject.Find("item3").GetComponent <Image>().enabled = true; } }
private ParticleSystem _CastSpel_PS; //Animator for the player private void Awake() { _movement = GetComponent <PlayerMovement>(); _body = GetComponent <Rigidbody2D>(); _shield = GetComponent <PlayerShield>(); _triggerCollision = transform.Find("CollisionDetection").GetComponent <PlayerTriggerCollision>(); _attackResource = GetComponent <PlayerAttackResource>(); //ref to animator to update when moving _animatorRED = this.gameObject.transform.GetChild(1).GetComponent <Animator>(); _animatorBLUE = this.gameObject.transform.GetChild(2).GetComponent <Animator>(); //ref to particle system _CastSpel_PS = this.gameObject.transform.GetChild(3).GetComponent <ParticleSystem>(); }
public Player(Camera camera) { this.camera = camera; collision = new Circle() { Radius = 10, Position = new Vector2(camera.Position.X, camera.Position.Y), Mass = 1 }; collisionResult = CollisionResult.None; CurrentHealth = MaxHealth; animator = new Animator(animDict_Idle[FourDirectionAnimation.Front]); Weapon = new PlayerWeapon(camera); Shield = new PlayerShield(collision); }
public override void OnEnable() { playerShield = FindObjectOfType <PlayerShield>(); try { target = FindObjectOfType <PlayerMovement>().transform; } catch (Exception ex) { } //float num = UnityEngine.Random.Range(this.sizeMinMax.x, this.sizeMinMax.y); //this.thisTrans.localScale = new Vector3(num, num, 1f); this.rb2d = base.GetComponent <Rigidbody2D>(); //base.StartCoroutine(this.Behave()); }
public override void Start() { health = 1000; explosionScale = 0.4f; healthGUI = Instantiate(GameController.Instance.healthGUI).GetComponent <HealthGUI>(); healthGUI.target = gameObject; healthGUI.transform.SetParent(GameObject.FindGameObjectWithTag("MainCanvas").transform, false); healthGUI.updateHullHealth(health.ToString()); comboGUI = Instantiate(GameController.Instance.textoutGUI).GetComponent <TextoutGUI>(); comboGUI.target = gameObject; comboGUI.transform.SetParent(GameObject.FindGameObjectWithTag("MainCanvas").transform, false); pshield = gameObject.GetComponentInChildren <PlayerShield>(); pshield.disable(); base.Start(); }
void Start() { attackBoots = GetComponent <PlayerBoots>(); attackHelmet = GetComponent <PlayerHelmet>(); attackSword = sword.GetComponent <PlayerSword>(); attackShield = shield.GetComponent <PlayerShield>(); attackBoots.enabled = false; attackHelmet.enabled = false; attackSword.enabled = false; attackShield.enabled = false; sword.SetActive(false); shield.SetActive(false); }
void Start() { if (S == null) { S = this; } else { Debug.Log("Player.Awake() tried to be a sneaky little f**k"); } playerModel = transform.GetChild(0); playerShield = GetComponent <PlayerShield>(); SetSpeed(forwardSpeed); }
void updateHealth() { healthValue.text = playerHealth.getHealth() + "/" + playerHealth.playerHealth; if (GameObject.FindGameObjectWithTag("Shield") != null) { shield = GameObject.FindGameObjectWithTag("Shield"); playerShield = shield.GetComponent<PlayerShield>(); playerShield.bonusHealthSlider = bonusHSlider; playerShield.damageImage = damageImage; shieldValue.text = playerShield.currentShieldHealth + "/" + playerShield.shieldHealth; } else { shieldValue.text = ""; } }
void OnTriggerEnter(Collider c) { if (c.tag == "EnemyProjectile") { Destroy(c.gameObject); PlayerShield ps = GetComponentInParent <PlayerShield> (); ps.gatheredLaser += ps.laserTimePerProjectileHit; if (ps.gatheredLaser >= ps.maxLaserTime) { ps.gatheredLaser = ps.maxLaserTime; } GameObject pE = Instantiate(particleExplosion); pE.transform.position = c.transform.position; } }
void OnTriggerEnter(Collider col) { if (col.gameObject.tag == "Enemy") { playerShield = col.gameObject.GetComponent <PlayerShield>(); Debug.Log(col); Destroy(col.gameObject); } if (col.gameObject.tag == "EnemyBullet") { Debug.Log(gameObject); playerShield = col.gameObject.GetComponent <PlayerShield>(); Debug.Log(col); Destroy(col.gameObject); } }
void HandleHitObject(object sender, GlobalGameState.HitObjectArgs e) { if (IsGameOver) { return; // No more } // This part should always only be run on the server. if (e.hitRaycast.transform.GetComponent <PlayerShield>() != null) { PlayerShield shield = e.hitRaycast.transform.GetComponent <PlayerShield>(); if (shield.shieldLevel <= 0) { return; // Probably destroy by another shot in the same frame } shield.shieldLevel -= e.hitStrength; // Add to my score int scoreToAdd = +10; if (shield.shieldLevel <= 0) { // Player has died. Network.Destroy(e.hitRaycast.transform.GetComponent <NetworkView>().viewID); Quaternion rotation = Quaternion.FromToRotation(Vector3.up, e.hitRaycast.normal); Network.Instantiate(e.explosionEffect, e.hitRaycast.transform.position, rotation, 0); scoreToAdd += +20; } // Now go back to the object itself and update the score. scoreBoard.AddToPlayerScoreByGuid(e.weaponObject.networkView.owner.guid, scoreToAdd); networkView.RPC("SetPlayerScores", RPCMode.Others, scoreBoard.Serialize()); if (scoreBoard.GetPlayerScoreByGui(e.weaponObject.networkView.owner.guid) >= TargetScoreToWin) { // We have a winner. winner = scoreBoard.GetPlayerNameByGuid(e.weaponObject.networkView.owner.guid); Debug.Log("Winner is " + winner); GameOver(); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "EnemyExplosion") { if (ShieldActive) { collision.GetComponent <CircleCollider2D>().enabled = false; ShieldActive = false; PlayerShield.SetActive(false); } else { Instantiate(GCS.PlayerExplosion, transform.position, Quaternion.identity); GCS.KillPlayer(isPlayerOne); UICS.CountMissiles(0, isPlayerOne); UICS.CountRaygun(0, isPlayerOne); gameObject.SetActive(false); } } if (collision.tag == "Asteroid" || collision.tag == "EnemyAmmunition" || collision.tag == "Spinner" || collision.tag == "Reflecter" || collision.tag == "Cruiser" || collision.tag == "EnemyPlasma" || collision.tag == "Swarmer" || collision.tag == "Boss") { if (!ShieldActive) { Instantiate(GCS.PlayerExplosion, transform.position, Quaternion.identity); GCS.KillPlayer(isPlayerOne); UICS.CountMissiles(0, isPlayerOne); UICS.CountRaygun(0, isPlayerOne); gameObject.SetActive(false); } else { if (collision.tag != "Boss" && collision.tag != "Player") { Destroy(collision.gameObject); ShieldActive = false; PlayerShield.SetActive(false); } } } }
void Start() { controller = GetComponent <Controller2D> (); anim = gameObject.GetComponent<Animator>(); pa = gameObject.GetComponent<PlayerAttack>(); ps = gameObject.GetComponent<PlayerShield>(); gravity = -(2 * jumpHeight) / Mathf.Pow (timetoJumpApex,2); jumpVelocity = Mathf.Abs (gravity) * timetoJumpApex; //print ("Gravity: " + gravity + "jv: " +jumpVelocity); curHealth = maxHealth; DontDestroyOnLoad (this); }