Inheritance: MonoBehaviour
 public void connectToScript(Character target)
 {
     //		Debug.Log(target.CharacterName);
     belongsTo = target;
     playerHealthScript = target.CharacterGameObject.GetComponentInChildren<PlayerHealth>();
     playerHealthScript.setConnection(target.HealthController);
 }
 public void Awake()
 {
     //Initialize components
     nav = GetComponent<NavMeshAgent>();
     player = GameObject.FindWithTag("Player").transform;
     playerHealth = player.GetComponent<PlayerHealth>();
 }
 // Use this for initialization
 void Awake()
 {
     Player = GameObject.FindGameObjectWithTag("Player").transform;
     playerHealth = Player.GetComponent<PlayerHealth>();
     enemyHealth = GetComponent<EnemyHealth>();
     nav = GetComponent<NavMeshAgent>();
 }
Example #4
0
    //private bool destroyed = false;

    void Start(){
        soundManager = gameObject.GetComponentInChildren<SoundManager>();

        energy = maxEnergy;
        score = FindObjectOfType(typeof(ScoreKeeper)) as ScoreKeeper;

        playerControl = gameObject.GetComponentInChildren<PlayerControl>();
        playerGUI = gameObject.GetComponentInChildren<PlayerGUI>();
        playerHealth = gameObject.GetComponentInChildren<PlayerHealth>();
        thrust = gameObject.GetComponentInChildren<Thrust>();
        
        shield = gameObject.AddComponent<Shield>() as Shield;
        shield.PDelegate = this;


        foreach(Weapon weapon in gameObject.GetComponentsInChildren(typeof(IWeapon))){
            if(weapon.gameObject.name == "Left weapon"){
                leftWeapon = weapon;
                leftWeapon.soundManager = soundManager;
            }else if(weapon.gameObject.name == "Right weapon"){
                rightWeapon = weapon;
                rightWeapon.soundManager = soundManager;
            }
        }
        StartCoroutine("RegenerateEnergy");
    }
	float timer;                                // Timer for counting up to the next attack.
	
	
	void Awake ()
	{
		// Setting up the references.
		player = GameObject.FindGameObjectWithTag ("Player");
		playerHealth = player.GetComponent <PlayerHealth> ();
		enemyHealth = GetComponent<EnemyHealth>();
	}
Example #6
0
    // Use this for initialization
    void Start()
    {
        target = GameObject.FindWithTag("Player");
        targetHealth = target.GetComponent<PlayerHealth>();

        attack = gameObject.GetComponent<CreagAttackStandard> ();
    }
Example #7
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player").transform;
     playerHealth = player.GetComponent<PlayerHealth>();
     nerdHealth = GetComponent<NerdsHealth>();
     nav = GetComponent<NavMeshAgent>();
 }
Example #8
0
 void Start()
 {
     audio = GetComponent<AudioSource>();
     player = PlayerHealth.instance;
     collider = GetComponentInChildren<SphereCollider>();
     anim = GetComponentInChildren<Animator>();
 }
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     playerHealth = player.GetComponent <PlayerHealth> ();
     //enemyHealth = GetComponent<EnemyHealth>();
     anim = GetComponent <Animator> ();
 }
	// Use this for initialization
	void Start () {
		player = GameObject.Find ("Player");
		EnemyHealth = GetComponent<EnemyHealth>();
		currentHealth = EnemyHealth.currentHealth;
		PlayerHealth = player.GetComponent<PlayerHealth> ();

	}
Example #11
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent<PlayerHealth>();
     nerdsHealth = GetComponent<NerdsHealth>();
     nerd = GameObject.FindGameObjectWithTag("Nerd");
 }
Example #12
0
 // Use this for initialization
 void Awake()
 {
     spawnenemy = GameObject.Find("boss3spawn");
     Boss3Move.lebosspeutbouger = false;
     player = GameObject.FindGameObjectWithTag("Player");
     boss = GameObject.Find("CaveWorm");
     baril_pos_1 = GameObject.Find("baril_pos_1");
     baril_pos_2 = GameObject.Find("baril_pos_2");
     baril_pos_3 = GameObject.Find("baril_pos_3");
     baril_pos_4 = GameObject.Find("baril_pos_4");
     laser1 = GameObject.Find("laser1");
     laser2 = GameObject.Find("laser2");
     laser3 = GameObject.Find("laser3");
     laser4 = GameObject.Find("laser4");
     baril_fin = GameObject.Find("baril_fin");
     baril_start = GameObject.Find("baril_start");
     baril_start_h = GameObject.Find("baril_start_h");
     baril_pos_1_h = GameObject.Find("baril_pos_1_h");
     baril_pos_2_h = GameObject.Find("baril_pos_2_h");
     baril_pos_3_h = GameObject.Find("baril_pos_3_h");
     scriptdupersonnage = GameObject.FindGameObjectWithTag("Player").GetComponent<ScriptPersonnage>();
     enemyhealthSliderObjectGameObject = GameObject.FindGameObjectWithTag("BossHealthSlider3");
     playerHealth = player.GetComponent<PlayerHealth>();
     enemyHealth = GetComponent<EnemyHealth>();
     enemyHealthSlider = enemyhealthSliderObjectGameObject.GetComponent<Slider>(); // --
     enemyHealthSlider.maxValue = enemyHealth.startingHealth; // --
 }
    // Use this for initialization
    void Start()
    {
        target = GameObject.FindWithTag("Player");
        targetHealth = target.GetComponent<PlayerHealth>();

        attackLeap = gameObject.GetComponent<PseudoSpiderAttackLeap> ();
    }
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player").transform;  //finds the player in the scene
     playerHealth = player.GetComponent <PlayerHealth> ();
     enemyHealth = GetComponent <EnemyHealth> ();
     nav = GetComponent <NavMeshAgent> ();
 }
 void Awake()
 {
     playerMovement = GetComponent<PlayerMovement>();
     playerHealth = GetComponent<PlayerHealth>();
     anim = GetComponent<Animator>();
     p2Health = GameObject.Find("Player02").GetComponent<Player2Health>();
 }
Example #16
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").transform;

        playerhealth = player.GetComponent<PlayerHealth>();
        image = GameObject.FindGameObjectWithTag("HealthReal").GetComponent<Image>();
    }
Example #17
0
    IEnumerator Attackpeudevie()
    {
        Anim.Play("Attack_02");
        // Reset the timer.
        timer = 0f;
        jouelaniamtiondattaque = true;
        yield return new WaitForSeconds(0.6f);
        timer = 0f;
        // Première partie de l'anim
        if (playerHealth.currentHealth > 0&&enemyHealth.currentHealth>0)
        {
            // ... damage the player.
            playerHealth = target.GetComponent<PlayerHealth>();
            playerHealth.RpcTakeDamage(attackDamage/3);
        }
        yield return new WaitForSeconds(1.4f);
        timer = 0f;

        // Seconde partie de l'anim
        if (playerHealth.currentHealth > 0&&enemyHealth.currentHealth>0)
        {
            // ... damage the player.
            playerHealth = target.GetComponent<PlayerHealth>();
            playerHealth.RpcTakeDamage(attackDamage / 3);
        }
        jouelaniamtiondattaque = false;
    }
Example #18
0
 // Use this for initialization
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     playerHealth = player.GetComponent <PlayerHealth> ();
     GameObject feedbackObject = GameObject.FindGameObjectWithTag("Feedback");
     feedback = feedbackObject.GetComponent<Text>();
 }
    private ScoreManager _scoreManager; //object of type: "ScoreManager"

    #endregion Fields

    #region Methods

    void Awake()
    {
        //component references
        _player = GameObject.FindGameObjectWithTag ("Player");
        _playerHealth = _player.GetComponent <PlayerHealth> ();//script reference
        _anim = GetComponent<Animator> ();
    }
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player"); //find the player in the scene, used during awake so it only has to be called once
     playerHealth = player.GetComponent <PlayerHealth> (); //stores a reference to the PlayerHealth script
     enemyHealth = GetComponent<EnemyHealth>();
     anim = GetComponent <Animator> ();
 }
Example #21
0
 void Update()
 {
     if (GameObject.Find("GameController").GetComponent<IsGameStarted>().GameStart == true && player != null
         && enemyHealth.currentHealth > 0 && playerHealth.currentHealth > 0 && Time.time > nextFire)
     {
         if (player.transform.position.z > -30)
         {
             float dis = Vector3.Distance(transform.position, player.transform.position);
             if (dis <= 15f)
             {
                 nextFire = Time.time + fireRate;
                 Instantiate(shot, ShotSpawn.position, ShotSpawn.rotation);
             }
         }
         else if(player.transform.position.z <= -30)
         {
             nav.enabled = false;
             ani.SetBool("isIdle", true);
         }
     }
     else
     {
         if(GetComponent<EnemyMovement>().curPlayer != null)
         {
             player = GetComponent<EnemyMovement>().curPlayer;
         }
         if (player != null) playerHealth = player.GetComponent<PlayerHealth>();
     }
 }
 // Use this for initialization
 void Start()
 {
     CurrentHealth = StartingHealth;
     PlayerRef = GameObject.FindGameObjectWithTag("Player");
     OxyScriptRef = PlayerRef.GetComponent<PlayerOxygen>();
     HealthScriptRef = PlayerRef.GetComponent<PlayerHealth>();
 }
Example #23
0
    void FindClosestPlayer()
    {
        players = GameObject.FindGameObjectsWithTag("Player");

        if (transform == null)
        {
            return;
        }

        float minRange = float.MaxValue;
        foreach (var p in players)
        {
            var tmpPlayerHealth = p.GetComponent<PlayerHealth>();
            if (tmpPlayerHealth.currentHealth <= 0) continue;

            var dist = Vector3.Distance(p.transform.position, transform.position);
            if (dist < minRange)
            {
                minRange = dist;
                playerTransform = p.transform;
            }
        }
        if (playerTransform != null)
        {
            playerHealth = playerTransform.GetComponent<PlayerHealth>();
            anim.SetBool("IsMoving", true);
        }
        else
        {
            anim.SetBool("IsMoving", false);
        }
    }
Example #24
0
	///onEnable looks for inputs for camera and button
	void OnEnable(){
		enemy = GameObject.Find("Enemy").GetComponent<PlayerHealth> ();
		playerInput = GameObject.Find ("Main Camera").GetComponent<PlayerInput>();
		trapAudio = GetComponent <AudioSource> ();
		StartCoroutine("TrapActivate");

	}
	// Use this for initialization
	void Start () {
        wanted_mode = CursorLockMode.Locked;
		targetDirection = transform.localRotation.eulerAngles;
		controller = GetComponent<CharacterController>();
        health = GetComponent<PlayerHealth>();
        Go_To_Spawn();
	}
Example #26
0
 public void Awake()
 {
     //Initialize components
     player = GameObject.FindWithTag("Player");
     playerHealth = player.GetComponent<PlayerHealth>();
     rend = GameObject.FindWithTag("RendPlayer").GetComponent<Renderer>();
 }
Example #27
0
	void Awake()
	{
		player = GameObject.FindGameObjectWithTag ("Player");
		anim = GetComponent <Animator> ();
		playerhealth = player.GetComponent<PlayerHealth> ();
		nav = GetComponent<NavMeshAgent> ();
	}
Example #28
0
 // Use this for initialization
 void Start()
 {
     //characterControl = this.GetComponent<CharacterControl>();
     lungGUI = GameObject.Find("LungsFill").GetComponent<Image>();     //Is there a better way to get link to GUI object?
     playerHealth = this.GetComponent<PlayerHealth>();
     air = lungCapacity;
 }
 // private PseudoSpiderAttack theAttack;
 // Use this for initialization
 void Start()
 {
     theAnimation = GetComponent<Animation> ();
     target = GameObject.FindWithTag("Player");
     targetHealth = target.GetComponent<PlayerHealth>();
     theAcidAttack = GetComponentInChildren<ParticleSystem>();
 }
Example #30
0
	void Awake ()
	{
		player = GameObject.Find("Police");												//Find the police GameObject
		playerHealth = player.GetComponent <PlayerHealth> (); 							//get the PlayerHealth Script 
		enemyHealth = GetComponent <EnemyHealth>();										//Get EnemyHealth Script
	
	}
Example #31
0
 void Start()
 {
     Invoke("Spawn", sTime);
     playerHealth = player.GetComponent <PlayerHealth>();
 }
 private void Construct(PlayerHealth playerHealth)
 {
     _playerHealth = playerHealth;
 }
Example #33
0
    //private DestroyMod destroyMod;

    // Start is called before the first frame update
    void Start()
    {
        coreDestroyed = false;
        pHealth       = transform.root.GetComponent <PlayerHealth>();
    }
Example #34
0
 // Start is called before the first frame update
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent <PlayerHealth>();
     manager      = GameObject.FindGameObjectWithTag("CheckpointManager").GetComponent <CheckpointManager>();
 }
 void Start()
 {
     playerHealth = GetComponent <PlayerHealth>();
     controller   = GetComponent <CharacterController>();
     destRotation = transform.rotation;
 }
Example #36
0
 void Awake()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     healthPlayer = player.gameObject.GetComponent <PlayerHealth>();
 }
Example #37
0
    /////////////////
    /// Main Loop ///
    /////////////////

    void Start()
    {
        playerHealth = FindObjectOfType <PlayerHealth>();
    }
Example #38
0
    public void ability(int charInd)
    {
        index = charInd;
        if (charInd == 0)
        {
            if (duration != 0)
            {
                duration = 0;
            }

            if (cd <= 0)
            {
                PlayerHealth health = gameObject.GetComponent <PlayerHealth>();
                if (health.Health != health.maxHealth)
                {
                    animator.SetBool("Ability", true);
                    changeTime(20f, 9f);
                    index = charInd;
                    gameObject.GetComponent <PlayerHealth>().Def *= 0.2f;
                    gameObject.GetComponent <PlayerHealth>().Regen(15, 1.5f, duration, false);
                }
            }
        }
        else if (charInd == 1 && cd <= 0)
        {
            Instantiate(bookSound);
            if (charging)
            {
                bookExplode(damage);
                charging       = false;
                unableMove     = false;
                chargeDuration = 0;
            }
            changeTime(15f, 1.5f);
            charging = true;
        }
        else if (charInd == 2 && cd <= 0)
        {
            if (isRole)
            {
                isRole = false;
                animator.SetBool("Ability", false);
                changeStat(1f, 1.6f, 0.6f, true);
                gameObject.GetComponent <Weapon>().atkEnable = true;
                weapon.SetActive(true);
                duration = 0;
            }
            else
            {
                isRole = true;
                animator.SetBool("Ability", true);
                gameObject.GetComponent <Weapon>().atkEnable = false;
                weapon.SetActive(false);
                changeTime(15f, 7f);
                changeStat(1f, 1.6f, 0.6f, false);
            }
        }
        else if (charInd == 3 && cd <= 0)
        {
            poison.isPoisoned = true;
            changeTime(15f, 5f);
        }
        else if (charInd == 4 && cd <= 0)
        {
            changeTime(15f, 5f);
            unableMove = true;
            StartCoroutine("iceAbility");
            unableMove = false;
        }
        else if (charInd == 5 && cd <= 0)
        {
            changeTime(15f, 5f);
            changeStat(1.4f, 1.6f, 1.4f, false);
        }
        else if (charInd == 6 && cd <= 0)
        {
            changeTime(15f, 6f);
            poison.isChaos = true;
        }
        else if (charInd == 7 && cd <= 0)
        {
            GameObject sd = Instantiate(stando);
            sd.GetComponent <stando>().setIndex(GetComponent <PlayerController>().playerIndex);
            changeTime(15f, 7f);
        }
        else if (charInd == 8 && cd <= 0)
        {
            changeTime(15f, 3f);
            changeStat(1f, 1f, 0.01f, false);
        }
        else if (charInd == 9 && cd <= 0)
        {
            poison.bleed = true;
            changeTime(15f, 8f);
        }
        else if (charInd == 10 && cd <= 0)
        {
            changeTime(15f, 5f);
            changeStat(1.3f, 1.3f, 1f, false);
            gameObject.GetComponent <PlayerHealth>().Regen(30, 0f, 0f, true);
        }
        else if (charInd == 11 && cd <= 0)
        {
            changeTime(15f, 0f);
        }

        if (cdBar.maxSlider == 100f)
        {
            cdBar.SetMax(cd);
        }
    }
Example #39
0
 private void Awake()
 {
     instance = this; // this helps reference the global variable for singleton
 }
Example #40
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.Find("Player").GetComponent <PlayerHealth>();
 }
Example #41
0
 private void Awake()
 {
     healthScript = GameObject.Find("Player").GetComponent <PlayerHealth>();
 }
Example #42
0
 // Use this for initialization
 void Start()
 {
     health           = GetComponentInParent <PlayerHealth>();
     playerController = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>();
 }
Example #43
0
 void Start()
 {
     target = FindObjectOfType <PlayerHealth>();
 }
Example #44
0
 void Start()
 {
     healthBar.value = 100;
     playerHP        = GameObject.FindObjectOfType <PlayerHealth>();
 }
Example #45
0
    //僵尸攻击状态处理函数
    void UpdateAttackState()
    {
        //如果僵尸附近没有玩家,返回游荡状态
        targetPlayer = zombieSoundSensor.getNearestPlayer();
        if (targetPlayer == null)
        {
            curState = FSMState.Wander;
            agent.ResetPath();
            animator.SetBool("isAttack", false);
            return;
        }
        //如果僵尸距离敌人大于攻击距离,返回追踪状态
        if (Vector3.Distance(targetPlayer.position, zombieTransform.position) > attackRange)
        {
            curState = FSMState.Track;
            agent.ResetPath();
            animator.SetBool("isAttack", false);
            return;
        }

        PlayerHealth ph = targetPlayer.GetComponent <PlayerHealth> ();

        if (ph != null)
        {
            //计算僵尸的正前方和玩家的夹角,只有玩家在僵尸前方才能攻击
            Vector3 dir    = targetPlayer.position - zombieTransform.position;
            float   degree = Vector3.Angle(dir, zombieTransform.forward);

            if (degree < attackFieldOfView / 2 && degree > -attackFieldOfView / 2)
            {
                animator.SetBool("isAttack", true);
                if (attackTime > attackInterval)
                {
                    attackTime = 0;
                    ph.TakeDamage(attackDamage, null);
                    photonView.RPC("PlayZombieAttackAudio", PhotonTargets.All);
                }
                attackTime += Time.deltaTime;
            }
            else
            {
                animator.SetBool("isAttack", false);
                //否则,需要僵尸转身
                zombieTransform.LookAt(targetPlayer);
            }
        }

        //攻击状态下的敌人应当不断追踪玩家
        agent.SetDestination(targetPlayer.position);

        Vector3 targetVelocity = Vector3.zero;

        if (agent.desiredVelocity.magnitude > trackingSpeed)
        {
            targetVelocity = agent.desiredVelocity.normalized * trackingSpeed;
        }
        else
        {
            targetVelocity = agent.desiredVelocity;
        }
        agent.velocity = targetVelocity;
        currentSpeed   = targetVelocity.magnitude;
        animator.SetFloat("Speed", currentSpeed);

        //僵尸进入狂暴状态,使用PRC函数设置所有客户端该僵尸的外观
        if (zombieRender != null && zombieRender.isCrazy == false)
        {
            photonView.RPC("ZombieSetCrazy", PhotonTargets.All);
        }
    }
Example #46
0
    // Update is called once per frame
    void Update()
    {
        enemyObjects = GameObject.FindGameObjectsWithTag("Player2");

        if (enemyObjects.Length != 0)
        {
            GameObject        constVar = GameObject.FindGameObjectWithTag("Constant");
            StoredInformation stored   = constVar.GetComponent <StoredInformation>();
            counter = stored.EnemyBattlePosition;

            EnemyAttack  enAttack;
            GameObject[] obj = GameObject.FindGameObjectsWithTag("Enemy2");
            enAttack = obj[counter].GetComponent <EnemyAttack>();

            enemyObjects = GameObject.FindGameObjectsWithTag("Player2");


            fighterNumber = Random.Range(0, enemyObjects.Length);
            EnemyTarget   = enemyObjects[fighterNumber];
            if (EnemyTarget == null)
            {
                EnemyTarget = enemyObjects[fighterNumber + 1];
            }
            if (myTransform == null)
            {
                myTransform = transform;
            }

            EnemyTimeSimulation enemTimeScript = obj[counter].GetComponent <EnemyTimeSimulation>();
            if (enemTimeScript.timeToAttack1 > 99)
            {
                this.attempt = true;

                if (attempt)
                {
                    Quaternion rot;

                    rot = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(EnemyTarget.transform.position - myTransform.position), 6 * Time.deltaTime);
                    myTransform.rotation  = rot;
                    myTransform           = GameObject.FindGameObjectWithTag("Enemy2").transform;
                    myTransform.position += new Vector3(myTransform.forward.x * 6 * Time.deltaTime,
                                                        0,
                                                        myTransform.forward.z * 6 * Time.deltaTime);
                    if (obj[0].name == "CaveWorm(Clone)")
                    {
                        animation.Play("Walk");
                    }
                    else
                    {
                        animation.Play("walk");
                    }
                }

                if ((Vector3.Distance(myTransform.position, EnemyTarget.transform.position) < 1) && (attempt != false))
                {
                    initialiseParticles = new GameObject();
                    EnemyTarget         = enemyObjects[fighterNumber];
                    Transform enemyTransform = EnemyTarget.transform;
                    if (obj[0].name == "CaveWorm(Clone)")
                    {
                        animation.Play("Attack");
                    }

                    if (obj[0].name == "Monster2Prefab(Clone)")
                    {
                        animation.Play("bitchslap");
                    }

                    if (obj[0].name == "spider(Clone)")
                    {
                        animation.Play("attack1");
                    }

                    PlayerHealth attackEnemy = EnemyTarget.GetComponent <PlayerHealth>();

                    attackType = Random.Range(0, 5);
                    if (attackType == 1)
                    {
                        attackEnemy.AdjustCurrentHealth((int)(stored._attackValue[0] / stored._defenceValue[0]), fighterNumber);
                    }
                    if (attackType == 2)
                    {
                        attackEnemy.AdjustCurrentHealth((int)(stored._attackValue[1] / stored._defenceValue[1]), fighterNumber);
                        initialiseParticles      = Instantiate(particles[0], EnemyTarget.transform.position, Quaternion.identity) as GameObject;
                        initialiseParticles.name = "Fire";
                    }
                    if (attackType == 3)
                    {
                        attackEnemy.AdjustCurrentHealth((int)(stored._attackValue[2] / stored._defenceValue[1]), fighterNumber);
                        initialiseParticles      = Instantiate(particles[1], EnemyTarget.transform.position, Quaternion.identity) as GameObject;
                        initialiseParticles.name = "Ice";
                    }
                    if (attackType == 4)
                    {
                        attackEnemy.AdjustCurrentHealth((int)(stored._attackValue[3] / stored._defenceValue[1]), fighterNumber);
                        initialiseParticles      = Instantiate(particles[2], EnemyTarget.transform.position, Quaternion.identity) as GameObject;
                        initialiseParticles.name = "Lightning";
                    }
                    if (Vector3.Distance(myTransform.position, EnemyTarget.transform.position) <= 1)
                    {
                        this.attempt = false;
                    }
                    if (enAttack.attempt == false)
                    {
                        GameObject[] atemptingChange = GameObject.FindGameObjectsWithTag("EnemyBattle");
                        obj[counter].transform.position = atemptingChange[counter].transform.position;
                        enemTimeScript.timeToAttack1    = 0;
                        this.attempt = false;
                        enemTimeScript.timeToAttack = 0;
                        if (obj[0].name == "CaveWorm(Clone)")
                        {
                            animation.Play("Idle");
                        }
                        if ((obj[0].name == "spider(Clone)") || (obj[0].name == "Monster2Prefab(Clone)"))
                        {
                            animation.Play("idle");
                        }
                    }
                }
            }
        }
    }
Example #47
0
 void Awake()
 {
     playerHealth = GetComponent <PlayerHealth>();
 }
Example #48
0
    private PlayerHealth playerHealth;                          // Reference to the PlayerHealth script.


    void Awake()
    {
        // Setting up the reference.
        playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>();
    }
Example #49
0
 void Start()
 {
     health_player = player.GetComponent <PlayerHealth>();
     //audioSource = GetComponent<AudioSource>();
     takeDamage = false;
 }
Example #50
0
 // Start is called before the first frame update
 void Start()
 {
     playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>();
 }
    // Update is called once per frame
    void Update()
    {
        PlayerHealth playerHealth = GameObject.Find(PlayerInfo.PLAYER_AVATAR_ID).GetComponent <PlayerHealth> ();

        gameObject.GetComponent <Text> ().text = "Health: " + playerHealth.GetHealthValue();
    }
Example #52
0
 // Start is called before the first frame update
 void Start()
 {
     playerHealth = FindObjectOfType <PlayerHealth>();
     text         = GetComponent <Text>();
 }
Example #53
0
 void Start()
 {
     playerHealth = GetComponent <PlayerHealth>();
     controller   = GetComponent <CharacterController>();
 }
Example #54
0
    // Use this for initialization
    void Start()
    {
        target = GameObject.FindGameObjectWithTag("Player").transform;

        playerHealth = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerHealth>();
    }
    void Start()
    {
        startTime = Time.time;

        rb              = GetComponent <Rigidbody>();
        jumps           = 1;
        playerJumps     = 0;
        camera_position = new Vector3(0, 0, 0);
        scenename1      = "LevelOne - Haig";
        scenename4      = "5.17.19-9.13.pm-AddingTimer";
        finishedscene   = "FinishScreen";
        anim            = gameObject.GetComponentInChildren <Animator>();

        //John Trying This
        playerHealth = GetComponent <PlayerHealth>();
        levelSelect  = GetComponent <LevelSelect>();
        //playerJumps = GetComponent<JumpManager>();
        //done

        halfSpin    = new Vector3(0, 180, 0); //value to turn by
        orientation = false;                  //for evaluating turning left and right

        circleAngleDegree = 0;
        circleAngleRadian = 0;
        circleX           = 0;
        circleZ           = 0;

        player_position    = new Vector3(44f, 18.25f, 0f);
        transform.position = player_position;
        updatePosition     = player_position;
        //print("player position = " + player_position.ToString() + "\n");
        //print("transform position = " + transform.position.ToString() + "\n");
        //print("Update position = " + updatePosition.ToString() + "\n");

        wallOnLeft  = false;
        wallOnRight = false;
        goingLeft   = false;
        goingRight  = false;

        //WallJump time
        wallJumpEndPos   = new Vector3(0, 0, 0);
        wallJumpStartPos = new Vector3(0, 0, 0);

        jumped         = false;
        doubleBackLeft = false;
        wasFlyingRight = false;
        inAirInactive  = false;

        jumpedStraight = false;
        jumpedRight    = false;
        jumpedLeft     = false;

        justWallJumped    = false;
        wallJumpDelay     = 0f;
        wallJumpContDelay = false;

        jumpAudio = GetComponent <AudioSource>();
        //Ensure the toggle is set to true for the music to play at start-up
        playJumpAudio = false;


        //jetpackTrail = Instantiate(jetpackTrailPrefab).GetComponent<ParticleSystem>();
        //jetpackTrail.gameObject.SetActive(false);

        //Grounded Float
        //distToGround = playerCollider.bounds.extents.y;


        //orientation = new Vector3 (0f, 180f, 0f);

        //playerCollider = gameObject.FindGameObjectWithTag("Player").GetComponent<Collider2D>();
        //groundCollider = gameObject.FindGameObjectWithTag("Ground").GetComponent<Collider2D>();
        //SetCountText();
        //winText.text = "";
    }
Example #56
0
 private void Awake()
 {
     player      = GetComponentInParent <PlayerHealth>();
     Revivetimer = 5.0f;
 }
Example #57
0
 void Awake()
 {
     S     = this;
     mrend = GetComponent <MeshRenderer>();
 }
Example #58
0
 private void Start()
 {
     pc = PlayerController.CurrentPlayer.GetComponent <PlayerController>();
     ph = PlayerController.CurrentPlayer.GetComponent <PlayerHealth>();
 }
Example #59
0
    private PlayerHealth playerHealth; // reference to player health script

    // Use this for initialization
    void Start()
    {
        player       = GameManager.instance.Player;          //instantiate player
        playerHealth = player.GetComponent <PlayerHealth>(); // get player health script
        GameManager.instance.RegisterPowerUp();
    }
Example #60
0
 void OnPlayerTakenDamage(PlayerHealth playerHealth, int previousHealth, int currentHealth)
 {
     StartCoroutine(ShakeAnimation());
 }