예제 #1
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.CompareTag("Destroyable"))
     {                   // Объект, в который врезались, уничтожаемый?
         Mortal HP = collision.gameObject.GetComponent <Mortal>();
         HP.lowerHP((int)(attackPower * attackFactor));
     }
     if (!collision.gameObject.CompareTag("Spell"))
     {
         Object.Destroy(gameObject);
     }
 }
예제 #2
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject.name != "WaterSplash(Clone)")
     {
         if (collision.gameObject.CompareTag("Destroyable"))
         {   // Объект, в который врезались, уничтожаемый?
             Mortal HP = collision.gameObject.GetComponent <Mortal>();
             HP.lowerHP(attackPower);
         }
         else
         {
             Object.Destroy(gameObject);
         }
     }
 }
예제 #3
0
    void FixedUpdate()
    {
        rb.AddForce(transform.forward * 1.5f);

        Collider[] intersectObjs = Physics.OverlapSphere(transform.position, 0.25f);
        if (intersectObjs.Length != 0)
        {
            if (intersectObjs [0].CompareTag("Destroyable"))                // Объект, в который врезались, уничтожаемый?
            {
                Mortal HP = intersectObjs[0].GetComponent <Mortal>();
                HP.lowerHP(attackPower);
            }
            Object.Destroy(gameObject);
        }
    }
예제 #4
0
 void OnTriggerEnter(Collider collision)
 {
     if (collision.gameObject == owner)          // TODO
     {
         isghost       = false;
         rend.material = activatedPhantasmMaterial;
     }
     else if (isghost)
     {
     }
     else if (collision.gameObject.CompareTag("Destroyable"))
     {         // Объект, в который врезались, уничтожаемый?
         Mortal HP = collision.GetComponent <Mortal>();
         HP.lowerHP((int)(attackFactor * attackPower));
     }
     else if (collision.gameObject.tag != "Spell")
     {
         Object.Destroy(gameObject);
     }
 }
예제 #5
0
 public void Update()
 {
     victim.lowerHP(1);
 }