public int DeleteActivity(OrgActivityClass.activities[] activities, int del, int numb)
 {
     for (int i=del+1;i<numb;i++)
         activities[i-1]=activities[i];
     numb--;
     return numb;
 }
 public int AddActivity(OrgActivityClass.activities[] activities, OrgActivityClass.activities activity, int numb)
 {
     activities [numb] = activity;
     numb++;
     return numb;
 }
    public int ChemByZanyatsya(OrgActivityClass.activities[] activities, Organism stats)
    {
        int j, i;
        j = activities.Length-1;
        while (j>=0)
        {
            for (i=j; i>=0; i--)
            {
                j=-1;
                if ((ComprFunctionality(stats.health,activities[i].why.health))&&
                    (ComprFunctionality(stats.stats.hitted,activities[i].why.hitted))&&
                    (!activities[i].chosen))
                {
                    j=i;
                    break;
                }
            }
            if (j>=0)
            {
                stats.gameObject.GetComponent<DestroyableObjectController>().activityNumb=AddActivity(stats.gameObject.GetComponent<DestroyableObjectController>().whatToEmploy,
                                                                                                  activities[j],
                                                                                                  stats.gameObject.GetComponent<DestroyableObjectController>().activityNumb);

                activities[j].chosen=true;
            }
        }
        return 1;
    }