subLife() public method

public subLife ( float life ) : void
life float
return void
    void OnParticleCollision(GameObject obj)
    {
        Hero hero = obj.GetComponent <Hero>();

        if (hero)
        {
            hero.subLife(_dpt);
        }
    }
Example #2
0
 void OnCollisionEnter(Collision col)
 {
     if (col.collider)
     {
         Hero hero = col.gameObject.GetComponent <Hero> ();
         if (null != hero)
         {
             Logger.Log("BigBadGuy::OnCollisionEnter hit hero", Logger.Level.INFO);
             hero.subLife(_dpt);
         }
     }
 }
Example #3
0
    /*!
     * \brief This function is called as Update in Monobehaviour.
     * \details This function is called in the Phenotype class in the Update function
     * This function should be implemented and all the graphical action has to be implemented in it.
     * \sa Phenotype
     */
    public override void UpdatePhenotype()
    {
        //the molecule considered toxic is the "AMPI" molecule
        if (_mol == null)
        {
            initMoleculePhenotype();
            if (_mol == null)
            {
                Logger.Log("_mol == null", Logger.Level.INFO);
                return;
            }
        }
        float intensity = _K0 * (Mathf.Exp(_mol.getConcentration() / _cc0) - 1);

        hero.subLife(intensity);
    }