Inheritance: MonoBehaviour
コード例 #1
0
    public GameObject CreateArrow() /* find or create Arrow AR return script of arrow */
    {
        List <ArrowScript> arrowList = new List <ArrowScript>();

        gameObject.GetComponentsInChildren <ArrowScript>(true, arrowList);
        GameObject arrowObj;

        if (arrowList.Count == 1)
        {
            arrowObj = arrowList[0].gameObject; //not transform to gameobj
            arrowObj.SetActive(true);
        }
        else
        {
            foreach (ArrowScript dsb in arrowList)
            {
                Destroy(dsb.gameObject);
            }
            arrowObj = Instantiate(arrowPrefab);
        }

        arrowObj.transform.SetParent(gameObject.transform);
        arrowObj.transform.localPosition = Vector3.zero;
        arrowObj.transform.rotation      = arrowObj.transform.parent.rotation;
        arrowObj.transform.localScale    = Vector3.one * arrowSize;

        /* set started arrow rotation here */
        ArrowScript arrow = arrowObj.GetComponent <ArrowScript>();

        //arrow.PointToZero();
        Debug.Log(gameObject.name + " attract arrow to nav");
        return(arrowObj);
    }
コード例 #2
0
 void Awake()
 {
     Arrow = ArrowObj.GetComponent <ArrowScript>();
     Panel = ContainerObj.GetComponent <DropDownPanelScript>();
     Arrow.DropDownToggle += ArrowTogglePipe;
     _ContRT = ContainerObj.GetComponent <RectTransform>();
 }
コード例 #3
0
    protected override void InteractWithArrow(ArrowScript arrow)
    {
        Vector2 arrowVelocityDir = arrow.GetVelocity().normalized;

        rb.AddForce(arrowVelocityDir * pushForce, ForceMode2D.Impulse);
        base.InteractWithArrow(arrow);
    }
コード例 #4
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #5
0
ファイル: Items.cs プロジェクト: Ckpyt/ColonyRuler-code
    /// <summary>
    /// Open item after research.
    /// Could be changed by children
    /// Here: setting production as tools wherever it used
    /// </summary>
    public override void OpenItem()
    {
        foreach (var eff in m_effects)
        {
            var products = Productions.GetProductions(eff.Value.m_name);
            foreach (GameAbstractItem prod in products)
            {
                if (prod.m_isItOpen > 0)
                {
                    GameMaterial mat          = (GameMaterial)prod;
                    bool         hasItTheSame = false;
                    foreach (var effect in mat.m_tools)
                    {
                        hasItTheSame |= (effect.m_toolLink.m_name == m_name && effect.m_name == eff.Value.m_name);
                    }

                    if (hasItTheSame)
                    {
                        continue;
                    }
                    else
                    {
                        ItemsEffect neff = new ItemsEffect(eff.Value);
                        neff.m_production = mat;
                        mat.m_tools.Add(neff);
                        ArrowScript asc = ArrowScript.NewArrowScript(neff.m_toolLink.m_thisObject, mat.m_thisObject);
                        asc.m_isItTool = true;
                        mat.m_thisObject.m_toolsTo.Add(asc);
                        m_thisObject.m_toolsFrom.Add(asc);
                    }
                }
            }
        }
        base.OpenItem();
    }
コード例 #6
0
    public void SetArrowColor(bool isDefault, bool isLeftArrow)
    {
        string     arrowString = isLeftArrow ? "ArrowLeft" : "ArrowRight";
        GameObject arrow       = gameObject.transform.Find(arrowString).gameObject;

        if (arrow == null)
        {
            return;
        }

        ArrowScript script = arrow.GetComponent <ArrowScript>();

        if (script == null)
        {
            return;
        }

        if (isDefault)
        {
            script.SetDefaultColor();
        }
        else
        {
            script.SetVisualizationColor();
        }
    }
コード例 #7
0
ファイル: MainScript.cs プロジェクト: Ckpyt/ColonyRuler-code
    /// <summary>
    /// place new icons on the screen and make arrows
    /// </summary>
    /// <param name="items"> new icons collection </param>
    public void PlaceOpenedItems(List <AbstractObject> items)
    {
        foreach (var itm in items)
        {
            if (itm.m_isItOpen < 1)
            {
                continue;
            }

            FindEmptySpace(out var x, out var y);
            IconScript.PlaceNewGameobject(x, y, itm);
        }
        //make arrows. All the objects should be placed
        foreach (var aitm in items.Where(aitm => aitm.m_isItOpen > 0))
        {
            aitm.OpenItem();
            var itm = aitm as GameAbstractItem;

            if (itm?.m_dependencyCount == null)
            {
                continue;
            }
            foreach (var depList in itm.m_dependencyCount)
            {
                foreach (var dep in depList.m_dependency.Where(
                             dep => dep.m_isItOpen > 0))
                {
                    ArrowScript.NewStoredArrowScript(dep.m_thisObject, itm.m_thisObject);
                }
            }
        }
    }
コード例 #8
0
    // Update is called once per frame
    void Update()
    {
        Vector3 weaponSpawnPoint = new Vector3(xValue, Random.Range(-minY, maxY), weapon.transform.position.z);
        Vector3 moveToward;

        if (canFire)
        {
            if (Input.GetButton("Fire1"))
            {
                moveToward    = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                moveToward.z  = 0;
                moveDirection = moveToward - weaponSpawnPoint;
                moveDirection.Normalize();
                Quaternion rotation = Quaternion.Euler(0,
                                                       0,
                                                       Mathf.Atan2(-moveDirection.y, -moveDirection.x) * Mathf.Rad2Deg);
                if (arrowOn)
                {
                    GameObject  arrow       = Instantiate(weapon, weaponSpawnPoint, rotation) as GameObject;
                    ArrowScript arrowScript = arrow.GetComponent <ArrowScript>();
                    arrowScript.moveDirection = moveDirection;
                }
                else
                {
                    GameObject     catapult       = Instantiate(weapon, weaponSpawnPoint, rotation) as GameObject;
                    CatapultScript catapultScript = catapult.GetComponent <CatapultScript>();
                    catapultScript.moveDirection = moveDirection;
                }


                holdFire();
                Invoke("openFire", weaponFireRate);
            }
        }
    }
コード例 #9
0
    void ShootArrow()
    {
        GameObject  newArrow  = Instantiate(arrowPrefab, transform.position, Quaternion.identity) as GameObject;
        ArrowScript arrScript = newArrow.GetComponent <ArrowScript>();

        arrScript.isFriendly = true;
        Vector3 dir = Vector3.zero;

        switch (faceDirection)
        {
        case 1:
            dir = new Vector3(0, 1, 0);
            break;

        case 2:
            dir = new Vector3(1, 0, 0);
            break;

        case 3:
            dir = new Vector3(0, -1, 0);

            break;

        case 4:
            dir = new Vector3(-1, 0, 0);
            break;

        default:
            break;
        }
        newArrow.transform.position += dir;
        arrScript.SetDir(dir);
    }
コード例 #10
0
 private void Awake()
 {
     uIController = FindObjectOfType <UIController>();
     source       = GetComponent <AudioSource>();
     a_controller = arrowContainer.GetComponent <ArrowScript>();
     anim         = GetComponent <Animator>();
 }
コード例 #11
0
    void shootBow()
    {
        Debug.Log("Shooting");
        GameObject  arrowFlying = Instantiate(arrowPrefab, firePoint.position, firePoint.localRotation);
        ArrowScript arrow       = arrowFlying.GetComponent <ArrowScript>();

        Destroy(arrowFlying, 4f);
    }
コード例 #12
0
	void fireArrow(){
		//Vector3 arrowPosition = new Vector3(transform.position.x, transform.position.y, transform.position.z);
		Vector3 arrowMoveDirection = new Vector3(1,0,0);// fire to right of the scene
		GameObject firedArrow = Instantiate(arrow, transform.position, Quaternion.identity) as GameObject;
		ArrowScript arrowScript = firedArrow.GetComponent<ArrowScript>();
		arrowScript.enemyArrow = true;
		arrowScript.moveDirection = arrowMoveDirection;
	}
コード例 #13
0
    public void FireBullet(Vector2 direction, float rotationZ)
    {
        ArrowScript tmp = Instantiate(arrowPrefab).GetComponent <ArrowScript>();

        tmp.Initialize(player.transform);
        tmp.transform.position = arrowStart.transform.position;
        tmp.transform.rotation = Quaternion.Euler(0.0f, 0.0f, rotationZ - 45);
        tmp.GetComponent <Rigidbody2D>().velocity = direction * arrowSpeed;
    }
コード例 #14
0
    void Start()
    {
        animator      = GetComponent <Animator>();
        s_arrow       = a_container.GetComponent <ArrowScript>();
        score_counter = GetComponent <PlayerScoreCounter>();
        ui_controller = uIContainer.GetComponent <UIController>();

        stored_clip = new string[7];
    }
コード例 #15
0
 protected virtual void InteractWithArrow(ArrowScript arrow)
 {
     if (isForbiddenTarget)
         GameMangerScript.instance.OnLoseArrow();
     if (isArrowDestroyer)
         arrow.DestroyArrow();
     else
         arrow.Stop();
 }
コード例 #16
0
        //clean up parent/attacker references
        //this should be moved into base attack, with the arrow being passed in as a references
        public void ShowAttack(BlobScript target, BlobScript source)
        {
            //var NewArrow = Instantiate()
            var pointyThing = (GameObject)Resources.Load("Prefabs/PointyArrow", typeof(GameObject));
            //Debug.Log(pointyThing);
            var         myThing  = UnityEngine.Object.Instantiate(pointyThing, new Vector3(source.transform.position.x, source.transform.position.y, source.transform.position.z - 1), Quaternion.identity);
            ArrowScript myScript = myThing.GetComponent <ArrowScript>();

            myScript.setTargetAndParent(source, target, this, 0);
        }
コード例 #17
0
    private void shootArrow()
    {
        GameObject arrowInstance = Instantiate(arrow, transform.position, Quaternion.identity);

        arrowInstance.transform.parent = gameObject.transform;
        ArrowScript arrowScript = arrowInstance.GetComponent <ArrowScript>();

        arrowScript.TargetPos = nearestPlayer.transform.position;
        arrowScript.Damage    = Damage;
    }
コード例 #18
0
    /* point directly to node */
    public float ShowArrow(GameObject markerObject, GameObject destinationNode)
    {
        GameObject  arrowObj = GetARObjectOfType(markerObject, ARObject.Type.Arrow);
        ArrowScript arrowsc  = arrowObj.GetComponent <ArrowScript>();

        arrowsc.PointToCoordinate(destinationNode.GetComponent <NodeData>().position);
        arrowObj.SetActive(true);
        SendLastObject(arrowsc.Type);
        return(arrowObj.transform.localRotation.eulerAngles.z);
    }
コード例 #19
0
ファイル: WeaponScript.cs プロジェクト: qfeys/LD40-antiLoot
    // Update is called once per frame
    void Update () {
        if (weapon != pl.equipment.rHand.item)
        {
            weapon = pl.equipment.rHand.item;
            isMelee = weapon is Loot.Melee;
            if (isMelee)
            {
                Loot.Melee melee = weapon as Loot.Melee;
                slashGraphic.transform.localScale = new Vector3(melee.range, melee.range, 1);
                bowGraphic.SetActive(false);
            }
            else if(weapon != null)
            {
                bowGraphic.SetActive(true);
            }
        }
        if(shield != pl.equipment.lHand.item)
        {
            shield = pl.equipment.lHand.item as Loot.Shield;
            if (shield != null)
                shieldGraphic.SetActive(true);
            else
                shieldGraphic.SetActive(false);
        }


        if (isMelee && weapon != null)
        {
            if (Input.GetMouseButtonDown(0) && UI_Stats.windowstance == UI_Stats.WindowStance.non)
            {
                slashGraphic.SetActive(true);
                Invoke("DeactivateSlash", .2f);
                MusicPlayer.PlaySlash();
            }
        }else if (weapon != null) // Ranged
        {
            if (Input.GetMouseButtonDown(0) && UI_Stats.windowstance == UI_Stats.WindowStance.non)
            {
                GameObject newArrow = GameObject.Instantiate(arrowPrefab, transform.position, transform.rotation);
                ArrowScript arSc = newArrow.GetComponent<ArrowScript>();
                arSc.ws = this;
                arSc.speed = (weapon as Loot.Ranged).range / 1;
                arSc.damage = (weapon as Loot.Ranged).damage;
                MusicPlayer.PlayShot();
            }
        }

        if(shield != null)
        {
            if (Input.GetMouseButton(1))
                shieldGraphic.transform.localRotation = Quaternion.Euler(0, 0, 0);
            else
                shieldGraphic.transform.localRotation = Quaternion.Euler(0, 0, 35);
        }
    }
コード例 #20
0
ファイル: AttackSystemScript.cs プロジェクト: 360Tomahawk/SP4
 /// <summary>
 /// Handling the range attack of the arrow. This is the consequences of not planning well from the start
 /// </summary>
 /// <param name="zeArrow">
 /// The arrow
 /// </param>
 /// <param name="zeVictim">
 /// The creature that got shot!
 /// </param>
 public void ManageArrowAttack(ArrowScript zeArrow, HealthScript zeVictim)
 {
     //if (particleSystem == null)
     //    particleSystem = GameObject.Find(m_NameOfParticleSys);
     zeVictim.modifyHealth(-zeArrow.m_damage);
     if (m_bloodParticleSystem != null)
     {
         //particleSystem.SetActive(true);
         m_bloodParticleSystem.transform.position = zeVictim.transform.position;
         m_bloodParticleSystem.GetComponent <ParticleScript>().playEffect();
     }
 }
コード例 #21
0
 // Update is called once per frame
 void Update()
 {
     if (shoot == true)
     {
         if (time < Time.time)
         {
             ArrowScript arrow = Instantiate(arrowPrefab, transform.position, transform.rotation) as ArrowScript;
             arrow.dir = dir2;
             time      = Time.time + arrowDelay;
         }
     }
 }
コード例 #22
0
    public void FinishAttackingBow()
    {
        playerMotor.SetCanMove(true);
        float       direction = transform.localScale.x;
        ArrowScript script    = Instantiate(lastWeapon.arrowPrefab, lastWeapon.arrowSpawnOffset + transform.position, Quaternion.identity).GetComponent <ArrowScript>();

        //rb.AddForce(new Vector2(ArrowForce * direction, 0), ForceMode2D.Impulse);
        script.SetDamage(lastWeapon.baseDamage);
        script.transform.localScale *= transform.localScale.x;
        script.SetSpeed(lastWeapon.arrowForce * direction);
        // Bow Attack
    }
コード例 #23
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && controller.hasBow && !controller.gameManager.GamePaused)
        {
            shoot   = true;
            waiting = 0.5f;
            controller.SetAllAnims("shoot");
            tempDestination = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            CheckFlip(tempDestination.x);
        }

        if (shoot)
        {
            if (waiting > 0)
            {
                waiting -= Time.deltaTime;
            }
            else
            {
                _audi.PlayOneShot(BowShoot);

                Vector3 mouseWorldPos = tempDestination;

                bool    inrange;
                Vector3 tempStartPos;
                if (controller.partsOfBody[0].flipX)
                {
                    tempStartPos = new Vector3(ArrowStartPosition.position.x - 2.8f, ArrowStartPosition.position.y, ArrowStartPosition.position.z);
                }
                else
                {
                    tempStartPos = ArrowStartPosition.position;
                }
                Vector3 direction = DirectionOfLaunchForArc(mouseWorldPos, tempStartPos, speed, false, out inrange);


                Rigidbody2D newarrow = PoolManager.getGameObjectFromPool(ArrowPrefab).GetComponent <Rigidbody2D>();
                newarrow.GetComponent <SpriteRenderer>().flipX = controller.SR.flipX;
                newarrow.transform.position = tempStartPos;
                newarrow.velocity           = transform.TransformDirection(direction * speed * 1.7f);
                ArrowScript newArrow = newarrow.GetComponent <ArrowScript>();
                newArrow.SetNewArrow();
                newArrow.Hunter       = controller;
                newArrow.timer        = 5f;
                newArrow.Timberwolf1  = Timberwolf1;
                newArrow.Timberwolf2  = Timberwolf2;
                newArrow.Ursa         = Ursa;
                newArrow.unicornSpawn = UniSpawn;
                newArrow.pegasusSpawn = PegaSpawn;
                shoot = false;
            }
        }
    }
コード例 #24
0
    /// <summary>
    /// Open item after research.
    /// Here: getting tools for production
    /// Could be changed by children
    /// </summary>
    public override void OpenItem()
    {
        List <ItemsEffect> tools = new List <ItemsEffect>();

        foreach (string prod in m_productionType)
        {
            foreach (ItemsEffect effect in Productions.GetTools(prod.Trim()))
            {
                tools.Add(effect);
            }
        }

        foreach (var tool in tools)
        {
            if (tool.m_toolLink.m_isItOpen > 0)
            {
                bool hasItThesame = false;
                foreach (var eff in m_tools)
                {
                    hasItThesame |= eff.m_toolLink.m_name == tool.m_toolLink.m_name;
                }

                if (hasItThesame)
                {
                    continue;
                }
                else
                {
                    try
                    {
                        ItemsEffect neff = new ItemsEffect(tool);
                        m_tools.Add(neff);
                        ArrowScript asc = ArrowScript.NewArrowScript(neff.m_toolLink.m_thisObject, m_thisObject);
                        asc.m_isItTool = true;
                        m_thisObject.m_toolsTo.Add(asc);
                        neff.m_toolLink.m_thisObject.m_toolsFrom.Add(asc);
                    }
                    catch (Exception ex)
                    {
                        Debug.LogError(ex.Message);
                    }
                }
            }
        }

        for (int i = 0; i < 10; i++)
        {
            m_productQueue.Enqueue(0);
        }

        base.OpenItem();
    }
コード例 #25
0
ファイル: NodeChoice.cs プロジェクト: hilvi/MimmitAndroid
 // Use this for initialization
 void Awake()
 {
     isGirlOn = false;
     GameObject g = GameObject.Find("Girl");
     if(g != null)
         girlMove = g.GetComponent<Movement>();
     arrowScript = Camera.main.GetComponent<ArrowScript>();
     for(int i = 0; i < _bool.Length ;i++)_bool[i] = false;
     if(up.Length != 0 )_bool[0] = true;
     if(down.Length != 0 )_bool[1] = true;
     if(left.Length != 0 )_bool[2] = true;
     if(right.Length != 0 )_bool[3] = true;
 }
コード例 #26
0
    // Trigger of shoot animation that calculates all again to change direction if i need it
    public void ShootedTrigger()
    {
        if (shooted == false)
        {
            origin    = transform.position;
            origin.y += collider.bounds.extents.y * 2 * 0.75f;

            arrow      = arrowPool.getObject();
            arrowLogic = arrow.GetComponent <ArrowScript>();
            arrow.transform.position = origin;
            arrowLogic.player        = player;
            arrowLogic.world         = world;
            float x    = origin.x - hit.point.x;
            float y    = origin.y - hit.point.y;
            float alfa = Mathf.Atan(y / x);
            alfa = (180.0f * alfa) / Mathf.PI;

            if (player.transform.position.x > origin.x)
            {
                if (alfa > 45.0f)
                {
                    alfa = 45.0f;
                }
                else if (alfa < -45.0f)
                {
                    alfa = -45.0f;
                }
                arrowLogic.transform.eulerAngles = new Vector3(0.0f, 0.0f, 90.0f);
                arrowLogic.transform.Rotate(0.0f, 0.0f, alfa);
                arrowLogic.isInLeft = false;
            }
            else
            {
                if (-alfa > 45.0f)
                {
                    alfa = -45.0f;
                }
                else if (-alfa < -45.0f)
                {
                    alfa = 45.0f;
                }
                arrowLogic.transform.eulerAngles = new Vector3(0.0f, 180.0f, 90.0f);
                arrowLogic.transform.Rotate(0.0f, 0.0f, -alfa);
                arrowLogic.isInLeft = true;
            }
            arrow.SetActive(true);
            animator.SetBool("Shoot", false);
            SoundManager.instance.PlaySingle(bowSound);
            shooted = true;
        }
    }
コード例 #27
0
    // Use this for initialization
    void Start()
    {
        lastSpawn    = 0;
        lastAnchor   = 0;
        c_object     = this.transform.FindChild("c_Structure").gameObject;
        c_light      = this.transform.FindChild("c_Light").gameObject;
        activeTroops = new List <GameObject>();
        //ArrowScript arrowS = (ArrowScript)c_arrow.GetComponent (typeof(ArrowScript));

        ActiveTarget = this.gameObject;
        for (int i = 0; i < connectedPoints.Count; ++i)
        {
            if (connectedPoints[i] != null)
            {
                GameObject newArrow = GameObject.Instantiate(ArrowPreFab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
                newArrow.transform.parent        = this.gameObject.transform;
                newArrow.transform.localPosition = new Vector3(0, 0, 0);
                ArrowScript arrowS = (ArrowScript)newArrow.GetComponent(typeof(ArrowScript));
                arrowS = (ArrowScript)newArrow.GetComponent(typeof(ArrowScript));
                arrowS.initilize(connectedPoints[i], this.transform.position);
                arrows.Add(newArrow);
                newArrow.SetActive(false);
            }
        }
        //c_light.light.color = Color.white;
        BaseLightIntensity     = c_light.light.intensity;
        SelectedLightIntensity = BaseLightIntensity + 3f;
        _isSelected            = false;

        // state chosen manually in inspector
        switch (controlPointState)
        {
        case ownerControl.Friendly:
            controlCounter = 1f;
            break;

        case ownerControl.Enemy:
            controlCounter = -1f;
            break;

        default:
            controlCounter = 0f;
            break;
        }

        buildConnections();

        prevControlState = controlPointState;
    }
コード例 #28
0
ファイル: ArrowScript.cs プロジェクト: Ckpyt/ColonyRuler-code
    /// <summary>
    /// place arrow and save it in IconScript
    /// tools should not been stored
    /// </summary>
    /// <param name="from"> source </param>
    /// <param name="to"> goal </param>
    /// <returns> new arrow object </returns>
    public static ArrowScript NewStoredArrowScript(IconScript from, IconScript to)
    {
        ArrowScript asc = NewArrowScript(from, to);

        try
        {
            from.m_from.Add(asc);
            to.m_to.Add(asc);
        }
        catch (Exception ex)
        {
            Debug.LogException(ex);
        }
        return(asc);
    }
コード例 #29
0
    void SetArrow(GameObject node, GameObject arrow)
    {
        if (node == null || arrow == null)
        {
            return;
        }
        ArrowScript arrowScript = arrow.GetComponent <ArrowScript>();

        if (arrowScript == null)
        {
            return;
        }

        arrowScript.ToNode = node.transform;
    }
コード例 #30
0
    IEnumerator WaitForSingleArrowAnimation(GameObject targetObject)
    {
        yield return(new WaitForSpineEvent(animationState, "OnTargetHit"));

        Destroy(boneFollower.GetChild(0).gameObject);

        ArrowScript arrow = SpawnSingleArrow();

        if (arrow)
        {
            arrow.ShootSingle(targetObject, Explosion01);
            GameObject obj = Instantiate(ShootingArrowVFX, arrow.transform.position, arrow.transform.rotation, arrow.transform);
            obj.transform.LookAt(targetObject.transform.position + new Vector3(0, targetObject.GetComponent <BoxCollider2D>().bounds.size.y / 2));
            Instantiate(Explosion01, arrow.transform.position, arrow.transform.rotation);
        }
    }
コード例 #31
0
    private ArrowScript SpawnSingleArrow()
    {
        Spine.Bone bone = skeletonAnimation.skeleton.FindBone("arrow 1");

        if (bone != null)
        {
            Vector3    spawnPosition = new Vector2(bone.WorldX, bone.WorldY);
            GameObject arrow         = new GameObject("Arrow");
            arrow.transform.position = transform.position + spawnPosition;
            ArrowScript arrowScript = arrow.AddComponent <ArrowScript>();
            return(arrowScript);
        }
        else
        {
            return(null);
        }
    }
コード例 #32
0
 public void ChildDeath(ArrowScript child)
 {
     isChildDead = true;
 }
コード例 #33
0
ファイル: ArcherAI.cs プロジェクト: TeamGlitch/Glitch
    // Trigger of shoot animation that calculates all again to change direction if i need it
    public void ShootedTrigger()
    {
        if (shooted == false)
        {
            origin = transform.position;
            origin.y += collider.bounds.extents.y * 2 * 0.75f;

            arrow = arrowPool.getObject();
            arrowLogic = arrow.GetComponent<ArrowScript>();
            arrow.transform.position = origin;
            arrowLogic.player = player;
            arrowLogic.world = world;
            float x = origin.x - hit.point.x;
            float y = origin.y - hit.point.y;
            float alfa = Mathf.Atan(y / x);
            alfa = (180.0f * alfa) / Mathf.PI;

            if (player.transform.position.x > origin.x)
            {
                if (alfa > 45.0f)
                {
                    alfa = 45.0f;
                }
                else if (alfa < -45.0f)
                {
                    alfa = -45.0f;
                }
                arrowLogic.transform.eulerAngles = new Vector3(0.0f, 0.0f, 90.0f);
                arrowLogic.transform.Rotate(0.0f, 0.0f, alfa);
                arrowLogic.isInLeft = false;
            }
            else
            {
                if (-alfa > 45.0f)
                {
                    alfa = -45.0f;
                }
                else if (-alfa < -45.0f)
                {
                    alfa = 45.0f;
                }
                arrowLogic.transform.eulerAngles = new Vector3(0.0f, 180.0f, 90.0f);
                arrowLogic.transform.Rotate(0.0f, 0.0f, -alfa);
                arrowLogic.isInLeft = true;
            }
            arrow.SetActive(true);
            animator.SetBool("Shoot", false);
            SoundManager.instance.PlaySingle(bowSound);
            shooted = true;
        }
    }