Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (health <= 0)
        {
            Destroy(gameObject);
            fin.Load();
        }

        //aim
        Vector2 joyS       = new Vector2(CrossPlatformInputManager.GetAxis("Horizontal"), CrossPlatformInputManager.GetAxis("Vertical"));
        Vector2 Myposi     = transform.position;
        Vector2 enemyposi  = player.transform.position;
        Vector2 enemyposi1 = Myposi - enemyposi;

        grandChild = gameObject.transform.GetChild(0).gameObject;
        if ((enemyposi1 - joyS).magnitude > 5)
        {
            grandChild.SetActive(false);
        }
    }