Ejemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        ID               = 1;
        Hit.enabled      = false;
        HitImage.enabled = false;
        seeker           = GetComponent <Seeker>();
        AM               = FindObjectOfType <AudioManager>();
        GM               = FindObjectOfType <GameManager>();
        //GM = GameObject.FindGameObjectWithTag("GameManager");
        LC  = GM.LegList[1];
        HC  = GM.HeadList[1];
        TC  = GM.TorsoList[1];
        WrC = GM.WeaponRList[1];
        WlC = GM.WeaponLList[1];

        SRLegs.sprite      = LC.part;
        SRLegs.material    = LC.Emitter;
        SRHead.sprite      = HC.part;
        SRHead.material    = HC.Emitter;
        SRTorso.sprite     = TC.part;
        SRTorso.material   = TC.Emitter;
        SRWeaponR.sprite   = WrC.part;
        SRWeaponR.material = WrC.Emitter;
        SRWeaponL.sprite   = WlC.part;
        SRWeaponL.material = WlC.Emitter;
        Anim = legsChildren.GetComponent <Animator>();
        Anim.SetInteger("ArmorID", 1);
        SRLegs.sprite    = LC.part;
        Anim.speed       = 0;
        currentHP        = HC.hp + TC.hp + LC.hp;
        maxHP            = HC.hp + TC.hp + LC.hp;
        maxEnergy        = TC.energy;
        currentEnergy    = maxEnergy;
        currentAmmoL     = WlC.ammo;
        currentAmmoR     = WrC.ammo;
        BarrelL.position = new Vector2(BarrelL.position.x, BarrelL.position.y + WlC.barrelLength);
        BarrelR.position = new Vector2(BarrelR.position.x, BarrelR.position.y + WrC.barrelLength);
        //isBoosting = true;
        currentTarget = movePoints[Random.Range(0, 3)];

        if (AM.Playing("MenuSong"))
        {
            AM.Stop("MenuSong");
        }
        //AM.Play("DesertSong");
        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
        if (overBoosters.isPlaying)
        {
            overBoosters.Stop();
        }
        int nextSpot = Random.Range(0, movePoints.Count);

        seeker.StartPath(rb.position, movePoints[nextSpot].position, OnPathComplete);
        InvokeRepeating("UpdatePath", 0f, 0.5f);
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        ID               = 1;
        Hit.enabled      = false;
        HitImage.enabled = false;
        seeker           = GetComponent <Seeker>();
        AM               = FindObjectOfType <AudioManager>();
        GM               = FindObjectOfType <GameManager>();
        //GM = GameObject.FindGameObjectWithTag("GameManager");
        LC  = GM.LegList[0];
        HC  = GM.HeadList[0];
        TC  = GM.TorsoList[0];
        WrC = GM.WeaponRList[0];
        WlC = GM.WeaponLList[0];

        SRLegs.sprite      = LC.part;
        SRLegs.material    = LC.Emitter;
        SRHead.sprite      = HC.part;
        SRHead.material    = HC.Emitter;
        SRTorso.sprite     = TC.part;
        SRTorso.material   = TC.Emitter;
        SRWeaponR.sprite   = WrC.part;
        SRWeaponR.material = WrC.Emitter;
        SRWeaponL.sprite   = WlC.part;
        SRWeaponL.material = WlC.Emitter;
        Anim = legsChildren.GetComponent <Animator>();
        Anim.SetInteger("ArmorID", 0);
        SRLegs.sprite    = LC.part;
        Anim.speed       = 0;
        currentHP        = 9999;
        maxHP            = HC.hp + TC.hp + LC.hp;
        maxEnergy        = TC.energy;
        currentEnergy    = maxEnergy;
        currentAmmoL     = WlC.ammo;
        currentAmmoR     = WrC.ammo;
        BarrelL.position = new Vector2(BarrelL.position.x, BarrelL.position.y + WlC.barrelLength);
        BarrelR.position = new Vector2(BarrelR.position.x, BarrelR.position.y + WrC.barrelLength);
        //isBoosting = true;


        if (AM.Playing("MenuSong"))
        {
            AM.Stop("MenuSong");
        }
        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
        if (overBoosters.isPlaying)
        {
            overBoosters.Stop();
        }
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        ID               = 4;
        cannonRange      = cannonRange - 2;
        Hit.enabled      = false;
        HitImage.enabled = false;
        seeker           = GetComponent <Seeker>();
        AM               = FindObjectOfType <AudioManager>();
        GM               = FindObjectOfType <GameManager>();
        //GM = GameObject.FindGameObjectWithTag("GameManager");
        LC  = GM.LegList[4];
        HC  = GM.HeadList[4];
        TC  = GM.TorsoList[4];
        WrC = GM.WeaponRList[4];
        WlC = GM.WeaponLList[4];

        SRLegs.sprite      = LC.part;
        SRLegs.material    = LC.Emitter;
        SRHead.sprite      = HC.part;
        SRHead.material    = HC.Emitter;
        SRTorso.sprite     = TC.part;
        SRTorso.material   = TC.Emitter;
        SRWeaponR.sprite   = WrC.part;
        SRWeaponR.material = WrC.Emitter;
        SRWeaponL.sprite   = WlC.part;
        SRWeaponL.material = WlC.Emitter;
        Anim = legsChildren.GetComponent <Animator>();
        Anim.SetInteger("ArmorID", 4);
        SRLegs.sprite    = LC.part;
        Anim.speed       = 0;
        currentHP        = HC.hp + TC.hp + LC.hp;
        maxHP            = HC.hp + TC.hp + LC.hp;
        maxEnergy        = TC.energy;
        currentEnergy    = maxEnergy;
        currentAmmoL     = WlC.ammo;
        currentAmmoR     = WrC.ammo;
        BarrelL.position = new Vector2(BarrelL.position.x, BarrelL.position.y + WlC.barrelLength);
        BarrelR.position = new Vector2(BarrelR.position.x, BarrelR.position.y + WrC.barrelLength);
        Turn();
        if (AM.Playing("MenuSong"))
        {
            AM.Stop("MenuSong");
        }


        //AM.Play("ManufactureSong");
        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
        InvokeRepeating("UpdatePath", 0f, 0.5f);
    }
Ejemplo n.º 4
0
    private void Awake()
    {
        AM = FindObjectOfType <AudioManager>();
        GM = FindObjectOfType <GameManager>();
        if (AM.Playing("MenuSong"))
        {
            AM.Stop("MenuSong");
        }

        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
    }
Ejemplo n.º 5
0
 private void Awake()
 {
     AM = FindObjectOfType <AudioManager>();
     GM = FindObjectOfType <GameManager>();
     if (AM.Playing("MenuSong"))
     {
         AM.Stop("MenuSong");
     }
     if (!(GM.slainEnemies == 2 || GM.slainEnemies == 5) || GM.statusE[ID] == true)
     {
         AM.Play("AirArenaSong");
     }
     if (Boosters.isPlaying)
     {
         Boosters.Stop();
     }
 }
Ejemplo n.º 6
0
    void FixedUpdate()
    {
        if (active)
        {
            //Debug.Log(currentHP);
            if (currentHP <= 0)
            {
                if (currentHP < 0)
                {
                    currentHP = 0;
                }
                dead = true;

                if (dead == true && createdSpark == false)
                {
                    createdSpark = true;
                    Vector3    deathPos = this.gameObject.transform.position;
                    GameObject E        = Instantiate(deathSpark, deathPos, Quaternion.identity);
                    E.transform.parent = gameObject.transform;
                    //StartCoroutine(Reload());
                }
            }

            if (inCannonRange && Time.time > timeStampturn)
            {
                Turn();
                timeStampturn = Time.time + 0.5f;
            }


            if (!dead)
            {
                if (isBoosting && !overheating && Time.time > timeStampDeplete && currentEnergy > LC.consumptionRate)
                {
                    timeStampDeplete = Time.time + LC.consumptionRate;
                    //currentEnergy -= 10;
                }
                else if (isBoosting == false && Time.time > timeStampCharge && currentEnergy < maxEnergy)
                {
                    currentEnergy += 10;

                    timeStampCharge = Time.time + TC.chargeRate;
                }
                if (currentEnergy <= LC.consumptionRate)
                {
                    overheating = true;
                }
                else if (currentEnergy >= maxEnergy / 4)
                {
                    overheating = false;
                }
                if (isBoosting)
                {
                    if (boosttimer <= 0.0f)
                    {
                        boosttimer = 0.2f;
                    }
                }
                if (isBoosting || boosttimer > 0.0f)
                {
                    boosttimer -= Time.deltaTime;
                    if (!Boosters.isPlaying)
                    {
                        Boosters.Play();
                    }
                    SRLegs.sprite = LC.part;
                    Anim.speed    = 0;
                }
                else
                {
                    if (Boosters.isPlaying)
                    {
                        Boosters.Stop();
                    }
                    if (Anim.GetInteger("ArmorID") < 0)
                    {
                        Anim.SetInteger("ArmorID", 12);
                    }
                }
                float distance = Vector3.Distance(transform.position, Player.transform.position);



                //if (BR.near && !overheating)
                //{
                //    isBoosting = true;
                //}
                //else if (distance < 10f && !overheating)
                //{

                //    isBoosting = true;
                //}
                //else if (BR.near == false || overheating)
                //{
                //    isBoosting = false;
                //}


                //    // movement = movement * -1;
                //    //go back


                //}
                //else if (distance > 7f)
                //{
                //    backwards = false;
                //    isBoosting = true;
                //    //    movement = movement;
                //    //go back
                //}
                //if (inCannonRange)
                //{
                //    isBoosting = true;
                //}
                //else
                //{
                //    isBoosting = false;
                //}


                if (isBoosting)
                {
                    if (Left)
                    {
                        Debug.Log("BoostL");
                        rb.MovePosition(rb.position + (movement + (Vector2)transform.right) * LC.boosters * Time.fixedDeltaTime);
                    }
                    else if (Right)
                    {
                        Debug.Log("BoostR");
                        rb.MovePosition(rb.position + (movement - (Vector2)transform.right) * LC.boosters * Time.fixedDeltaTime);
                    }
                    else
                    {
                        rb.MovePosition(rb.position + (movement) * LC.boosters * Time.fixedDeltaTime);
                    }
                }
                else
                {
                    if (Left)
                    {
                        rb.MovePosition(rb.position + (movement + (Vector2)transform.right) * LC.walkSpd * Time.fixedDeltaTime);
                    }
                    else if (Right)
                    {
                        rb.MovePosition(rb.position + (movement - (Vector2)transform.right) * LC.walkSpd * Time.fixedDeltaTime);
                    }
                    else
                    {
                        rb.MovePosition(rb.position + (movement) * LC.walkSpd * Time.fixedDeltaTime);
                    }
                }


                if (movement != Vector2.zero)
                {
                    Anim.speed = 1;
                }
                else
                {
                    Anim.speed = 0;
                }


                Vector2 lookDir = (Vector2)Player.transform.position - rb.position;
                float   angle   = Mathf.Atan2(lookDir.y, lookDir.x) * Mathf.Rad2Deg - 90f;
                rb.rotation = angle;
            }
        }
    }
Ejemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        if (active)
        {
            isBoosting = true;
            if (currentAmmoR >= 3)
            {
                misslesArmed   = true;
                misslesLoading = false;
            }
            else if (currentAmmoR <= 0)
            {
                misslesArmed   = false;
                misslesLoading = true;
            }


            if (currentAmmoL >= 2)
            {
                carbineArmed   = true;
                carbineLoading = false;
            }
            else if (currentAmmoL <= 0)
            {
                carbineArmed   = false;
                carbineLoading = true;
            }


            if (struck == true)
            {
                struck = false;
                StartCoroutine(showHit());
            }
            //if (sideL.hittingWall && !sideR.hittingWall)
            //{
            //    Left = false;
            //    Right = true;
            //}
            //else if (sideR.hittingWall && !sideL.hittingWall)
            //{
            //    Left = true;
            //    Right = false;
            //}
            //else if (sideR.hittingWall && sideL.hittingWall)
            //{
            //    Right = false;
            //    Left = false;
            //}
            //Armor 8 AI

            //if player not in radar range or IS in range
            //walk towards player


            //if player in viewing range
            //boost towards them
            float distance = Vector3.Distance(transform.position, Player.transform.position);

            if (!dead)
            {
                if (distance < machineGunRange)
                {
                    //isBoosting = true;
                    inCannonRange = true;
                }
                else
                {
                    //isBoosting = true;
                    inCannonRange = false;
                }
                if (distance < missileRange)
                {
                    DroneReady = true;
                }
                else
                {
                    DroneReady = false;
                }

                var mask = ~((1 << 14) | (1 << 11) | (1 << 12) | (1 << 8) | (1 << 10));
                RaycastHit2D
                    hit = Physics2D.Linecast(transform.position, Player.transform.position, mask);

                if (DroneReady && Time.time > timeStampL && currentAmmoL > 0 && hit.collider != null && hit.collider.tag == "Player")
                {
                    fireLeft      = true;
                    timeStampL    = Time.time + WlC.fireRate;
                    currentAmmoL -= 1;
                    WlC.Atk(BarrelL, AM, ally);
                }
                else if (DroneReady == false || currentAmmoL <= 0)
                {
                    fireLeft = false;
                }

                if (((fireLeft && currentAmmoL < WlC.ammo) || currentAmmoL <= 0) && Time.time > ammoTimeStampL)
                {
                    ammoTimeStampL = Time.time + WlC.reloadRate;
                    currentAmmoL  += 1;
                }

                if (carbineArmed && inCannonRange == true && Time.time > timeStampR && currentAmmoR > 0 && hit.collider != null && hit.collider.tag == "Player")
                {
                    fireRight     = true;
                    timeStampR    = Time.time + WrC.fireRate;
                    currentAmmoR -= 1;
                    WrC.Atk(BarrelR, AM, ally);
                }
                else if (!carbineArmed || !inCannonRange)
                {
                    fireRight = false;
                }

                if ((fireRight == false && (currentAmmoR < WrC.ammo) || currentAmmoR <= 0) && Time.time > ammoTimeStampR)
                {
                    ammoTimeStampR = Time.time + WrC.reloadRate;
                    currentAmmoR  += 1;
                }



                if (movement != Vector2.zero)
                {
                    Quaternion newRot = Quaternion.LookRotation(Vector3.forward, movement);
                    legsChildren.transform.rotation = newRot;
                    //Debug.Log(legsChildren.transform.localRotation.eulerAngles.z);
                    if (legsChildren.transform.localRotation.eulerAngles.z > 90 && legsChildren.transform.localRotation.eulerAngles.z < 270)
                    {
                        //    newRot = Quaternion.Inverse(newRot);
                        //    //Vector3 rot = legsChildren.transform.localRotation.eulerAngles;
                        //    //rot = new Vector3(newRot.x, newRot.y, newRot.z - 180);
                        legsChildren.transform.localScale = Vector3.down + Vector3.right + Vector3.forward;
                        //    ////rot = new Vector3(rot.x, rot.y, Mathf.Clamp(rot.z, legsChildren.transform.rotation.eulerAngles.z - 90, legsChildren.transform.rotation.eulerAngles.z + 90));
                        //    //newRot = Quaternion.Euler(rot);
                        //legsChildren.transform.rotation = rot180degrees;
                    }
                    else
                    {
                        legsChildren.transform.localScale = Vector3.up + Vector3.right + Vector3.forward;
                    }
                }
                else
                {
                    legsChildren.transform.rotation = transform.rotation;
                }

                if (path == null)
                {
                    return;
                }
                if (currentWaypoint >= path.vectorPath.Count)
                {
                    reachedEndOfPath = true;
                    return;
                }
                else
                {
                    reachedEndOfPath = false;
                }

                //            Vector2 directoin =
                movement = ((Vector2)path.vectorPath[currentWaypoint] - rb.position).normalized; //Vector3.Normalize(Player.transform.position - transform.position);

                float d = Vector2.Distance(rb.position, path.vectorPath[currentWaypoint]);
                if (d < nextWaypointDistance)
                {
                    currentWaypoint++;
                }
            }
            else
            {
                rb.velocity = Vector2.zero;
                if (Boosters.isPlaying)
                {
                    Boosters.Stop();
                }
                Anim.speed = 0;
                movement   = Vector2.zero;
            }

            //if player in shooting range
            //rotate around them and charge towards them
            //shoot the f**k out of them
            //keep a certain distance away

            //if player is really close
            //activate overdrive atk

            //if bullet is near
            //sidestep
            //if missle is near
            //sidestep and charge towards player if near

            //if energy below 20%
            //dont boost unless avoiding a projectile

            //notes: armor 8 is hyper aggressive and tanky, the strategy is to strafe and chagre until in overdrive range, this armor cares very little for their own safety



            //movement.x = Input.GetAxisRaw("Horizontal");
            //movement.y = Input.GetAxisRaw("Vertical");
        }
    }
Ejemplo n.º 8
0
    void Start()
    {
        Hit              = GameObject.Find("HitText").GetComponent <TextMeshProUGUI>();
        HitImage         = GameObject.Find("HitImage").GetComponent <Image>();
        Human            = GameObject.Find("Player");
        Enemy            = GameObject.Find("Enemy");
        ID               = 5;
        Hit.enabled      = false;
        HitImage.enabled = false;
        seeker           = GetComponent <Seeker>();
        AM               = FindObjectOfType <AudioManager>();
        GM               = FindObjectOfType <GameManager>();
        //GM = GameObject.FindGameObjectWithTag("GameManager");
        LC  = GM.LegList[11];
        HC  = GM.HeadList[11];
        TC  = GM.TorsoList[11];
        WrC = GM.WeaponRList[6];
        WlC = GM.WeaponLList[5];

        SRLegs.sprite      = LC.part;
        SRLegs.material    = LC.Emitter;
        SRHead.sprite      = HC.part;
        SRHead.material    = HC.Emitter;
        SRTorso.sprite     = TC.part;
        SRTorso.material   = TC.Emitter;
        SRWeaponR.sprite   = WrC.part;
        SRWeaponR.material = WrC.Emitter;
        SRWeaponL.sprite   = WlC.part;
        SRWeaponL.material = WlC.Emitter;

        Anim = legsChildren.GetComponent <Animator>();
        Anim.SetInteger("ArmorID", 11);
        Anim.speed    = 0;
        SRLegs.sprite = LC.part;
        currentHP     = HC.hp + TC.hp + LC.hp + 500;
        if (GM.onFinalLevel1)
        {
            currentHP = 2800;
        }
        maxHP            = HC.hp + TC.hp + LC.hp;
        maxEnergy        = TC.energy;
        currentEnergy    = maxEnergy;
        currentAmmoL     = WlC.ammo;
        currentAmmoR     = WrC.ammo;
        BarrelL.position = new Vector2(BarrelL.position.x, BarrelL.position.y + WlC.barrelLength);
        BarrelR.position = new Vector2(BarrelR.position.x, BarrelR.position.y + WrC.barrelLength);
        Turn();
        if (AM.Playing("MenuSong"))
        {
            AM.Stop("MenuSong");
        }
        AM.StopAll();
        if (GM.onFinalLevel1)
        {
        }
        else
        {
            AM.Play("AISong");
        }



        //AM.Play("ArenaSong");
        if (Boosters.isPlaying)
        {
            Boosters.Stop();
        }
        InvokeRepeating("UpdatePath", 0f, 0.5f);
    }
Ejemplo n.º 9
0
    void FixedUpdate()
    {
        // Debug.Log(Boosters.isPlaying);
        //Debug.Log(currentHP);
        if (currentHP <= 0)
        {
            if (currentHP < 0)
            {
                currentHP = 0;
            }
            dead = true;

            if (dead == true && createdSpark == false)
            {
                createdSpark = true;
                Vector3    deathPos = this.gameObject.transform.position;
                GameObject E        = Instantiate(deathSpark, deathPos, Quaternion.identity);
                E.transform.parent = gameObject.transform;
                StartCoroutine(Reload());
            }
        }



        //if (isBoosting == true && Time.time > timeStampDeplete && currentEnergy > LC.consumptionRate)
        //{
        //    if (!AM.Playing("Boosters"))
        //    {
        //        AM.Play("Boosters");
        //    }
        //    timeStampDeplete = Time.time + LC.consumptionRate;
        //    currentEnergy -= 10;

        //}
        //else if (isBoosting == false && Time.time > timeStampCharge && currentEnergy < maxEnergy)
        //{
        //    if (AM.Playing("Boosters"))
        //    {
        //        AM.Stop("Boosters");
        //    }
        //    currentEnergy += 10;

        //    timeStampCharge = Time.time + TC.chargeRate;
        //}
        ////boosters and movement
        ///
        if (!dead)
        {
            if (isBoosting)// && currentEnergy > LC.consumptionRate)
            {
                if (!Boosters.isPlaying)
                {
                    Boosters.Play();
                }

                rb.MovePosition(rb.position + movement * LC.boosters * Time.fixedDeltaTime);


                //Debug.Log("Space");
                //Anim.SetInteger("ArmorSet", -1);
                SRLegs.sprite = LC.part;
                Anim.speed    = 0;
            }
            else
            {
                if (Boosters.isPlaying)
                {
                    Boosters.Stop();
                }


                rb.MovePosition(rb.position + movement * LC.walkSpd * Time.fixedDeltaTime);


                if (Anim.GetInteger("ArmorID") < 0)
                {
                    Anim.SetInteger("ArmorID", 6);
                }
                if (movement != Vector2.zero)
                {
                    Anim.speed = 1;
                }
                else
                {
                    Anim.speed = 0;
                }
            }


            Vector2 lookDir = (Vector2)Player.transform.position - rb.position;
            float   angle   = Mathf.Atan2(lookDir.y, lookDir.x) * Mathf.Rad2Deg - 90f;
            rb.rotation = angle;
        }
    }
Ejemplo n.º 10
0
    void FixedUpdate()
    {
        if (active)
        {
            //Debug.Log(currentHP);
            if (currentHP <= 0)
            {
                if (currentHP < 0)
                {
                    currentHP = 0;
                }
                dead = true;

                if (dead == true && createdSpark == false)
                {
                    createdSpark = true;
                    Vector3    deathPos = this.gameObject.transform.position;
                    GameObject E        = Instantiate(deathSpark, deathPos, Quaternion.identity);
                    E.transform.parent = gameObject.transform;
                    StartCoroutine(Reload());
                }
            }

            if (inCannonRange && Time.time > timeStampturn)
            {
                Turn();
                timeStampturn = Time.time + 1f;
            }


            if (!dead)
            {
                if (isBoosting)
                {
                    if (!Boosters.isPlaying)
                    {
                        Boosters.Play();
                    }
                    SRLegs.sprite = LC.part;
                    Anim.speed    = 0;
                }
                else
                {
                    if (Boosters.isPlaying)
                    {
                        Boosters.Stop();
                    }
                    if (Anim.GetInteger("ArmorID") < 0)
                    {
                        Anim.SetInteger("ArmorID", 5);
                    }
                }

                if (BR.near)
                {
                    isBoosting = true;
                }

                float distance = Vector3.Distance(transform.position, Player.transform.position);
                if (distance < 7.25f)
                {
                    backwards = true;
                    if (BR.near == false)
                    {
                        isBoosting = false;
                    }

                    // movement = movement * -1;
                    //go back
                }
                else if (distance > 15f)
                {
                    backwards  = false;
                    isBoosting = true;
                    //    movement = movement;
                    //go back
                }

                if (flagB.hittingWall)
                {
                    backwards = false;
                }
                if (backwards)
                {
                    movement = movement * -1;
                }

                if (isBoosting)
                {
                    if (Left)
                    {
                        rb.MovePosition(rb.position + (movement + (Vector2)transform.right) * LC.boosters * Time.fixedDeltaTime);
                    }
                    else if (Right)
                    {
                        rb.MovePosition(rb.position + (movement - (Vector2)transform.right) * LC.boosters * Time.fixedDeltaTime);
                    }
                }
                else
                {
                    if (Left)
                    {
                        rb.MovePosition(rb.position + (movement + (Vector2)transform.right) * LC.walkSpd * Time.fixedDeltaTime);
                    }
                    else if (Right)
                    {
                        rb.MovePosition(rb.position + (movement - (Vector2)transform.right) * LC.walkSpd * Time.fixedDeltaTime);
                    }
                }


                if (movement != Vector2.zero)
                {
                    Anim.speed = 1;
                }
                else
                {
                    Anim.speed = 0;
                }


                Vector2 lookDir = (Vector2)Player.transform.position - rb.position;
                float   angle   = Mathf.Atan2(lookDir.y, lookDir.x) * Mathf.Rad2Deg - 90f;
                rb.rotation = angle;
            }
        }
    }