Inheritance: NetworkBehaviour
 private void Awake()
 {
     enemyRef      = GetComponentInParent <Enemy_AI>();
     playerHPref   = target.GetComponentInParent <Player_Health>();
     playerRBref   = target.GetComponentInParent <Rigidbody>();
     playerMoveRef = target.GetComponent <Player_Movement>();
 }
Exemplo n.º 2
0
 void Awake()
 {
     player       = GameObject.FindGameObjectWithTag("Player").transform;
     playerHealth = player.GetComponent <Player_Health>();
     enemyHealth  = GetComponent <Enemy_Health>();
     nav          = GetComponent <NavMeshAgent>();
 }
Exemplo n.º 3
0
    public virtual void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.collider.tag == "Ground")
        {
            groundController.DestroyGround(destructionCircle);
            Explode();
            MakeSoundExplosion();
//			Destroy (this.gameObject);
//			Instantiate (boom);
//			boom.Play ();
        }
        else if (coll.collider.tag == "Tank" || coll.collider.tag == "Hitable")
        {
//			Destroy (gameObject);
            Explode();
            MakeSoundExplosion();
//			Instantiate (boom);
//			boom.Play ();

            //health.TakeDamage(20);
            if (coll.gameObject.GetComponent <Player_Health> () != null)
            {
                //					print ("folgender Tank wurde getroffen: " + coll.gameObject);
                p_health = coll.gameObject.GetComponent <Player_Health> ();
                p_health.SetHealth(10f);
            }
        }
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     healthScript = GetComponent<Player_Health>();
     healthScript.EventRespawn += EnablePlayer;
     crosshairs = GameObject.Find("Crosshairs").GetComponentsInChildren<Image>();
     SetRespawnButton();
 }
 private void Awake()
 {
     LosePanelGroup.alpha = 0.0f;
     playerHpRef          = Player.GetComponent <Player_Health>();
     playerMove           = Player.GetComponent <Player_Movement>();
     matchRef             = Player.GetComponent <LightMatchScript>();
 }
Exemplo n.º 6
0
    IEnumerator Shoot()
    {
        RaycastHit2D hitReg = Physics2D.Raycast(firepoint.position, firepoint.up);

        if (hitReg)
        {
            Player_Health health = hitReg.transform.GetComponent <Player_Health>();

            if (health != null)
            {
                health.TakeDamage(damage);
            }

            line.SetPosition(0, firepoint.position);
            line.SetPosition(1, hitReg.point);
        }

        else
        {
            line.SetPosition(0, firepoint.position);
            line.SetPosition(1, firepoint.position + firepoint.up * 100);
        }

        line.enabled = true;

        yield return(new WaitForSeconds(0.02f));

        line.enabled = false;
    }
Exemplo n.º 7
0
 private void Start()
 {
     healthScript = GetComponent <Player_Health>();
     animator     = GetComponent <Animator>();
     myNavAgent   = GetComponent <UnityEngine.AI.NavMeshAgent>();
     prevLocation = new Vector3(transform.position.x, transform.position.y, transform.position.z);
 }
Exemplo n.º 8
0
 void Awake()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <Player_Health>();
     enemyHealth  = GetComponent <Enemy_Health>();
     //anim = GetComponent<Animator>();
 }
    /// <summary>
    /// Use this for initialization
    /// </summary>
    protected void Start()
    {
        // Players rigidbody component
        _rb = GetComponent <Rigidbody>();

        // TODO: Make some sort of manager for the players UI components to make it more managable
        // Gets the player health component from the player
        _playerHealth = GameObject.Find("Health").GetComponent <Player_Health>();

        // Default player is not paused and is not jumping
        _paused    = false;
        _isJumping = false;
        _isDead    = false;

        // Gets the weapon abstract class from the weapon inventory class attached to the player
        foreach (Weapon_Abstract wep in _playerWeapons.WeaponsInHand)
        {
            if (!wep.WeaponInHand)
            {
                continue;
            }

            _primaryWeapon = wep;
        }

        children = GetComponentsInChildren <Transform>();

        //Set the player's body to the "Player" layer so that its own camera doesnt see it. Other cams can still see it becuase this info is never sent to the network
        _playerBody.layer = 8;

        // Lock the player's cursor to the middle of the screen
        Cursor.lockState = CursorLockMode.Locked;
    }
 void Start()
 {
     playerHealth = GameObject.FindObjectOfType<Player_Health>();
     //PsOne = GetComponent<ParticleSystem>();
     //PsTwo = GetComponent<ParticleSystem>();
     Debug.Log(PsOne);
     Debug.Log(PsTwo);
 }
Exemplo n.º 11
0
    float timer;                                // Timer for counting up to the next attack.


    void Awake()
    {
        // Setting up the references.
        player       = GameObject.FindGameObjectWithTag("Player");
        playerHealth = player.GetComponent <Player_Health>();
        //enemyHealth = GetComponent<EnemyHealth>();
        anim = player.GetComponent <Animator>();
    }
Exemplo n.º 12
0
    void Start()
    {
        _player_InputCheck = GameObject.FindObjectOfType <Player_InputCheck>();
        _player_Health     = GameObject.FindObjectOfType <Player_Health>();
        _enemyTracker      = GameObject.FindObjectOfType <EnemyTracker>();

        _animator = GetComponent <Animator>();
    }
Exemplo n.º 13
0
 void Awake()
 {
     // Set up the references.
     player       = GameObject.Find("Player").transform;
     playerHealth = player.GetComponent <Player_Health>();
     enemyHealth  = GetComponent <Enemy_Health>();
     nav          = GetComponent <NavMeshAgent>();
 }
Exemplo n.º 14
0
 void Start()
 {
     rBody      = GetComponent <Rigidbody2D>();
     animator   = GetComponent <Animator>();
     sRenderer  = GetComponent <SpriteRenderer>();
     health     = GetComponent <Player_Health>();
     tickSource = GetComponent <AudioSource>();
 }
Exemplo n.º 15
0
 void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         player = other.GetComponent("Player_Health") as Player_Health;
         player.DamagePlayer(10 * Time.deltaTime);
     }
 }
Exemplo n.º 16
0
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         player = other.GetComponent("Player_Health") as Player_Health;
         player.DamagePlayer(10);
     }
 }
Exemplo n.º 17
0
    /*
     *    public IEnumerator RespawnPlayer () {
     *            GetComponent<AudioSource>().Play ();
     *            yield return new WaitForSeconds (spawnDelay);
     *
     *            Instantiate (playerPrefab, spawnPoint.position, spawnPoint.rotation);
     *            GameObject clone = Instantiate (spawnPrefab, spawnPoint.position, spawnPoint.rotation) as GameObject;
     *            Destroy (clone, 3f);
     *    }
     */


    public static void KillPlayer(Player_Health player)
    {
        //Destroy(player child arm )
        dead = true;
        //Destroy (player.transform.GetChild(1).gameObject);
        player.transform.GetChild(0).gameObject.SetActive(false);
        //gm.StartCoroutine (gm.RespawnPlayer());
    }
Exemplo n.º 18
0
    // Use this for initialization
    void Start()
    {
        player       = GameObject.FindGameObjectWithTag("Player");
        playerHealth = player.GetComponent <Player_Health>();

        material       = this.transform.Find("GameObject").transform.Find("Body").gameObject.GetComponent <Renderer>().material;
        material.color = Color.green;
    }
Exemplo n.º 19
0
    private Image crossHairImage;       //照準のImage

    void Start()
    {
        //キャッシュしておく
        crossHairImage = GameObject.Find("Crosshair Image").GetComponent <Image>();
        healthScript   = GetComponent <Player_Health>();
        //Eventを登録
        healthScript.EventDie += DisablePlayer;
    }
Exemplo n.º 20
0
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Health>();
     if (player == null)
     {
         Debug.LogError("In HUD, no player health object found in player");
     }
 }
Exemplo n.º 21
0
 void Start()
 {
     _slowMovement  = GetComponent <SpeedBehaviour>();
     _rigidbody2D   = GetComponent <Rigidbody2D>();
     _keyInput      = GetComponent <InputBehaviour>();
     _player_Health = GetComponent <Player_Health>();
     _slowMovement.Coroutine();
 }
Exemplo n.º 22
0
 void Start()
 {
     if (SceneManager.GetActiveScene().name == "2DGAME")
     {
         health_script = Player.GetComponent <Player_Health>();
         ammo          = Player.GetComponent <Shooting>();
     }
 }
Exemplo n.º 23
0
    // Start is called before the first frame update
    void Start()
    {
        My_Player_Health = GetComponent <Player_Health>();
        Original_Color   = GetComponent <SpriteRenderer>().color;

        My_Shooting_Script = GetComponent <Shooting_Script>();

        My_Multiplayer_Checker = GetComponent <Multiplayer_Checker>();
    }
Exemplo n.º 24
0
 // Use this for initialization
 void Start()
 {
     time           = _timer;
     _damage        = GetComponentInParent <Enemy_Attack>().Damage;
     ai             = GetComponent <AI>();
     _animationtime = Animator.StringToHash("M_attack");// GetComponent<AnimatorStateInfo>().fullPathHash;
     player_layer   = 1 << LayerMask.NameToLayer("Player");
     _playerhealth  = GameObject.FindObjectOfType <Player_Health>();
 }
Exemplo n.º 25
0
 void Awake()
 {
     playerTag          = GetComponent <PlayerTag> ();
     movementScript     = GetComponent <Base_Player_Movement> ();
     weaponScript       = GetComponent <Base_WeaponManager> ();
     healthScript       = GetComponent <Player_Health> ();
     playerAnimator     = GetComponent <PlayerAnimator> ();
     playerEnemyHandler = GetComponent <PlayerEnemyHandler> ();
 }
Exemplo n.º 26
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            //ResetGame ();
        }
        UpdateText();
        if (gameMode == GAMEMODE.PVE)
        {
            CheckForExtraLife();
            for (int i = 0; i < 4; i++)
            {
                if (players [i] == null)
                {
                    continue;
                }
                Player_Health hs = players[i].GetComponent <Player_Health> ();
                if (hs.Health < saveFloat[i])
                {
                    doubleRate = false;
                    break;
                }
            }
        }

        if (gameMode == GAMEMODE.CP)
        {
            for (int i = 0; i < 4; i++)
            {
                if (players [i] == null)
                {
                    continue;
                }
                int t = players [i].GetComponent <PlayerTag> ().Team;

                if (cpScore [t] == 3)
                {
                    cpScore [t] = 4;
                    StartCoroutine(EndGame(t,
                                           true));
                }
            }
        }

        /*
         * int count = 0;
         * for (int i = 0; i < 4; i++) {
         *      if (players [i] == null)
         *              continue;
         *      if (playerLives [i].Lives == 0)
         *              count++;
         * }
         * if (count == players_total && cEndGame == null)
         *      cEndGame = StartCoroutine (EndGame ());
         */
    }
Exemplo n.º 27
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(Tags.player);
     playerHealth = player.GetComponent<Player_Health>();
     fader = player.GetComponentInChildren<Camera_UI>();
     spawnPosition = player.transform.position;
     spawnRotation = player.transform.rotation;
     if (introText)
         introText.text = "";
 }
Exemplo n.º 28
0
 void Awake()
 {
     NowCD     = 0;
     _player   = GameObject.FindWithTag("Player");
     _move     = _player.GetComponent <_PlayerMove>();
     _animator = _player.GetComponentInChildren <Animator>();
     _ability  = _player.GetComponentInChildren <Abilityvalue>();
     Damage_UI = FindObjectOfType <UI_Damage>();
     HPMP      = _player.GetComponent <Player_Health>();
 }
Exemplo n.º 29
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(Tags.player);
     playerViewport = GameObject.FindGameObjectWithTag(Tags.playerViewport).GetComponent<Camera>();
     playerHealth = player.GetComponent<Player_Health>();
     playerInput = player.GetComponent<Player_Input>();
     fader = player.GetComponentInChildren<Camera_UI>();
     spawnPosition = player.transform.position;
     spawnRotation = player.transform.rotation;
 }
    private void OnCollisionStay2D(Collision2D other)//При коллизии коллайдеров.
    {
        Player_Health player_Health = other.gameObject.GetComponent <Player_Health>();

        if (player_Health != null && _isDamage)
        {
            player_Health.ReduceHealth(damage);
            _isDamage = false;
        }
    }
Exemplo n.º 31
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Player_Health player = collision.GetComponent <Player_Health>();

        if (player != null)
        {
            player.health = player.maxHealth;
            player.TakeDamage(0, false);
            Destroy(gameObject);
        }
    }
Exemplo n.º 32
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision != null && hitActive == true)
     {
         if (collision.tag == "Player")
         {
             Player_Health.reduceHealth(swordDamage);
             Debug.Log("Player Health: " + Player_Health.health);
         }
     }
 }
Exemplo n.º 33
0
    // Use this for initialization
    void Start()
    {
        myAgent    = GetComponent <UnityEngine.AI.NavMeshAgent>();
        myAnimator = GetComponent <Animator>();
        myAgent.stoppingDistance = stoppingDistance;
        attackCooldown           = Time.time;

        playerhealth = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Health>();

        audioSource = GetComponent <AudioSource>();
        //GetComponent<Flashlight>().isActive = FL;
    }
Exemplo n.º 34
0
    // Use this for initialization
    void Start()
    {
        audioSync         = GetComponent <Audio_Sync>();
        playerPauseScirpt = GetComponent <Player_Pause>();
        //engineParent = transform.Find("Engines").gameObject;
        healthScript     = GetComponent <Player_Health>();
        variablesScript  = GetComponent <variables>();
        playerChatScript = GetComponent <Player_Chat>();
        playerIDScript   = GetComponent <Player_ID>();

        healthScript.EventDie += DisablePlayer;         //Subscribes it to the EventDie
    }
Exemplo n.º 35
0
 void Awake()
 {
     // Zuweisung der Variablen
     #region
     col = GetComponent<SphereCollider>();
     playerTracker = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<PlayerTracker>();
     player = GameObject.FindGameObjectWithTag(Tags.player);
     playerRigid = player.GetComponent<Rigidbody>();
     playerMovement = player.GetComponent<Player_Movement>();
     playerHealth = player.GetComponent<Player_Health>();
     npcAI = GetComponent<NPC_AI>();
     flashLight = GetComponentInChildren<NPC_Flashlight>();
     #endregion
     
     targetSightingPosition = playerTracker.resetPosition;
 }
Exemplo n.º 36
0
    void Awake()
    {
        #region Zuweisung der Variablen
        anim = GetComponent<Animator>();
        bulletTrail = GetComponentInChildren<LineRenderer>();
        flash = bulletTrail.gameObject;
        shotLight = flash.GetComponent<Light>();
        col = GetComponent<SphereCollider>();
        player = GameObject.FindGameObjectWithTag(Tags.player);
        playerHead = GameObject.FindGameObjectWithTag(Tags.playerHead);
        playerHealth = player.gameObject.GetComponent<Player_Health>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();
        
        target = Vector3.zero;
        scaledDamage = maxDamage - minDamage;
        #endregion

        bulletTrail.enabled = false;
        shotLight.intensity = 0f;
    }
Exemplo n.º 37
0
    void Awake()
    {
        // Zuweisung von Variablen
        #region
        npcSight = GetComponent<NPC_Sight>();
        nav = GetComponent<NavMeshAgent>();
        col = GetComponent<SphereCollider>();
        player = GameObject.FindGameObjectWithTag(Tags.player).transform;
        playerHealth = player.GetComponent<Player_Health>();
        playerMovement = player.GetComponent<Player_Movement>();
        audioAssets = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<AudioAssets>();
        alert = 0f;
        waitTimer = 0f;
        #endregion

        // Zuweisung der Delegaten
        #region
        PlayerTracker.Stepped += ReactToStep;
        PlayerTracker.Jumped += ReactToJump;
        PlayerTracker.ShotFired += ReactToShot;
        PlayerTracker.DoorMoved += ReactToDoorSound;
        #endregion
    }
Exemplo n.º 38
0
    GameObject Player; // Reference to the player GameObject.

    #endregion Fields

    #region Methods

    void Awake()
    {
        Player = GameObject.FindGameObjectWithTag ("Player");
        Health = Player.GetComponent <Player_Health> ();
    }
Exemplo n.º 39
0
 public override void PreStartClient() {
     healthScript = GetComponent<Player_Health>();
     healthScript.EventRespawn += EnablePlayer;
 }
Exemplo n.º 40
0
 void Start()
 {
     playerHealth = GameObject.FindObjectOfType<Player_Health>();
 }
Exemplo n.º 41
0
 // Use this for initialization
 void Start()
 {
     crosshairs = GameObject.Find("Crosshairs").GetComponentsInChildren<Image>();
     healthScript = GetComponent<Player_Health>();
     healthScript.EventDie += DisablePlayer;
 }
Exemplo n.º 42
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(Tags.player);
     playerHealth = player.GetComponent<Player_Health>();
 }
 void Start()
 {
     GameObject player = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent<Player_Health>();
 }
Exemplo n.º 44
0
 public override void PreStartClient()
 {
     healthScript = GetComponent<Player_Health>();
     healthScript.EventDie += DisablePlayer;
 }