コード例 #1
0
    public void TakeDamage(float amount)
    {
        health -= amount;
        //if shot by player and has not noticed, make enemy angry and always chase player
        if (!hasNoticed)
        {
            attackRadius = Vector3.Distance(target.position, transform.position) * 1.15f;
            Debug.Log("Shot me in the back? Now I'm angry! Attack radius == " + attackRadius);
            //moveCloserRadius = attackRadius + 20f;
            //hasNoticed = true;
        }

        if (health <= 0f && !isDead)//if health is below zero and is not already dead
        {
            Debug.Log("I, " + gameObject.name + " am dead! Distributing bounty...");
            isDead = true;
            //target.IncreaseScore(10);
            //call level controller to increase score
            Level01Controller _lc1 = FindObjectOfType <Level01Controller>();
            _lc1.IncreaseScore(bounty);
            if (gameObject.name == "Enemy_BOOS")
            {
                _lc1.KillBoss();
            }
            //start death procedure
            StartCoroutine(Die());
        }
    }
コード例 #2
0
    private void OnTriggerEnter(Collider other)
    {
        Level01Controller level01Controller = new Level01Controller();
        PlayerMovement    playerMovement    = other.gameObject.GetComponent <PlayerMovement>();

        if (playerMovement != null)
        {
            level01Controller.TakeDamage(1);
        }
    }
コード例 #3
0
ファイル: Player.cs プロジェクト: ColtonH1/UpdatedFPSGameV1
 private void Die()
 {
     Impact.PlayOneShot(DeathSound);
     deathMenuUI.SetActive(true);
     reticle.SetActive(false);
     Level01Controller.SetCurrentTime(0f);
     Cursor.lockState = CursorLockMode.None;
     Cursor.visible   = true;
     playerIsDead     = true;
 }
コード例 #4
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Player")
     {
         PowerUpSound.Play();
         Level01Controller.SetCurrentTime(0.5f);
         Player.SetAlteredSpeed(speed * 2); //
         StartCoroutine("Destroy");
     }
 }
コード例 #5
0
    public void TakeDamage(float amount)
    {
        health -= amount;
        if (health <= 0f)
        {
            //Die();
            StartCoroutine(Die());

            Level01Controller _lc1 = FindObjectOfType <Level01Controller>();
            _lc1.IncreaseScore(destructionReward);
        }
        //explosionGO = Instantiate(explosionEffect, transform.position, transform.rotation);
        //Destroy(explosionGO, 15f);
    }
コード例 #6
0
 private void Awake()
 {
     IceCube.SetActive(false);
     EnableObject();
     ogScale              = IceCube.transform.localScale;
     ogPosition           = IceCube.transform.position;
     rb                   = Player.GetComponent <Rigidbody>();
     PLC_translater       = GameObject.Find("FPSCharacter");
     PLC                  = PLC_translater.GetComponent <PlayerController>();
     LV_Translater        = GameObject.Find("LevelController");
     LV                   = LV_Translater.GetComponent <Level01Controller>();
     HitCircle_Translater = GameObject.Find("HitCircle");
     HitCircle            = HitCircle_Translater.GetComponent <Text>();
     SpottedSymbol.SetActive(false);
 }
コード例 #7
0
    IEnumerator Destroy()
    {
        GetComponent <Collider>().enabled = false;
        if (!(GetComponent <MeshRenderer>() == null))
        {
            GetComponent <MeshRenderer>().enabled = false;
        }
        else
        {
            Renderer[] rs = GetComponentsInChildren <Renderer>();
            foreach (Renderer r in rs)
            {
                r.enabled = false;
            }
        }
        yield return(new WaitForSeconds(10f));

        Level01Controller.SetCurrentTime(1f);
        Player.SetAlteredSpeed(speed); //
        gameObject.SetActive(false);
    }
コード例 #8
0
 public void Awake()
 {
     levelController = GameObject.Find("LevelController");
     scoreController = levelController.GetComponent <Level01Controller>();
 }
コード例 #9
0
 private void Awake()
 {
     controller = FindObjectOfType <Level01Controller>();
 }
コード例 #10
0
ファイル: PauseMenu.cs プロジェクト: ColtonH1/FPSUnity
    public void QuitButton()
    {
        Level01Controller level01Controller = new Level01Controller();

        level01Controller.ExitLevel();
    }
コード例 #11
0
 private void Awake()
 {
     // insanely illegal method because i don't feel like working with events LOL
     levelController      = FindObjectOfType <Level01Controller>();
     colliderToDeactivate = gameObject.GetComponent <Collider>();
 }
コード例 #12
0
 private void Awake()
 {
     _audioSource         = GetComponent <AudioSource>();
     _lc                  = FindObjectOfType <Level01Controller>();
     _currentPlayerHealth = _totalPlayerHealth;
 }
コード例 #13
0
 // Start is called before the first frame update
 public void Spawn()
 {
     levelController = FindObjectOfType <Level01Controller>();
 }