Beispiel #1
0
 private void Start()
 {
     inputPlayer = GetComponent<Inputs>();
     PanelText.SetActive(false);
     PanelLoadBar.SetActive(false);
     TextToUse.text = itemBase.TextUI;
 }
Beispiel #2
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         PanelText.SetActive(true);
         //other.GetTargetInteract(this);
         if (Input.GetKeyUp(KeyCode.R))
         {
             GetOrInteract();
         }
         if (Input.GetKeyUp(KeyCode.F))
         {
             Interact();
         }
         if (Input.GetButton(_keyQ))
         {
             if (!shootGo)
             {
                 lr.gameObject.SetActive(true);
                 Throught();
             }
         }
         else
         {
             lr.gameObject.SetActive(false);
         }
     }
 }
Beispiel #3
0
    public virtual void Throught()
    {
        PanelLoadBar.SetActive(false);
        PanelText.SetActive(false);

        if (!(BarLoad.fillAmount >= 1.0f))
        {
            BarLoad.fillAmount = 0.0f;
        }

        if (!shootGo)
        {
            mousePosition   = Input.mousePosition;
            mousePosition.z = actualDistance;
        }

        lr.SetPosition(0, new Vector3(this.transform.position.x, this.transform.position.y, this.transform.position.z));
        lr.SetPosition(1, (Camera.main.ScreenToWorldPoint(mousePosition)));

        // Click y lanzar
        if (Input.GetMouseButtonDown(0))
        {
            shootGo = true;
        }
    }
Beispiel #4
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         PanelText.SetActive(true);
     }
 }
Beispiel #5
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         PanelText.SetActive(true);
         //other.GetTargetInteract(this);
     }
 }
Beispiel #6
0
    private void Start()
    {
        var cf = Instantiate(itemBase.Model, new Vector3(transform.position.x, transform.position.y, transform.position.z), this.transform.rotation);

        cf.transform.SetParent(this.transform);
        PanelText.SetActive(false);
        PanelLoadBar.SetActive(false);
        TextToUse.text = itemBase.TextUI;
    }
Beispiel #7
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         PanelText.SetActive(true);
         if (Input.GetButtonDown(_keyF))
         {
             GetOrInteract();
            
         }
     }
 }
Beispiel #8
0
    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PanelLoadBar.SetActive(false);
            PanelText.SetActive(false);

            if (!(BarLoad.fillAmount >= 1.0f))
            {
                BarLoad.fillAmount = 0.0f;
            }
        }
    }
Beispiel #9
0
    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PlayerContact = true;

            PanelText.SetActive(true);
            if (Input.GetButtonDown(_keyF))
            {
                anim = this.gameObject.GetComponentInChildren <Animator>();
                ID   = this.GetComponent <ObjectID>();
                GetOrInteract();
            }
        }
    }
Beispiel #10
0
    private void OnTriggerExit(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PlayerContact = false;

            PanelLoadBar.SetActive(false);
            PanelText.SetActive(false);
            Stoped();

            if (BarLoad.fillAmount == 1.0f)
            {
                BarLoad.fillAmount = 0.0f;
            }
        }
    }
Beispiel #11
0
 private void Start()
 {
     //var cf = Instantiate(itemBase.Model, new Vector3(transform.position.x, transform.position.y, transform.position.z), this.transform.rotation);
     //cf.transform.SetParent(this.transform);
     //cf.transform.localScale = (Scale);
     //anim = cf.GetComponentInChildren<Animator>();
     inventory = GameObject.FindGameObjectWithTag("Inventario").GetComponent <Inventory>();
     PanelText.SetActive(false);
     PanelLoadBar.SetActive(false);
     TextToUse.text = itemBase.TextUI;
     //Canvas tmp = this.GetComponentInChildren<Canvas>();
     //tmp.worldCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();
     //tmp.planeDistance = 5.0f;
     //CanvasScaler tmpCS = this.GetComponentInChildren<CanvasScaler>();
     //tmpCS.referenceResolution = new Vector2(1920.0f, 1080.0f);
 }
Beispiel #12
0
    private void Start()
    {
        var cf = Instantiate(itemBase.Model, new Vector3(transform.position.x, transform.position.y, transform.position.z), this.transform.rotation);

        cf.transform.SetParent(this.transform);
        PanelText.SetActive(false);
        PanelLoadBar.SetActive(false);
        TextToUse.text = itemBase.TextUI;

        if (useInitalCameraDistance)
        {
            Vector3 toObjectVector       = transform.position - Camera.main.transform.position;
            Vector3 linearDistanceVector = Vector3.Project(toObjectVector, Camera.main.transform.forward);
            actualDistance = linearDistanceVector.magnitude;
        }
        else
        {
            actualDistance = distance;
        }
    }
Beispiel #13
0
    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PanelText.SetActive(true);

            if (Input.GetButton(_keyR))
            {
                GetOrInteract();
            }

            if (Input.GetButton(_keyQ))
            {
                lr.gameObject.SetActive(true);
                Throught();
            }
            else
            {
                lr.gameObject.SetActive(false);
            }
        }
    }
Beispiel #14
0
    public override void Shoot()
    {
        if (shootVel == 0)
        {
            PanelLoadBar.SetActive(false);
            PanelText.SetActive(false);

            if (!(BarLoad.fillAmount >= 1.0f))
            {
                BarLoad.fillAmount = 0.0f;
            }

            Plane playerPlane = new Plane(Vector3.up, transform.position);

            Ray ray = Camera.main.ScreenPointToRay(mousePosition);

            float hitdist = 0.0f;
            if (playerPlane.Raycast(ray, out hitdist))
            {
                Vector3 targetPoint = ray.GetPoint(hitdist);

                Quaternion targetRotation = Quaternion.LookRotation(targetPoint - transform.position);

                transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 1f);
                shootVel           = 2;
            }
        }
        rb.AddForce(transform.forward * shootVel);
        shootVel -= (shootVel * Time.deltaTime) / 2;

        if (shootVel < 0.5)
        {
            shootVel    = 0;
            shootGo     = false;
            rb.velocity = new Vector3(1, 1, 1) * 0;
        }
    }
Beispiel #15
0
    private void OnTriggerStay(Collider other)
    {
        if (other.gameObject.tag == "Player")
        {
            PlayerContact = true;
            stats         = other.GetComponent <PlayerStats>();

            PanelText.SetActive(true);

            if (Input.GetButton(_keyF))
            {
                PanelLoadBar.SetActive(true);
                GetOrInteract();
            }
            else
            {
                PanelLoadBar.SetActive(false);
                if (BarLoad.fillAmount == 1.0f)
                {
                    BarLoad.fillAmount = 0.0f;
                }
            }
        }
    }