public void SetValues(RootCharacterController c,
	                      WeaponClass w,
	                      int n, int cN1, int cN2, int b, int e,
	                      SpFunctions s,
	                      clavisher cl, Vector3 p)
    {
        bTime = b; eTime = e; controller = c; weapon = w; numb = n; clavNumb1 = cN1; clavNumb2 = cN2;
        activity = weapon.moveset [numb];
        stats = controller.gameObject.GetComponent<Organism> ();
        sp = s;
        clav = cl;
        pos = new Vector3 (p.x, p.y, p.z);
    }
    public void SetValues(RootCharacterController c,
	                      WeaponClass w,
	                      int n, int b, int e, int cN,
	                      SpFunctions s,
	                      HitController h, 
	                      clavisher cl)
    {
        bTime = b; eTime = e; controller = c; weapon = w; numb = n; claveNumb = cN;
        activity = weapon.moveset [numb];
        stats = controller.gameObject.GetComponent<Stats> ();
        sp = s;
        hitBox = h;
        clav = cl;
        time = 0;
    }
    public void SetValues(RootCharacterController c,
	                      WeaponClass w,
	                      int n, int b, int cN,
	                      SpFunctions s,
	                      clavisher cl)
    {
        bTime = b; controller = c; weapon = w; numb = n; claveNumb = cN;
        activity = weapon.moveset [numb];
        stats = controller.gameObject.GetComponent<Organism> ();
        stats.shield = this;
        sp = s;
        clav = cl;
        time = 0;
        rigid = controller.gameObject.GetComponent<Rigidbody2D>();
        animNumb = 0;
    }
    //тип 6 номер 6
    public void Shieldcontroller(ShieldController sh, 
	                              RootCharacterController c,
	                              WeaponClass w,
	                              int n, int b,int cN,
	                              SpFunctions s,
	                              clavisher cl)
    {
        if (sh.stage == 0)
            sh.SetValues (c, w, n, b, cN, s, cl);
        sh.Work ();
    }
    //тип 6 номер 3
    public void Holdandunleash(HoldAndUnleash hld, 
	                             RootCharacterController c,
	                             WeaponClass w,
	                             int n, int b, int e, int cN,
	                             SpFunctions s,
	                             HitController h,
	                           clavisher cl)
    {
        if (hld.stage == 0)
            hld.SetValues (c, w, n, b, e,cN, s, h, cl);
        hld.Work ();
    }
    //тип 6 номер 4
    public void Aimingshoot(AimingShoot a, 
	                        RootCharacterController c,
	                        WeaponClass w,
	                        int n, int cN1, int cN2, int b, int e,
	                        SpFunctions s,
	                        clavisher cl, Vector3 p)
    {
        if (a.stage == 0)
            a.SetValues (c,w,n,cN1,cN2,b,e,s,cl,p);
        a.Work ();
    }
    public bool ClaveComparation(ClaveNoteClass1.CLV kk, clavisher jj)
    {
        int j;
        for (int i=0; i<4; i++)
                        k [i] = true;
        for (int i=0; i<kk.clv.Length;i++)
        {
            j=0;
            k[i]=false;
            while ((j<kk.clv[i].but.Length)&&(kk.clv[i].but[j].push!=jj.buttons[kk.clv[i].but[j].timer].push))
                j++;

            if (j<kk.clv[i].but.Length) k[i]=true;
        }
        return k[0]&&k[1]&&k[2]&&k[3];
    }
 public int ChemByZanyatsya(ActivityClass.activites[] activities, Stats stats, int e, clavisher clav)
 {
     int j,i,h,k,jj;
     bool weapon;
     bool change=false;
     h = 0;
     while ((e!=stats.stats.employment)||(change))
     {
         change=false;
         e=stats.stats.employment;
         j=-1;
         for (i=activities.Length-1; i>=0; i--)
         {
             k=0;
             if (activities[i].hasOwnActivities)
             {
                 if ((activities[i].weapon!=null))
                     k=ChemByZanyatsya(activities[i].weapon.moveset, stats, 12, clav);
                 if (k==1)
                 {
                     h=k;
                     break;
                 }
             }
             else if (ClaveComparation(activities[i].why.claves,clav))
                 if (FComparation(Mathf.Abs(stats.gameObject.rigidbody2D.velocity.x),activities[i].why.speedX*1f)&&
                     FComparation(Mathf.Abs(stats.gameObject.rigidbody2D.velocity.y),activities[i].why.speedY*1f)&&
                     IntComparation(stats.direction+2, activities[i].why.direction)&&
                     IntComparation(stats.stats.groundness,activities[i].why.groundness)&&
                     IntComparation(stats.stats.obstacleness,activities[i].why.obstacleness)&&
                     IntComparation(stats.stats.groundness,activities[i].why.groundness)&&
                     ComprFunctionality(stats.stats.maxInteraction,activities[i].why.maxinteraction)&&
                     ComprFunctionality(stats.stats.interaction,activities[i].why.interaction)&&
                     IntComparation(stats.stats.upness,activities[i].why.upness)&&
                     IntComparation(stats.stats.specialness,activities[i].why.specialness))
             {
                 if (activities[i].weapon==null)
                     weapon=true;
                 else
                     weapon=ComprFunctionality(activities[i].weapon.ready,activities[i].why.weaponReady);
                 if (weapon)
                 {
                     if (i+1<activities.Length)
                     {
                    		if ((activities[i+1].change)&&(activities[i].why.employment<=stats.stats.employment+activities[i+1].why.employment))
                         {
                             change=true;
                             j=i;
                             break;
                         }
                         else if ((activities[i].why.employment<=stats.stats.employment)&&
                    	 		(!activities[i].chosen))
                         {
                             j=i;
                             break;
                         }
                     }
                     if ((activities[i].why.employment<=stats.stats.employment)&&
                    	 (!activities[i].chosen))
                     {
                         j=i;
                         break;
                     }
                 }
             }
         }
         if ((change)&&(j>=0))
         {
             for (jj=0;jj<stats.gameObject.GetComponent<RootCharacterController>().whatToEmploy.Count;jj++)
                 if (stats.gameObject.GetComponent<RootCharacterController>().whatToEmploy[jj].name.Equals(activities[j+1].name))
                             break;
             if (jj<stats.gameObject.GetComponent<RootCharacterController>().whatToEmploy.Count)
             {
                 stats.gameObject.GetComponent<RootCharacterController>().whatToEmploy.Remove(stats.gameObject.GetComponent<RootCharacterController>().whatToEmploy[jj]);
                 activities[j+1].chosen=false;
                 activities[j+1].change=false;
                 stats.stats.employment+=activities[j+1].employ;
             }
         }
         if (j>=0)
         {
             stats.gameObject.GetComponent<RootCharacterController>().whatToEmploy.Add (activities[j]);
             activities[j].timer=activities[j].timeOfAction;
             stats.stats.employment-=activities[j].employ;
             if (activities[j].soWhat.groundness>=0) stats.stats.groundness=activities[j].soWhat.groundness;
             if (activities[j].soWhat.obstacleness>=0) stats.stats.obstacleness=activities[j].soWhat.obstacleness;
             if (activities[j].soWhat.interaction>=0)stats.stats.interaction=activities[j].soWhat.interaction;
             if (activities[j].soWhat.upness>0)stats.stats.upness=activities[j].soWhat.upness-1;
             if (activities[j].soWhat.specialness>=0)stats.stats.specialness=activities[j].soWhat.specialness;
             activities[j].chosen=true;
             h=1;
         }
     }
     return h;
 }
    void Awake()
    {
        actNumb = 0;

        rigid = gameObject.GetComponent<Rigidbody2D> ();
        stats = gameObject.GetComponent<Stats> ();
        animator = GetComponent<CharacterAnimator> ();
        actions = gameObject.GetComponent<Actions> ();
        infoGets = gameObject.GetComponent<InfoGets> ();
        clav = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<clavisher> ();
        Sp=GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
        equip = gameObject.GetComponent<Equipment> ();
    }