상속: MonoBehaviour
    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;
    }
예제 #2
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");
        }
    }
예제 #3
0
    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);
        }
    }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     enemigoControlador = GetComponent <CharacterController> ();
     salud         = GetComponent <health>();
     moveVector    = Vector3.zero;
     _componenteIA = GetComponentInChildren <AIRig> ();
 }
예제 #5
0
    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);
        }
    }
예제 #6
0
 void Awake()
 {
     myHealth         = GetComponent <health>();
     myPlayerShoot    = GetComponent <player_shoot>();
     myPlayerMovement = GetComponent <player_movement>();
     myAnimator       = GetComponent <Animator>();
 }
예제 #7
0
    // 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);
        }
    }
예제 #8
0
 void OnCollisionEnter(Collision other)
 {
     hitEntity = other.gameObject;
     entityHealth = hitEntity.GetComponent<health>();
     entityHealth.healthPoints -= 25;
     PhotonNetwork.Destroy(myPv);
 }
예제 #9
0
 public void healtbarSet()
 {
     playerHealth       = GameObject.FindGameObjectWithTag("Player").GetComponent <health>();
     healthBar          = GetComponent <Slider>();
     healthBar.maxValue = playerHealth.maxHealth;
     healthBar.value    = playerHealth.maxHealth;
 }
예제 #10
0
 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();
         }
     }
 }
예제 #11
0
 void Start()
 {
     getHealthScript = new health();
     getHealthScript = GameObject.FindGameObjectWithTag("Scripts").GetComponent <health>();
     shieldScript    = new activeShield();
     shieldScript    = GameObject.FindGameObjectWithTag("Scripts").GetComponent <activeShield>();
 }
예제 #12
0
 // Use this for initialization
 void Start()
 {
     Camara = GameObject.FindGameObjectWithTag("MainCamera");
     personajeController = GetComponent <CharacterController> ();
     animacion           = GetComponent <Animator> ();
     salud         = GetComponent <health>();
     _targetScript = GetComponent <TargetSystem> ();
 }
예제 #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            health health = db.healths.Find(id);

            db.healths.Remove(health);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #14
0
 // 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);
 }
예제 #15
0
 // 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;
 }
예제 #16
0
 void Awake()
 {
     GameMasterGo = GameObject.Find("GameMaster");
     target       = GameMasterGo.GetComponent <GameObject_handler>().getPlayer();
     bulletGo     = GameMasterGo.GetComponent <GameObject_handler>().bulletPrefab;
     myHealth     = GetComponent <health>();
     myAttributes = GetComponent <attributes>();
 }
예제 #17
0
 public void Start()
 {
     figter        = GetComponent <Fighter>();
     hp            = GetComponent <health>();
     player        = GameObject.FindWithTag("Player");
     guardPosition = transform.position;
     Movement      = GetComponent <mover>();
 }
예제 #18
0
 void Awake()
 {
     GameMasterGo = GameObject.Find("GameMaster");
     myBody       = GetComponent <Rigidbody2D>();
     GameSettings = GameMasterGo.GetComponent <game_settings>();
     myHealth     = GetComponent <health>();
     myAttributes = GetComponent <attributes>();
 }
예제 #19
0
 void Awake()
 {
     mySpriteRenderer = GetComponent <SpriteRenderer>();
     myAnimator       = GetComponent <Animator>();
     myPlayerShoot    = GetComponent <player_shoot>();
     myPlayerHealth   = GetComponent <health>();
     GameMaster       = GameObject.Find("GameMaster");
 }
예제 #20
0
 // 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;
 }
예제 #21
0
 // Use this for initialization
 void Start()
 {
     hscr = gameObject.GetComponent <health>();
     mscr = GameObject.Find("Working").GetComponent <Money>();
     if (!isTower)
     {
         escr = gameObject.GetComponent <EnemyStats>();
     }
 }
예제 #22
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "lava")
     {
         player.transform.position = spawnPoint.position;
         health eH = (health)target.GetComponent("health");
         eH.AddjustCurentHealth(-10);
     }
 }
예제 #23
0
 void Awake()
 {
     myPlayerMovement = GetComponent <player_movement>();
     myHealth         = GetComponent <health>();
     myAnimator       = GetComponent <Animator>();
     GameMaster       = GameObject.Find("GameMaster");
     fireRateTimer    = 0f;
     grenadeTimer     = 0f;
 }
예제 #24
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "enemy")
     {
         health otherScript = col.gameObject.GetComponent <health>();
         otherScript.takeDamage(10);
         this.gameObject.SetActive(false);
     }
 }
예제 #25
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        health healthComponent = collision.gameObject.GetComponent <health>();

        if (healthComponent)
        {
            healthComponent.Damage(damage_);
        }
    }
예제 #26
0
    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>();
    }
예제 #27
0
    void attack(GameObject target)
    {
        //play animation
        attack();
        //get targets health and do damage
        health currentTargetHealth = target.GetComponent <health>();

        currentTargetHealth.doDamage(damage);
    }
예제 #28
0
    void OnTriggerExit2D(Collider2D collision)
    {
        health vulnerable = collision.gameObject.GetComponent <health>();

        if (vulnerable != null)
        {
            vulnerableObjectsInTriggerArea.Remove(vulnerable);
        }
    }
예제 #29
0
        // 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;
        }
예제 #30
0
    private void OnTriggerEnter2D(Collider2D hitInfo)
    {
        health Health = hitInfo.GetComponent <health>();

        if (Health != null)
        {
            Health.TakeDamage();
        }
    }
예제 #31
0
 //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");
 }
예제 #32
0
 void Awake()
 {
     moveScript = GetComponent<move>();
     healthScript = GetComponent<health>();
 }
예제 #33
0
파일: hp.cs 프로젝트: rbrt/heritagequest
 // Use this for initialization
 void Start()
 {
     original = healthbar.transform.localScale;
     life = GameObject.FindGameObjectWithTag("Player").GetComponent<health>();
     current = original;
 }
예제 #34
0
파일: movement.cs 프로젝트: mdobson2/Lab-12
 // Use this for initialization
 void Start()
 {
     sphere = GameObject.Find("HealthObject").gameObject;
     healthScript = sphere.GetComponent<health>();
 }
예제 #35
0
파일: AirEnemyAI.cs 프로젝트: das10c/Ritual
 void Start()
 {
     h = FindObjectOfType<health>();
     mc = FindObjectOfType<MusicController>();
 }
예제 #36
0
 void Start()
 {
     agent = GetComponent<NavMeshAgent>();
     if (agent != null)
     {
         nav = true;
     }
     h = FindObjectOfType<health>();
     mc = FindObjectOfType<MusicController>();
 }
예제 #37
0
	void Start ()
    {
        h = FindObjectOfType<health>();
	}