void Start() { //Sets the choice made to false so the players can pick their choices choiceOneMade = false; choiceTwoMade = false; //Allows the combat manager to access the neccessary scripts for the first player playerOneShield = playerOneAsset.GetComponent <shieldGenerator>(); playerOneAttack = playerOneAsset.GetComponent <fireBullet>(); playerOneHeal = playerOneAsset.GetComponent <healing>(); playerOneHealth = playerOneAsset.GetComponent <health>(); //Allows the combat manager to access the neccessary scripts for the second player playerTwoShield = playerTwoAsset.GetComponent <shieldGenerator>(); playerTwoAttack = playerTwoAsset.GetComponent <fireBullet>(); playerTwoHeal = playerTwoAsset.GetComponent <healing>(); playerTwoHealth = playerTwoAsset.GetComponent <health>(); moveOne = ""; moveTwo = ""; playerOnePowerSet = false; playerTwoPowerSet = false; playerOnePowerValue = 1f; playerTwoPowerValue = 1f; hintPanel.SetActive(true); chargeHint.SetActive(false); moveHint.SetActive(false); continueHint.SetActive(false); specialHintOne.SetActive(false); specialHintTwo.SetActive(false); playerOneSpecialBar.value = 0; playerTwoSpecialBar.value = 0; }
void FindTarget() { visibletarget = Physics2D.OverlapAreaAll(topleftpt, downrightpt, targetlayer); vistarcount = visibletarget.Length; if (vistarcount > 0) { closestdis = Vector2.Distance(curpos, visibletarget[0].transform.position); closesttarnum = 0; closesttarget = visibletarget[0].transform; for (int i = 1; i < vistarcount; i++) { newdis = Vector2.Distance(curpos, visibletarget[i].transform.position); if (newdis < closestdis) { closestdis = newdis; closesttarnum = i; } } closesttarget = visibletarget[closesttarnum].transform; targethealthscript = closesttarget.GetComponent <health>(); } else { Debug.Log("No Target Here"); } }
void Update() { health enemyScript = GetComponent <health>(); if (enemyScript.stunned <= 0) { if (movingRight && wallOnRight) { pos = transform.position; movingRight = false; } if (!movingRight && wallOnLeft) { pos = transform.position; movingRight = true; } if (movingRight) { pos = pos + new Vector3(1, 0, 0); } else { pos = pos + new Vector3(-1, 0, 0); } transform.position = Vector3.MoveTowards(transform.position, pos, Time.deltaTime * speed); } }
// Use this for initialization void Start() { enemigoControlador = GetComponent <CharacterController> (); salud = GetComponent <health>(); moveVector = Vector3.zero; _componenteIA = GetComponentInChildren <AIRig> (); }
override public void PickUpObject(PickUpSystem WhoPicked) { health cmp = WhoPicked.gameObject.GetComponent <health>(); Debug.Log(WhoPicked.name + "Picked Up HP"); if (cmp.hp + hp <= cmp.maxhp) { //cmp.Ammo[weaponid] += numberofammo; cmp.Heal(hp); //WhoPicked.Global.PickUps.Remove(this); if (photonView.IsMine) //Destroy(this.gameObject); { PhotonNetwork.Destroy(this.gameObject); //Destroy(this.gameObject); } else // Вроде и так работает, но на всякий { //photonView.RequestOwnership(); //PhotonNetwork.Destroy(this.gameObject); Debug.Log("transfering ownership from " + photonView.Owner.NickName); //photonView.RequestOwnership(); //photonView.TransferOwnership(PhotonNetwork.LocalPlayer); //Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); photonView.SetOwnerInternal(PhotonNetwork.LocalPlayer, PhotonNetwork.LocalPlayer.ActorNumber); Debug.Log("owner is now " + photonView.Owner.NickName + " / should be " + PhotonNetwork.LocalPlayer.NickName); PhotonNetwork.Destroy(this.gameObject); } } else { hp -= cmp.maxhp - cmp.hp; cmp.Heal(cmp.maxhp - cmp.hp); } }
void Awake() { myHealth = GetComponent <health>(); myPlayerShoot = GetComponent <player_shoot>(); myPlayerMovement = GetComponent <player_movement>(); myAnimator = GetComponent <Animator>(); }
// Update is called once per frame void Update() { anim.ResetTrigger(attack); AnimatorStateInfo stateInfo = anim.GetCurrentAnimatorStateInfo(0); print(stateInfo); if (Input.GetButtonDown("Fire1") && !alreadyAttacked) { alreadyAttacked = true; print(stateInfo); print(cut); anim.SetTrigger(attack); Collider[] hits = Physics.OverlapBox(attack_area.transform.position + attack_area.center, attack_area.size / 2, Camera.main.transform.rotation); foreach (Collider obj in hits) { print(obj); health obj_health = obj.gameObject.GetComponent <health>(); if (obj_health) { obj_health.receive_damage(2); } break_door door = obj.gameObject.GetComponent <break_door>(); if (door) { door.play_break(); } } Invoke(nameof(ResetAttack), timeBetweenAttacks); } }
void OnCollisionEnter(Collision other) { hitEntity = other.gameObject; entityHealth = hitEntity.GetComponent<health>(); entityHealth.healthPoints -= 25; PhotonNetwork.Destroy(myPv); }
public void healtbarSet() { playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <health>(); healthBar = GetComponent <Slider>(); healthBar.maxValue = playerHealth.maxHealth; healthBar.value = playerHealth.maxHealth; }
void Update() { timer--; clock.text = "you have " + timer + " seconds"; if (timer == 0) { Time.timeScale = 0; timer = time; manager.workedF = true; Application.LoadLevel(1); } if (Input.GetMouseButtonDown(0)) { ray = Camera.main.ScreenPointToRay(Input.mousePosition); Physics.Raycast(ray, out hitinfo, Mathf.Infinity); GameObject target = hitinfo.collider.gameObject; if (target == null) { Debug.Log(""); } if (target.tag == "Enemy") { Debug.Log("whack!"); health h = target.GetComponent <health>(); if (!h) { Debug.Log(""); } h.Dodamage(); } } }
void Start() { getHealthScript = new health(); getHealthScript = GameObject.FindGameObjectWithTag("Scripts").GetComponent <health>(); shieldScript = new activeShield(); shieldScript = GameObject.FindGameObjectWithTag("Scripts").GetComponent <activeShield>(); }
// Use this for initialization void Start() { Camara = GameObject.FindGameObjectWithTag("MainCamera"); personajeController = GetComponent <CharacterController> (); animacion = GetComponent <Animator> (); salud = GetComponent <health>(); _targetScript = GetComponent <TargetSystem> (); }
public ActionResult DeleteConfirmed(int id) { health health = db.healths.Find(id); db.healths.Remove(health); db.SaveChanges(); return(RedirectToAction("Index")); }
// Start is called before the first frame update void Start() { movement = GetComponent <MovementRigidBody>(); hlth = GetComponent <health>(); weapon = GetComponentInChildren <WeaponHolder>(); ChoseCharacterTarget(); //movement.input.Set(1.0f, 1.0f); }
// Start is called before the first frame update void Start() { HealthScript = GameObject.FindObjectOfType(typeof(health)) as health; reverseLocation = HealthScript.spawnPosition; reversed = false; hCircleTriggered = false; spawnPos = gameObject.transform.position; }
void Awake() { GameMasterGo = GameObject.Find("GameMaster"); target = GameMasterGo.GetComponent <GameObject_handler>().getPlayer(); bulletGo = GameMasterGo.GetComponent <GameObject_handler>().bulletPrefab; myHealth = GetComponent <health>(); myAttributes = GetComponent <attributes>(); }
public void Start() { figter = GetComponent <Fighter>(); hp = GetComponent <health>(); player = GameObject.FindWithTag("Player"); guardPosition = transform.position; Movement = GetComponent <mover>(); }
void Awake() { GameMasterGo = GameObject.Find("GameMaster"); myBody = GetComponent <Rigidbody2D>(); GameSettings = GameMasterGo.GetComponent <game_settings>(); myHealth = GetComponent <health>(); myAttributes = GetComponent <attributes>(); }
void Awake() { mySpriteRenderer = GetComponent <SpriteRenderer>(); myAnimator = GetComponent <Animator>(); myPlayerShoot = GetComponent <player_shoot>(); myPlayerHealth = GetComponent <health>(); GameMaster = GameObject.Find("GameMaster"); }
// Start is called before the first frame update void Start() { canvas = GameObject.Find("Canvas"); healthScript = canvas.GetComponent <health>(); gameOverUI.SetActive(false); levelMusic = musicPlayer.GetComponent <AudioSource>(); originalVolume = levelMusic.volume; }
// Use this for initialization void Start() { hscr = gameObject.GetComponent <health>(); mscr = GameObject.Find("Working").GetComponent <Money>(); if (!isTower) { escr = gameObject.GetComponent <EnemyStats>(); } }
void OnTriggerEnter(Collider other) { if (other.tag == "lava") { player.transform.position = spawnPoint.position; health eH = (health)target.GetComponent("health"); eH.AddjustCurentHealth(-10); } }
void Awake() { myPlayerMovement = GetComponent <player_movement>(); myHealth = GetComponent <health>(); myAnimator = GetComponent <Animator>(); GameMaster = GameObject.Find("GameMaster"); fireRateTimer = 0f; grenadeTimer = 0f; }
void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.tag == "enemy") { health otherScript = col.gameObject.GetComponent <health>(); otherScript.takeDamage(10); this.gameObject.SetActive(false); } }
private void OnCollisionEnter2D(Collision2D collision) { health healthComponent = collision.gameObject.GetComponent <health>(); if (healthComponent) { healthComponent.Damage(damage_); } }
void Start() { prePos1 = new Vector3(0, 25, -43); prePos2 = new Vector3(-60, 25, -43); prePos3 = new Vector3(60, 25, -43); getHealth = new health(); getHealth = GameObject.FindGameObjectWithTag("Scripts").GetComponent <health>(); }
void attack(GameObject target) { //play animation attack(); //get targets health and do damage health currentTargetHealth = target.GetComponent <health>(); currentTargetHealth.doDamage(damage); }
void OnTriggerExit2D(Collider2D collision) { health vulnerable = collision.gameObject.GetComponent <health>(); if (vulnerable != null) { vulnerableObjectsInTriggerArea.Remove(vulnerable); } }
// Start is called before the first frame update private void Start() { _heart2 = transform.Find("heart_red"); _heart1 = transform.Find("heart_red"); _health = player.GetComponent <health>(); _playerHealth = player.GetComponent <health>(); maxPlayerHealth = _playerHealth.startHealth; }
private void OnTriggerEnter2D(Collider2D hitInfo) { health Health = hitInfo.GetComponent <health>(); if (Health != null) { Health.TakeDamage(); } }
//public double health; // Use this for initiaelization void Start() { player = GameObject.FindGameObjectWithTag("Player"); refer = GameObject.Find("HealthBar"); value = refer.GetComponent <health> (); right = GameObject.FindGameObjectWithTag("right"); left = GameObject.FindGameObjectWithTag("left"); feet = GameObject.FindGameObjectWithTag("feet"); }
void Awake() { moveScript = GetComponent<move>(); healthScript = GetComponent<health>(); }
// Use this for initialization void Start() { original = healthbar.transform.localScale; life = GameObject.FindGameObjectWithTag("Player").GetComponent<health>(); current = original; }
// Use this for initialization void Start() { sphere = GameObject.Find("HealthObject").gameObject; healthScript = sphere.GetComponent<health>(); }
void Start() { h = FindObjectOfType<health>(); mc = FindObjectOfType<MusicController>(); }
void Start() { agent = GetComponent<NavMeshAgent>(); if (agent != null) { nav = true; } h = FindObjectOfType<health>(); mc = FindObjectOfType<MusicController>(); }
void Start () { h = FindObjectOfType<health>(); }