Inheritance: MonoBehaviour
Ejemplo n.º 1
0
	// Use this for initialization
	void Start () {
		health = limitHealth;
		deathTime = 0f;
		SetHealthText();

		boss = GameObject.FindGameObjectWithTag ("boss");

		bossHealth = boss.GetComponent<BossHealth> ();
	}
Ejemplo n.º 2
0
 void Awake()
 {
     isKuollut = Animator.StringToHash("IsKuollut");
     playerAudio = GetComponent<AudioSource>();
     // Set up the references.
     anim = GetComponent<Animator>();
     //player = GameObject.FindGameObjectWithTag("Player").transform;
     //enemyMovement = GetComponent<EnemyMovement>();
     playerHealth = player.GetComponent<PlayerHealth>();
     bossHealth = GetComponent<BossHealth>();
     nav = GetComponent<NavMeshAgent>();
     BossPos = Boss.transform;
 }
Ejemplo n.º 3
0
	void OnTriggerEnter(Collider other) {
		if (mHealth.health > 0) {
			if (other.tag == "monster") {
				monsterHealth = other.gameObject.GetComponent<MonsterHealth> (); 
				monsterHealth.TakeDamage (30);
			}

			if (other.tag == "boss") {
				bossHealth = other.gameObject.GetComponent<BossHealth> (); 
				bossHealth.TakeDamage (30);
			}
		}

		//Destroy(other.gameObject);
	}
Ejemplo n.º 4
0
 void Start()
 {
     activate = GetComponent<TentacleActivate>();
     health = GetComponent<BossHealth>();
     delayTimer = 0;
     attackDelay = Random.Range(attackDelayMin, attackDelayMax);
     if(!underPlayer && !frontPlayer)
     {
         off = true;
     }
     else
     {
         off = false;
     }
 }
Ejemplo n.º 5
0
	void Awake ()
	{
		m_position = GetComponent <Rigidbody> ();
		nav = GetComponent <NavMeshAgent> ();
		anim = GetComponent<Animation> ();
		mHealth = GetComponent<BossHealth> ();

		player = GameObject.FindGameObjectWithTag ("Player");

		playerHealth = player.GetComponent<PlayerHealth> ();

		OriPosition = m_position.position;

		goHome = true;
	}
Ejemplo n.º 6
0
 void Awake()
 {
     // Setting up the references.
     Lyopelaaja = Animator.StringToHash("LyoPelaaja");
     isAggro = Animator.StringToHash("isAggro");
     nav = GetComponent<NavMeshAgent>();
     // player = GameObject.FindGameObjectWithTag("Player");
     playerHealth = player.GetComponent<PlayerHealth>();
     bossHealth = GetComponent<BossHealth>();
     anim = GetComponent<Animator>();
     //  playerPos = GameObject.FindGameObjectWithTag("Player").transform;
     playerPos = player.transform;
     enemyPos = enemy.transform;
     agroedOnce = false;
     playerAudio = GetComponent<AudioSource>();
 }
Ejemplo n.º 7
0
	// Use this for initialization
	void Start () {
		mHealth = gameObject.GetComponentInParent<BossHealth> (); 
	}
Ejemplo n.º 8
0
        /*
         * The dodge sequence, this combines all animations, health checks and damage counters.
         *  Param Nothing
         *  Returns Nothing.
         */
        private async void MagicBtn(object sender, EventArgs e)
        {
            if (MagicAbility.IsEnabled != true)
            {
                DisableorEnableFrameLayouts(false, ItemAbility);

                if (!ItemAbility.IsEnabled && !ANNOUNCING && battlesequence)
                {
                    DisableorEnableFrameLayouts(true, MagicAbility);
                    MagicAbility.Opacity = 0;
                    await MagicAbility.FadeTo(1, 200);

                    if (!MagicPage)
                    {
                        MagicPage           = true;
                        ButtonFire.Clicked += async(s, a) =>
                        {
                            if (CheckMana(CharacterMP, 15))
                            {
                                Random rand = new Random();
                                CharacterMP -= 15;
                                MagicDamage  = rand.Next(15, 30 + 1);
                                message      = "Casted Fireball";
                                await MagicAbility.FadeTo(0, 200);

                                DisableorEnableFrameLayouts(false, MagicAbility);
                            }
                            else
                            {
                                DisplayAlert("Error", "Not enough mana", "Close");
                            }
                        };

                        ButtonLightning.Clicked += async(s, a) =>
                        {
                            if (CheckMana(CharacterMP, 30))
                            {
                                Random rand = new Random();
                                CharacterMP -= 30;
                                MagicDamage  = rand.Next(25, 45 + 1);
                                message      = "Casted Lightning";
                                await MagicAbility.FadeTo(0, 200);

                                DisableorEnableFrameLayouts(false, MagicAbility);
                            }
                            else
                            {
                                DisplayAlert("Error", "Not enough mana", "Close");
                            }
                        };

                        ButtonVoid.Clicked += async(s, a) =>
                        {
                            if (CheckMana(CharacterMP, 50))
                            {
                                Random rand = new Random();
                                CharacterMP -= 50;
                                MagicDamage  = rand.Next(35, 55 + 1);
                                message      = "Casted Voidball";
                                await MagicAbility.FadeTo(0, 200);

                                DisableorEnableFrameLayouts(false, MagicAbility);
                            }
                            else
                            {
                                DisplayAlert("Error", "Not enough mana", "Close");
                            }
                        };
                    }


                    while (MagicDamage == 0)
                    {
                        await Task.Delay(25); if (!battlesequence)
                        {
                            return;
                        }
                        if (ItemAbility.IsEnabled)
                        {
                            return;
                        }
                    }
                    await Task.Delay(200);
                    await Announcer(message, true);
                    await Announcer(string.Format("Dealt {0} damage", MagicDamage.ToString()), true);

                    battlesequence = false;
                    BossHP        -= MagicDamage;

                    MagicDamage = 0;
                    message     = "";


                    CharacterMana.Text = CharacterMP.ToString();
                    CharacterMana.RelRotateTo(360, 500);
                    await AttackPixelCharacter();

                    BossHealth.RelRotateTo(360, 500);
                    await BossHealth.ScaleTo(5, 300);

                    await BossHealth.ScaleTo(1, 300);

                    if (BossHP <= 0)
                    {
                        WON = true; await CheckHP();
                    }
                    await Announcer("BOSS TURN", false);

                    BossAttack();
                }
            }
        }
Ejemplo n.º 9
0
    // Start is called before the first frame update
    void Start()
    {
        BossHealth bosshealth = GetComponent <BossHealth>();

        bosshealth.OnWinning += Bosshealth_OnWinning;
    }
Ejemplo n.º 10
0
 static void UnregisterInstance(BossHealth s)
 {
     Instancies.Remove(s);
 }
Ejemplo n.º 11
0
 //-------------- manager
 static void RegisterInstance(BossHealth s)
 {
     Instancies.Add(s);
 }
Ejemplo n.º 12
0
    void Shoot()
    {
        // Reset the timer.
        timer = 0f;

        // Play the gun shot audioclip.
        gunAudio.Play();

        // Enable the lights.
        gunLight.enabled  = true;
        faceLight.enabled = true;

        // Stop the particles from playing if they were, then start the particles.
        gunParticles.Stop();
        gunParticles.Play();

        // Enable the line renderer and set it's first position to be the end of the gun.
        gunLine.enabled = true;
        gunLine.SetPosition(0, transform.position);

        // Set the shootRay so that it starts at the end of the gun and points forward from the barrel.
        shootRay.origin    = transform.position;
        shootRay.direction = transform.forward;

        // Perform the raycast against gameobjects on the shootable layer and if it hits something...
        if (Physics.Raycast(shootRay, out shootHit, range, shootableMask))
        {
            // Try and find an EnemyHealth script on the gameobject hit.
            EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth>();

            // If the EnemyHealth component exist...
            if (enemyHealth != null)
            {
                // ... the enemy should take damage.
                enemyHealth.TakeDamage(damagePerShot, shootHit.point);
            }

            // Set the second position of the line renderer to the point the raycast hit.
            gunLine.SetPosition(1, shootHit.point);
        }
        // If the raycast didn't hit anything on the shootable layer...
        else
        {
            // ... set the second position of the line renderer to the fullest extent of the gun's range.
            gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);
        }

        // BOSS
        if (Physics.Raycast(shootRay, out shootHit, range, shootableMask))
        {
            // Try and find an EnemyHealth script on the gameobject hit.
            BossHealth bossHealth = shootHit.collider.GetComponent <BossHealth>();

            // If the EnemyHealth component exist...
            if (bossHealth != null)
            {
                // ... the enemy should take damage.
                bossHealth.TakeDamage(damagePerShot, shootHit.point);
            }

            // Set the second position of the line renderer to the point the raycast hit.
            gunLine.SetPosition(1, shootHit.point);
        }
        // If the raycast didn't hit anything on the shootable layer...
        else
        {
            // ... set the second position of the line renderer to the fullest extent of the gun's range.
            gunLine.SetPosition(1, shootRay.origin + shootRay.direction * range);
        }
    }
Ejemplo n.º 13
0
 void Start()
 {
     bossHealth = GameObject.FindGameObjectWithTag("Boss").GetComponent <BossHealth>();
 }