Esempio n. 1
0
        public IActionResult SendMail([FromBody] Temp temp)
        {
            OtherMetods oth = new OtherMetods();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (_usersService.GetForMailTemp(temp.Mail) != null)
            {
                return(BadRequest(new { error = "Mail already in use" }));
            }

            temp.Password = oth.RandomString();
            _usersService.SendMail(temp);
            oth.SendMail(temp);

            string accessToken = JWTAuth.GenerateToken(temp);

            return(new ObjectResult(new
            {
                temp.Mail,
                temp.Password,
                access_token = accessToken
            }));
        }
Esempio n. 2
0
 //SLOT
 //----------------------------------------
 public void setIsControll(SendMessage_CamPos_And_PlayerPos mess)
 {
     isControll = true;
     cam        = mess.cam;
     OtherMetods.camTransformParent_camDropSettings(cam, cameraContainer);
     StartCoroutine("delayPressKeyE", 1f);
     transform.position = mess.player.transform.position;
 }
Esempio n. 3
0
        //Raycast
        //----------------------------------------
        private void checkForwardRaycst()
        {
            RaycastHit hit;
            Ray        cameraRay = cam.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(cameraRay, out hit, 2.0f))
            {
                if (hit.collider.tag == "VehicleDoor")
                {
                    interfaceViews.checkRaycast.SetActive(true);
                    interfaceViews.checkRaycast.GetComponent <UnityEngine.UI.Text>().text = "Press E to seat";
                    if (Input.GetKeyUp(KeyCode.E) && nextPressKeyE)
                    {
                        isControll = false;
                        gameObject.SetActive(false);

                        GameObject obj = OtherMetods.FindParent(hit.collider.transform, "Entitys").gameObject;
                        obj.SendMessage("setIsControll", new SendMessage_CamPos_And_PlayerPos(cam, gameObject));
                    }
                }
                else if (hit.collider.tag == "Turret")
                {
                    interfaceViews.checkRaycast.SetActive(true);
                    interfaceViews.checkRaycast.GetComponent <UnityEngine.UI.Text>().text = "Press E to activate";
                    if (Input.GetKeyUp(KeyCode.E) && nextPressKeyE)
                    {
                        OtherMetods.FindParent(hit.collider.transform, "Entitys").SendMessage("setActive");
                        StartCoroutine("delayPressKeyE", 0.5f);
                    }
                }
                else if (hit.collider.tag == "Chest")
                {
                    interfaceViews.checkRaycast.SetActive(true);
                    interfaceViews.checkRaycast.GetComponent <UnityEngine.UI.Text>().text = "Press E to open Inventory";
                    if (Input.GetKeyUp(KeyCode.E) && nextPressKeyE)
                    {
                        OpenInventory(true);
                        isControll = false;
                        GameObject obj = hit.collider.gameObject;
                        obj.gameObject.SendMessage("OpenChest", gameObject);
                        inventoryExchangeItems.anotherInventory = obj;
                    }
                }
                else if (interfaceViews.checkRaycast.activeSelf)
                {
                    interfaceViews.checkRaycast.SetActive(false);
                }
            }
            else if (interfaceViews.checkRaycast.activeSelf)
            {
                interfaceViews.checkRaycast.SetActive(false);
            }
        }
Esempio n. 4
0
        //Inventory
        //----------------------------------------

        private void take_Or_Place_Item()
        {
            Ray cameraRay = cam.ScreenPointToRay(Input.mousePosition);

            if (Input.GetMouseButtonDown(0))
            {
                RaycastHit[] hits;
                hits = Physics.RaycastAll(cameraRay, 2f);
                foreach (RaycastHit hit in hits)
                {
                    if (hit.collider.tag == "Block" || hit.collider.tag == "Vehicles" || hit.collider.tag == "Turret" || hit.collider.tag == "Chest")
                    {
                        Transform parent = hit.collider.transform;
                        if (hit.collider.tag != "Block")
                        {
                            parent = OtherMetods.FindParent(hit.collider.transform, "Entitys");
                        }
                        if (parent == null)
                        {
                            return;
                        }

                        int idItem = Id.getId(parent.name);

                        ItemInventory item = new ItemInventory(idItem, 1, Id.TypeItem.None);

                        if (hit.collider.tag == "Block")
                        {
                            item.type = Id.TypeItem.Block;
                        }
                        else
                        {
                            item.type = Id.TypeItem.Entity;
                        }

                        inventoryExchangeItems.inventory.AddItemInventory(item);

                        Destroy(parent.gameObject);
                        break;
                    }
                }
            }
            else if (Input.GetMouseButtonDown(1))
            {
                if (inventoryExchangeItems.inventory.arrItems[inventoryExchangeItems.inventory.currentItemToolbar].count > 0)
                {
                    RaycastHit hit;
                    Ray        ray = new Ray(cam.transform.position, cameraRay.direction * 2f);

                    ItemInventory item = inventoryExchangeItems.inventory.arrItems[inventoryExchangeItems.inventory.currentItemToolbar];

                    if (item.count > 0 && item.type != Id.TypeItem.None)
                    {
                        switch (item.type)
                        {
                        case Id.TypeItem.Block:
                        {
                            if (Physics.Raycast(ray, out hit, 2f))
                            {
                                int x, y, z;
                                x = Mathf.RoundToInt(hit.point.x);
                                y = Mathf.RoundToInt(hit.point.y);
                                z = Mathf.RoundToInt(hit.point.z);
                                if (hit.point.x % 0.5 == 0)
                                {
                                    if (transform.position.x < hit.point.x)
                                    {
                                        if (x != (int)hit.point.x)
                                        {
                                            x--;
                                        }
                                    }
                                    else
                                    {
                                        if (x != (int)hit.point.x + 1)
                                        {
                                            x++;
                                        }
                                    }
                                }
                                if (hit.point.y % 0.5 == 0)
                                {
                                    if (cam.transform.position.y < hit.point.y)
                                    {
                                        if (y != (int)hit.point.y)
                                        {
                                            y--;
                                        }
                                    }
                                    else
                                    {
                                        if (y != (int)hit.point.y + 1)
                                        {
                                            y++;
                                        }
                                    }
                                }
                                if (hit.point.z % 0.5 == 0)
                                {
                                    if (transform.position.z < hit.point.z)
                                    {
                                        if (z != (int)hit.point.z)
                                        {
                                            z--;
                                        }
                                    }
                                    else
                                    {
                                        if (z != (int)hit.point.z + 1)
                                        {
                                            z++;
                                        }
                                    }
                                }

                                MyTerrain.CreateBlock(item.id, new Vector3(x, y, z));
                            }
                            break;
                        }

                        case Id.TypeItem.Entity:
                        {
                            Vector3 pos = transform.position + transform.forward * 5;
                            MyTerrain.CreateEntity(item.id, pos, transform.rotation);
                            break;
                        }
                        }
                        inventoryExchangeItems.inventory.arrItems[inventoryExchangeItems.inventory.currentItemToolbar].count--;
                        if (inventoryExchangeItems.inventory.arrItems[inventoryExchangeItems.inventory.currentItemToolbar].count == 0)
                        {
                            inventoryExchangeItems.inventory.arrItems[inventoryExchangeItems.inventory.currentItemToolbar].type = Id.TypeItem.None;
                            inventoryExchangeItems.inventory.arrItems[inventoryExchangeItems.inventory.currentItemToolbar].id   = -1;
                        }
                    }
                }
            }
        }