//тип 0 номер 1
 public bool Overlaper(InfoGets infogets, int numb,SpFunctions sp)
 {
     return Physics2D.OverlapCircle (sp.VectorConvert (infogets.infoGets [numb].OBJ [0].transform.position),
                                    infogets.infoGets [numb].PRM2 [0],
                                    infogets.infoGets [numb].LYR);
     k1++;
 }
 public void Awake()
 {
     partsNumb = 0;
     interp = GetComponent<AnimationInterpretator> ();
     sp = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
     sManager=GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SoundManager> ();
 }
 //тип 0 номер 2
 public bool Raycaster(InfoGets infogets, int numb, Vector2 vect, SpFunctions sp)
 {
     return Physics2D.Raycast(sp.VectorConvert(infogets.infoGets[numb].OBJ[0].transform.position),
                              vect.normalized,
                              infogets.infoGets[numb].PRM2[0],
                              infogets.infoGets[numb].LYR);
 }
 public void Awake()
 {
     rigid = gameObject.GetComponent<Rigidbody2D>();
     sp = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
     col=GetComponentInChildren<CollisionRegulation>();
     hitControl = GetComponentInChildren<HitController> ();
 }
 public void Awake()
 {
     kk = false;
     if (gameObject.GetComponent<CharacterAnimator> () != null)
         anim = gameObject.GetComponent<CharacterAnimator> ();
     else
         anim = null;
     sp = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
 }
 public void AddWeapon(Equipment equip, int numb, bool right, int wActNumb, SpFunctions sp)
 {
     int i,j;
     int cLen = equip.bag [numb].GetComponent<ItemClass>().coordinates.Length/3;
     CharacterAnimator anim = equip.gameObject.GetComponent<CharacterAnimator> ();
     ItemClass item = equip.bag [numb].GetComponent<ItemClass> ();
     GameObject weapon;
     weapon = Instantiate (right == true ? item.objects [0] : item.objects [1],
                           new Vector3 (equip.gameObject.transform.position.x + item.coordinates [0]*equip.gameObject.transform.lossyScale.x,
                  equip.gameObject.transform.position.y + item.coordinates [1]*equip.gameObject.transform.lossyScale.y,
                  equip.gameObject.transform.position.z + item.coordinates [2]),
                           equip.gameObject.transform.rotation)as GameObject;
     weapon.transform.localScale=new Vector3(weapon.transform.localScale.x*sp.realSign(equip.gameObject.transform.localScale.x),
                                             weapon.transform.localScale.y,
                                             weapon.transform.localScale.z);
     weapon.transform.SetParent (equip.gameObject.transform);
     sp.SetMoveset(equip.gameObject,weapon.GetComponent<WeaponClass>());
     j = 0;
     while (j<item.parametres1.Length) {
         if (item.parametres1 [j] != 0)
             break;
         anim.allParts [item.parametres2 [j]].parts.Add (weapon.GetComponent<PartConroller> ());
         j++;
     }
     for (i=2; i<equip.bag[numb].GetComponent<ItemClass>().objects.Length; i++) {
         listOfObjects.Add (GameObject.Instantiate (item.objects [i],
                                                    new Vector3 (equip.gameObject.transform.position.x + item.coordinates [i * cLen]*equip.gameObject.transform.lossyScale.x,
                      equip.gameObject.transform.position.y + item.coordinates [i * cLen + 1]*equip.gameObject.transform.lossyScale.y,
                      equip.gameObject.transform.position.z + item.coordinates [i * cLen + 2]),
                                                    equip.gameObject.transform.rotation)as GameObject);
         listOfObjects [i-2].transform.localScale=new Vector3(listOfObjects [i-2].transform.localScale.x*sp.realSign(equip.gameObject.transform.localScale.x),
                                                              listOfObjects [i-2].transform.localScale.y,
                                                              listOfObjects [i-2].transform.localScale.z);
         listOfObjects [i-2].transform.SetParent (equip.gameObject.transform);
         listOfObjects[i-2].GetComponent<PartConroller>().right=(right==true? 1: -1);
         while (j<item.parametres1.Length) {
             if (item.parametres1 [j] != i)
                 break;
             anim.allParts [item.parametres2 [j]].parts.Add (listOfObjects [i-2].GetComponent<PartConroller> ());
             j++;
         }
     }
     equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon = weapon.GetComponent<WeaponClass> ();
     equip.gameObject.GetComponent<Actions> ().activities [wActNumb].actMode = numb;
     if (weapon.GetComponent<WeaponClass> ().handEmployment == 2)
     {
         equip.gameObject.GetComponent<Actions> ().activities [wActNumb-1].weapon = weapon.GetComponent<WeaponClass> ();
         equip.gameObject.GetComponent<Actions> ().activities [wActNumb-1].actMode = numb;
         equip.leftWeapon=weapon.GetComponent<WeaponClass>();
     }
     if (right)
         equip.rightWeapon=weapon.GetComponent<WeaponClass>();
     else
         equip.leftWeapon=weapon.GetComponent<WeaponClass>();
     listOfObjects.Clear ();
 }
    public void SetValues(RootCharacterController c,
	                      WeaponClass w,
	                      int n, int b, int e,
	                      SpFunctions s,
	                      HitController h)
    {
        bTime = b; eTime = e; controller = c; weapon = w; numb = n;
        activity = weapon.moveset [numb];
        stats = controller.gameObject.GetComponent<Stats> ();
        sp = s;
        hitBox = h;
    }
    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 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;
    }
    public void Awake()
    {
        sp = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
        for (int i=0;i<mod.Length;i++)
        {
            if (mod[i]=="rope")
                MakeARope();
            if (mod[i]=="stair")
                MakeAStair();
            if (mod[i]=="up")
                CoverSurface(1,1);
            if (mod[i]=="down")
                CoverSurface(1,-1);
            if (mod[i]=="right")
                CoverSurface(2,1);
            if (mod[i]=="left")
                CoverSurface(2,-1);

        }
    }
    //тип 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 номер 5
    public void Punchuntiltarget(PunchUntilTarget p, 
	                             RootCharacterController c,
	                             WeaponClass w,
	                             int n, int b, int e,
	                             SpFunctions s,
	                             HitController h)
    {
        if (p.stage == 0)
            p.SetValues (c, w, n, b, e, s, h);
        p.Work ();
    }
 //тип 1 номер 7
 public void MoveToClimb(Rigidbody2D rigid, Stats stats, InfoGets inf, int numb, SpFunctions sp)
 {
     RaycastHit2D hit;
     rigid.velocity = new Vector2 (0f, 0f);
     rigid.gravityScale = 0;
     int koof2;
     if (rigid.velocity.y>=0)
         koof2=1;
     else
         koof2=-1;
     bool k = Physics2D.Raycast (inf.infoGets [numb].OBJ [0].transform.position,
                                 new Vector2(inf.infoGets [numb].VCT [0].x*sp.realSign(stats.direction),
                                             inf.infoGets [numb].VCT [0].y*koof2).normalized,
                           inf.infoGets [numb].PRM2 [0],
                           inf.infoGets [numb].LYR);
     hit=Physics2D.Raycast (inf.infoGets [numb].OBJ [0].transform.position,
                            new Vector2(inf.infoGets [numb].VCT [0].x*sp.realSign(stats.direction),
                                        inf.infoGets [numb].VCT [0].y*koof2).normalized,
                            inf.infoGets [numb].PRM2 [0],
                            inf.infoGets [numb].LYR);
     float koof = -1*sp.realSign (hit.normal.x);
     if (k)
     {
             rigid.velocity=new Vector2(0f,0f);
             float length = hit.distance;
             Vector2 vect = inf.infoGets [numb].VCT [0].normalized;
             vect = new Vector2 (vect.x *koof* length, vect.y *koof2* length);
             rigid.gameObject.transform.position = new Vector3 (rigid.gameObject.transform.position.x + vect.x,
                                                                rigid.gameObject.transform.position.y + vect.y,
                                                                rigid.gameObject.transform.position.z);
     }
 }
    //тип 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 ();
    }
 //тип 1 номер 5
 public void Forcing(Rigidbody2D rigid, Vector2 fVect, SpFunctions sp)
 {
     //rigid.gravityScale = 1f;
     if ((fVect.x!=0) ||(fVect.y!=0))
     rigid.velocity = sp.Ortog(rigid.velocity, fVect);
     rigid.AddForce(fVect);
 }
 public void DeleteWeapon(Equipment equip, int numb, bool right, int wActNumb, SpFunctions sp, WeaponClass defWeapon)
 {
     int i,j;
     int cLen = equip.bag [numb].GetComponent<ItemClass>().coordinates.Length/3;
     CharacterAnimator anim = equip.gameObject.GetComponent<CharacterAnimator> ();
     ItemClass item = equip.bag [numb].GetComponent<ItemClass> ();
     GameObject weapon;
     weapon=null;
     j = 0;
     weapon=equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon.gameObject;
     while (j<item.parametres1.Length) {
         if (item.parametres1 [j] != 0)
             break;
         anim.allParts [item.parametres2 [j]].parts.Remove (weapon.GetComponent<PartConroller> ());
         j++;
     }
     Destroy (weapon);
     for (i=2; i<item.objects.Length; i++)
     {
         obj=sp.FindPart(anim.allParts, item.objects[i].name);
         s=item.objects[i].name;
         listOfObjects.Add (obj);
         while (j<item.parametres1.Length) {
             if (item.parametres1 [j] != i)
                 break;
             anim.allParts [item.parametres2 [j]].parts.Remove (listOfObjects [i-2].GetComponent<PartConroller> ());
             j++;
         }
     }
     for (i=listOfObjects.Count-1;i>=0;i--)
     {
         Destroy(listOfObjects[i]);
         listOfObjects.RemoveAt(i);
     }
     equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon = defWeapon;
     if (weapon.GetComponent<WeaponClass> ().handEmployment == 2)
     {
         equip.gameObject.GetComponent<Actions> ().activities [right==true? wActNumb-1:wActNumb+1].weapon = (right==true? equip.defLeftWeapon: equip.defRightWeapon).GetComponent<WeaponClass>();
         equip.gameObject.GetComponent<Actions> ().activities [right==true? wActNumb-1:wActNumb+1].actMode = 0;
         equip.leftWeapon=equip.defLeftWeapon.GetComponent<WeaponClass>();
     }
     if (right)
         equip.rightWeapon=defWeapon;
     else
         equip.leftWeapon=defWeapon;
     equip.gameObject.GetComponent<Actions> ().activities [wActNumb].actMode = 0;
 }
    //тип 5 номер 0
    public void ChangeWeapon(Equipment equip, int numb, bool right, int lActNumb,int rActNumb, SpFunctions sp)
    {
        ItemClass item = equip.bag [numb].GetComponent<ItemClass> ();
        int wActNumb = right == true ? rActNumb : lActNumb;
        GameObject weapon;
        WeaponClass chWeapon = right==true ? item.objects[0].GetComponent<WeaponClass>() : item.objects [1].GetComponent<WeaponClass>();
        WeaponClass defWeapon = right==true ? equip.defRightWeapon.GetComponent<WeaponClass>() : equip.defLeftWeapon.GetComponent<WeaponClass>();
        if (!string.Equals(equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon.gameObject.name,
                           chWeapon.gameObject.name+"(Clone)"))
        {
            s1=equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon.gameObject.name;
            s2=chWeapon.gameObject.name;
            if (item.objects[0].GetComponent<WeaponClass>().handEmployment==2)
            {
                if (!string.Equals(equip.gameObject.GetComponent<Actions> ().activities [lActNumb].weapon.gameObject.name,
                                   equip.defLeftWeapon.name))
                {
                    DeleteWeapon(equip,equip.gameObject.GetComponent<Actions> ().activities [lActNumb].actMode,
                                 0==1, lActNumb,sp,equip.defLeftWeapon.GetComponent<WeaponClass>());
                }
                if (!string.Equals(equip.gameObject.GetComponent<Actions> ().activities [rActNumb].weapon.gameObject.name,
                                   equip.defRightWeapon.name))
                {
                    DeleteWeapon(equip,equip.gameObject.GetComponent<Actions> ().activities [rActNumb].actMode,
                                 1==1, rActNumb,sp,equip.defRightWeapon.GetComponent<WeaponClass>());
                }

            }
            else
            {
                if (!string.Equals(equip.gameObject.GetComponent<Actions> ().activities [wActNumb].weapon.gameObject.name,
                                  defWeapon.gameObject.name))
                {
                    DeleteWeapon(equip,equip.gameObject.GetComponent<Actions> ().activities [wActNumb].actMode ,
                                 right,wActNumb,sp,defWeapon);
                }
                if (string.Equals(equip.gameObject.GetComponent<Actions> ().activities [rActNumb].weapon.gameObject.name,
               	               item.objects[0].name+"(Clone)"))
                {
                    DeleteWeapon(equip,numb, 1==1, rActNumb,sp,equip.defRightWeapon.GetComponent<WeaponClass>());
                }
                if (item.objects[0].GetComponent<WeaponClass>().handEmployment==1)
                {
                    if (string.Equals(equip.gameObject.GetComponent<Actions> ().activities [lActNumb].weapon.gameObject.name,
                   	               item.objects[1].name+"(Clone)"))
                        DeleteWeapon(equip,numb, 0==1, lActNumb,sp,equip.defLeftWeapon.GetComponent<WeaponClass>());
                }
            }
            AddWeapon(equip, numb, right,wActNumb,sp);
        }
        else
        {
            kk++;
            DeleteWeapon(equip, numb, right,wActNumb,sp,defWeapon);
        }
    }
    //тип 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 virtual void Awake()
 {
     animator = GetComponent<CharacterAnimator> ();
     sp = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<SpFunctions> ();
 }
    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> ();
    }
 //тип 1 номер 6
 public void Climb(Rigidbody2D rigid, Stats stats, InfoGetTypes IGT, InfoGets inf, int numb, int targetSpeedX, int targetSpeedY, SpFunctions sp)
 {
     rigid.gravityScale = 0f;
     if (IGT.Raycaster(inf,numb,new Vector2(targetSpeedX*1f,targetSpeedY*1f),sp))
         rigid.velocity=new Vector2(targetSpeedX*1f,targetSpeedY*1f);
     else
         rigid.velocity=new Vector2(0f,0f);
     stats.stats.targetSpeedX = targetSpeedX;
     stats.stats.targetSpeedY = targetSpeedY;
 }
 public void Awake()
 {
     sp=GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
 }
 public void SetEquip(Equipment e)
 {
     sp = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<SpFunctions> ();
     equip = e;
 }