Example #1
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;
        }
    }
Example #2
0
 private void Start()
 {
     inputPlayer = GetComponent<Inputs>();
     PanelText.SetActive(false);
     PanelLoadBar.SetActive(false);
     TextToUse.text = itemBase.TextUI;
 }
Example #3
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;
    }
Example #4
0
 public override void Drop()
 {
     PanelLoadBar.SetActive(true);
     BarLoad.fillAmount += 1.0f / itemBase.TimeCast * Time.deltaTime;
     if (BarLoad.fillAmount >= 1.0f)
     {
         BarLoad.fillAmount = 1.0f;
         //Poner Inventario
     }
 }
Example #5
0
 public override void Interact()
 {
     PanelLoadBar.SetActive(true);
     BarLoad.fillAmount += 1.0f / itemBase.TimeCast * Time.deltaTime;
     if (BarLoad.fillAmount >= 1.0f)
     {
         BarLoad.fillAmount = 1.0f;
         End = true;
     }
 }
Example #6
0
 public override void Interact()
 {
     Debug.Log("Coger");
     inventory.AddItem(id);
     PanelLoadBar.SetActive(true);
     BarLoad.fillAmount += 3.0f / itemBase.TimeCast * Time.deltaTime;
     if (BarLoad.fillAmount >= 1.0f)
     {
         BarLoad.fillAmount = 1.0f;
         End = true;
     }
 }
Example #7
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;
            }
        }
    }
Example #8
0
    public override void Interact()
    {
        if (ID.canOpen && !opened)
        {
            if (anim == null)
            {
                anim = this.GetComponentInChildren <Animator>();
            }

            PanelLoadBar.SetActive(true);
            BarLoad.fillAmount += 1.0f / itemBase.TimeCast * Time.deltaTime;
            if (BarLoad.fillAmount >= 1.0f)
            {
                BarLoad.fillAmount = 1.0f;
                End = true;
                if (!opened)
                {
                    anim.SetBool("Open", true);

                    if (!Droped)
                    {
                        stats.totalLoot += ID.amount;
                        Droped           = true;

                        if (objetivoscontroller.numeroObjetivo == 6)
                        {
                            objetivoscontroller.numeroObjetivo++;
                        }

                        if (objetivoscontroller.numeroObjetivo == 15)
                        {
                            objetivoscontroller.numeroObjetivo++;
                        }

                        if (ID.ID == 50)
                        {
                            Debug.Log("Delete");
                            inventory.RemoveItem(3);
                        }

                        if (ID.ID == 45)
                        {
                            inventory.RemoveItem(6);
                        }
                    }

                    opened = true;
                }
            }
        }
    }
Example #9
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;
            }
        }
    }
Example #10
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);
 }
Example #11
0
 public override void Interact()
 {
     if (lvlSecurity >= key.lvlSecurity)
     {
         if (this == key.key || MasterKey)
         {
             PanelLoadBar.SetActive(true);
             BarLoad.fillAmount += 3.0f / itemBase.TimeCast * Time.deltaTime;
             if (BarLoad.fillAmount >= 1.0f)
             {
                 BarLoad.fillAmount = 1.0f;
                 End = true;
             }
         }
     }
 }
Example #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;
        }
    }
Example #13
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;
        }
    }
Example #14
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;
                }
            }
        }
    }