コード例 #1
0
    public void TakeDamage(int amount)
    {
        if (isDead)
        {
            return;
        }

        PlayerPaw currentPaw = cat_paw_main.GetComponent <PlayerPaw> ();

        if (currentPaw.is_main)
        {
            //Get Particle System for onHit
            //GameObject vacuumParticle = GameObject.Find ("RobotHitParticle");
            pSystem = GetComponent <ParticleSystem> ();
            pSystem.Play();
        }



        currentHealth -= amount;
        if (gameObject.name != "security_cam")
        {
            enemyAIScript.currentHealth = enemyAIScript.currentHealth - 1;
        }
        //Debug.Log ("Robot takes " + amount + " damage. HP left: " + currentHealth);

//		if(currentHealth <= 0)
//		{
//			Debug.Log("Robot Dead");
//			Die ();
//		}
    }
コード例 #2
0
    public void TakeDamage(int amount)
    {
        if (isDead)
        {
            return;
        }
        //Audio source
        //vacAudio.Play ();

        PlayerPaw currentPaw = cat_paw_main.GetComponent <PlayerPaw> ();

        if (currentPaw.is_main)
        {
            //Get Particle System for onHit
            GameObject vacuumParticle = GameObject.Find("VacuumHitParticle");
            pSystem = vacuumParticle.GetComponent <ParticleSystem> ();
            pSystem.Play();
        }



        currentHealth -= amount;
        Debug.Log("Vacuum takes " + amount + " damage. HP left: " + currentHealth);

        if (currentHealth <= 0)
        {
            Debug.Log("Vacuum Dead");
            Die();
        }
    }
コード例 #3
0
	// Use this for initialization
	void Start () {
		changeTimer = changeTimerDelay;
		shootingTimer = shootingTimeDelay;
		impacts = new GameObject[maxImpacts];
		for(int i = 0; i < maxImpacts; i++)
		{
			impacts[i] = (GameObject)Instantiate(impactPrefab);
		}

		anim = GetComponentInChildren<Animator> ();

		enemy = GameObject.FindGameObjectWithTag ("Enemy");
		//Change later to encompase all enemies
		vacHealth = enemy.GetComponent <VacuumHealth> ();

		//Set this for robot
		EnemyRobot = GameObject.FindGameObjectWithTag ("Robot");
		RobotHealth = EnemyRobot.GetComponent<EnemyHealth> ();

		//Set this for Helicopter
		EnemyHelicopter = GameObject.FindGameObjectWithTag ("Helicopter");
		HelicopterHealth = EnemyHelicopter.GetComponent<EnemyHealth> ();

		//Set this for Security camera
		EnemySecurityCamera = GameObject.FindGameObjectWithTag ("SecurityCamera");
		SecurityCameraHealth = EnemySecurityCamera.GetComponent<EnemyHealth> ();

		ammo = ammoAmount;
		changeToMain = false;

		playerpaw = GetComponent<PlayerPaw> ();

		//ToastAmmoText = GameObject.FindGameObjectWithTag ("ToastAmmoText");
		ToastAmmoText.enabled = false;

	}
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     anim           = GetComponent <Animator> ();
     paw            = GameObject.Find("Main Camera").GetComponent <PlayerPaw> ();
     shootingScript = GameObject.Find("Main Camera").GetComponent <PlayerShooting> ();
 }