Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        public override void UseItem(CharacterEntity character)
        {
            string encryptedName = $"Nieznajomy {character.FormatName.GetHashCode().ToString().Substring(1, 6)}";

            if (character.ItemsInUse.Any(item => ReferenceEquals(item, this)))
            {
                ChatScript.SendMessageToNearbyPlayers(character, "zdejmuje kominiarkę", ChatMessageType.Me);
                character.AccountEntity.Client.Name = character.FormatName;

                // FixMe zmienić na narzędzie do wyświetlania nicków
                // character.Client.ResetNametag();

                character.ItemsInUse.Remove(this);

                if (DbModel.FirstParameter.HasValue && DbModel.FirstParameter.Value == 0)
                {
                    Delete();
                    return;
                }
                Save();
            }
            else if (character.ItemsInUse.All(item => !(item is Mask)))
            {
                ChatScript.SendMessageToNearbyPlayers(character, "zakłada kominiarkę", ChatMessageType.Me);
                character.AccountEntity.Client.Name = encryptedName;

                // FixMe zmienić na narzędzie do wyświetlania nicków
                // character.Client.ResetNametag();

                DbModel.FirstParameter -= 1;
                character.ItemsInUse.Add(this);

                Save();
            }
        }
Ejemplo n.º 2
0
 public void CmdChat(string str)
 {
     RpcChat(str); if (isServer && !isClient)
     {
         ChatScript.ChatLocallyAndLog(str);
     }
 }
Ejemplo n.º 3
0
    public void CmdCreateObj(int clId, Vector3 pos, int objType)    //Sends an order from the client to the server
    {
        int uId = ObjFuncs.GetUniqueId();

        ChatScript.ChatLocally("CreateObj on Sv. uId: " + uId);
        RpcCreateObj(clId, pos, objType, uId);
    }
        public static void Knock(Client player)
        {
            if (!player.HasData("CurrentDoors"))
            {
                return;
            }
            BuildingEntity building = (BuildingEntity)player.GetData("CurrentDoors");

            if (building._spamProtector)
            {
                return;
            }

            building._spamProtector = true;
            CharacterEntity character = player.GetAccountEntity().CharacterEntity;

            ChatScript.SendMessageToNearbyPlayers(character, "unosi dłoń i puka do drzwi budynku", ChatMessageType.ServerMe);
            ChatScript.SendMessageToSpecifiedPlayers(character, building.PlayersInBuilding.Select(x => x.CharacterEntity),
                                                     "Słychać pukanie do drzwi.", ChatMessageType.ServerDo);

            // Ochrona przed spamem w pukaniu do drzwi
            Timer timer = new Timer(4000);

            timer.Start();
            timer.Elapsed += (o, e) =>
            {
                building._spamProtector = false;
                timer.Stop();
                timer.Dispose();
            };
        }
Ejemplo n.º 5
0
 public override void UseItem(CharacterEntity sender)
 {
     if (DbModel.FirstParameter != null)
     {
         ChatScript.SendMessageToNearbyPlayers(sender,
                                               $"wyrzucił {Utils.RandomRange(1, DbModel.FirstParameter.Value)} oczek z {DbModel.FirstParameter} możliwych",
                                               ChatMessageType.ServerMe);
     }
 }
Ejemplo n.º 6
0
 public void OnPlayerAtmGiveHandler(Client sender, params object[] arguments)
 {
     if (decimal.TryParse(arguments[0].ToString(), out decimal money))
     {
         ChatScript.SendMessageToNearbyPlayers(sender.GetAccountEntity().CharacterEntity,
                                               $"wyciąga z bankomatu {(money >= 3000 ? "gruby" : "chudy")} plik gotówki, oraz kartę.", ChatMessageType.ServerMe);
         BankHelper.WithdrawMoney(sender, money);
     }
 }
Ejemplo n.º 7
0
 public void OnPlayerAtmTakeHandler(Client sender, params object[] arguments)
 {
     if (decimal.TryParse(arguments[0].ToString(), out decimal money))
     {
         ChatScript.SendMessageToNearbyPlayers(sender.GetAccountEntity().CharacterEntity,
                                               $"wkłada {(money >= 3000 ? "gruby" : "chudy")} plik gotówki do bankomatu i po przetworzeniu operacji zabiera kartę.", ChatMessageType.ServerMe);
         BankHelper.DepositMoney(sender, money);
     }
 }
Ejemplo n.º 8
0
 public static void ChangeDoorState(CharacterEntity sender, NetHandle vehicle, int doorId)
 {
     if (NAPI.Vehicle.IsVehicleDoorBroken(vehicle, doorId))
     {
         ChatScript.SendMessageToPlayer(sender,
                                        "Drzwi wyglądają na zepsute, nie chcą nawet drgnąć.", ChatMessageType.ServerDo);
         return;
     }
     NAPI.Vehicle.SetVehicleDoorState(vehicle, doorId, !NAPI.Vehicle.GetVehicleDoorState(vehicle, doorId));
 }
Ejemplo n.º 9
0
    public void RpcCreateObj(int clId, Vector3 pos, int objType, int uId)
    {
        //create the object on all clients
        ChatScript.ChatLocally("CreateObj on Cl. uId: " + uId);
        //Trigger local effect
        Effects.CircleBlip(pos, 3, 6, 1);

        //Create the correct object of type
        ObjFuncs.CreateObj((ObjFuncs.Type)objType, pos, Vector3.zero, clId, uId);
    }
Ejemplo n.º 10
0
    public void Start()
    {
        // Поиск скриптов.
        GameObject ScriptsObject = GameObject.Find("Scripts");

        if (ScriptsObject != null)
        {
            panelChat = ScriptsObject.GetComponent <ChatScript>();
        }
        DIALOGS = false;
    }
Ejemplo n.º 11
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Ejemplo n.º 12
0
        public static void StartTransport(CharacterEntity player, decimal cost, int seconds, Vector3 position, string name)
        {
            if (player.DbModel.PlayedTime.Hours > 5 && !player.HasMoney(cost))
            {
                player.SendError("Nie posiadasz wystarczającej ilości gotówki.");
                return;
            }

            player.RemoveMoney(cost);

            // TODO: Zaciemnianie ekranu
            // NAPI.Native.SendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 2000);

            ChatScript.SendMessageToNearbyPlayers(player,
                                                  $"wsiadł do autobusu zmierzającego w stronę {name}", ChatMessageType.ServerMe);

            player.Dimension = ((uint)Dimension.Bus);

            // Teleport po danym czasie
            Timer busTimer = new Timer(seconds * 1000);

            busTimer.Start();
            busTimer.Elapsed += (sender, args) =>
            {
                player.InDbPosition = position;
                // TODO: Odciemnianie ekranu
                // NAPI.Native.SendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 2000); //Odciemnianie ekranu
                player.Dimension = (uint)Dimension.Global;
                ChatScript.SendMessageToNearbyPlayers(player, "wysiadł z autobusu", ChatMessageType.ServerMe);

                busTimer.Stop();
                busTimer.Dispose();
            };

            //TODO: Nie działa - Wyświatla się pod zaciemnionym ekranem
            //Timer shardTimer = new Timer(1000);
            //shardTimer.Start();

            ////Odliczanie czasu do przyjazdu
            //shardTimer.Elapsed += (sender, args) =>
            //{
            //    if (DateTime.Now == arrivalTime)
            //    {
            //        shardTimer.Stop();
            //        shardTimer.Dispose();
            //    }

            //    string secondsToShow = (arrivalTime - DateTime.Now).Seconds.ToString();
            //    if (secondsToShow.Length == 1) secondsToShow = "0" + secondsToShow;
            //    player.TriggerEvent("BWTimerTick",
            //        $"{(arrivalTime - DateTime.Now).Minutes}:{secondsToShow}");
            //};
        }
Ejemplo n.º 13
0
 public void OnMouseDown()
 {
     FadeTag();
     if (chatClicks < 1 && charscript.charClicks < clickableLimit)
     {
         GameObject bubble = (GameObject)Instantiate(chatPrefab, chatSpawn.transform.position, transform.rotation);
         bubble.transform.parent     = overlay.transform;
         bubble.transform.localScale = new Vector3(0.035f, 0.02f, 1);
         ChatScript cs = bubble.GetComponent <ChatScript>();
         cs.WriteBubble(random, randomText, moral, integrity, loyalty, actualization, 0);
         chatClicks++;
         charscript.charClicks++;
     }
 }
Ejemplo n.º 14
0
 public override void UseItem(CharacterEntity character)
 {
     if (character.ItemsInUse.Any(item => ReferenceEquals(item, this)))
     {
         character.ItemsInUse.Remove(this);
         Save();
         ChatScript.SendMessageToNearbyPlayers(character, $"wyłącza {DbModel.Name}", ChatMessageType.ServerMe);
         character.SendInfo($"Telefon {DbModel.Name} został wyłączony.");
     }
     else if (character.ItemsInUse.All(item => !(item is Cellphone)))
     {
         character.ItemsInUse.Add(this);
         ChatScript.SendMessageToNearbyPlayers(character, $"włącza {DbModel.Name}", ChatMessageType.ServerMe);
         character.SendInfo($"Telefon {DbModel.Name} został włączony naciśnij klawisz END, aby go używać.");
     }
 }
Ejemplo n.º 15
0
        public void OnPlayerTelephoneBoothCallHandler(Client sender, params object[] args)
        {
            CharacterEntity senderCharacter = sender.GetAccountEntity().CharacterEntity;

            if (senderCharacter.CurrentInteractive is TelephoneBoothEntity boothEntity)
            {
                //args[0] to numer na jaki dzwoni
                if (senderCharacter.HasMoney(boothEntity.Data.Cost))
                {
                    senderCharacter.RemoveMoney(boothEntity.Data.Cost);
                    ChatScript.SendMessageToNearbyPlayers(senderCharacter, "wrzuca monetę do automatu i wybiera numer", ChatMessageType.ServerMe);

                    CharacterEntity getterCharacter = EntityHelper.GetAccounts()
                                                      .FirstOrDefault(t => t.CharacterEntity?.CurrentCellphone.Number ==
                                                                      Convert.ToInt32(args[0]))
                                                      ?.CharacterEntity;

                    if (getterCharacter == null)
                    {
                        sender.SendChatMessage("~#ffdb00~",
                                               "Wybrany abonent ma wyłączony telefon bądź znajduje się poza zasięgiem spróbuj później.");
                        return;
                    }

                    if (getterCharacter.CurrentCellphone.CurrentCall != null)
                    {
                        sender.SendChatMessage("~#ffdb00~",
                                               "Wybrany abonent prowadzi obecnie rozmowę. Spróbuj później.");
                        return;
                    }

                    boothEntity.CurrentCall = new TelephoneCall(senderCharacter, getterCharacter, boothEntity.Data.Number);

                    boothEntity.CurrentCall.Timer.Elapsed += (o, eventArgs) =>
                    {
                        sender.SendChatMessage("~#ffdb00~",
                                               "Wybrany abonent ma wyłączony telefon, bądź znajduje się poza zasięgiem, spróbuj później.");
                        boothEntity.CurrentCall.Dispose();
                        boothEntity.CurrentCall = null;
                    };
                }
            }
            else
            {
                sender.SendError("Nie posiadasz wystarczającej ilości gotówki.");
            }
        }
Ejemplo n.º 16
0
    // Use this for initialization
    void Start()
    {
        chatscript = GameObject.FindGameObjectWithTag ("ChatBox").GetComponent<ChatScript> ();
        showPurchaseUI = false;
        toggle = false;

        //playerInventory = gameObject.Find("Player").GetComponent(Inventory_GUI)
        Text[] texts = canvas.GetComponentsInChildren<Text>();
        for (int i = 0; i < texts.Length; i++)
        {
            texts[i].enabled = false;
        }
        Image[] images = canvas.GetComponentsInChildren<Image>();
        for (int i = 0; i < images.Length; i++)
        {
            images[i].enabled = false;
        }
    }
Ejemplo n.º 17
0
    public void CmdCreateObj(int clId, Vector3 pos, int objType)    //Sends an order from the client to the server
    {
        Debug.Log("Trying to buy " + (ObjFuncs.Type)objType);
        //Can the player afford this object?
        hl.Peer p = hl.GetPeerForUID(clId);
        if (p == null)
        {
            Debug.Log("Peer (" + clId + ") was null, failed to buy " + (ObjFuncs.Type)objType); return;
        }                                                                                                                     //Make sure the peer still exists
        if (!ObjFuncs.CheckCost((ObjFuncs.Type)objType, p))
        {
            Debug.Log("Couldnt afford " + (ObjFuncs.Type)objType); return;
        }                                                 //Make sure they can afford this obj

        ObjFuncs.SubtractCost((ObjFuncs.Type)objType, p); //Spend the money to buy this object

        hl.uIds++;                                        //Only ever do this on the server
        int uId = hl.uIds;

        ChatScript.ChatLocally("CreateObj on Sv. uId: " + uId);
        RpcCreateObj(clId, pos, objType, uId);
    }
Ejemplo n.º 18
0
    void Update()
    {
        if (isLocalPlayer)
        {
            if (Input.GetKeyDown(KeyCode.G))
            {
                ChatScript.ChatLocally("G key pressed! " + hl.local_uId);
            }

            Cl_Orders.InputOrders();            //detect keyboard & mouse input, as orders, and send them to the server
        }

        if (isServer)
        {
            hl.svTime = Time.realtimeSinceStartup; //This is the server. Update this every frame
            ServerSideLoop.UpdateServer();
            Ticks.HandleTicks();                   //Send out ticks
        }

        if (isClient)
        {
            ClientSideLoop.UpdateClient();
        }
    }
Ejemplo n.º 19
0
 public void GetChatScript(ChatScript chat)
 {
     chatScript = chat;
 }
Ejemplo n.º 20
0
        public void Trade(bool bank)
        {
            if (Getter.HasMoney(Money, bank))
            {
                if (_moneyToGroup && Sender.OnDutyGroup == null)
                {
                    Sender.SendInfo("Musisz znajdować się na służbie grupy.");
                    return;
                }

                if (ItemModel != null)
                {
                    ChatScript.SendMessageToNearbyPlayers(Sender,
                                                          $"{Sender.FormatName} podaje przedmiot {Getter.FormatName}",
                                                          ChatMessageType.ServerMe);

                    ItemModel.Character = Getter.DbModel;

                    RoleplayContext ctx = Singletons.RoleplayContextFactory.Create();
                    using (ItemsRepository repository = new ItemsRepository(ctx))
                    {
                        repository.Update(ItemModel);
                        repository.Save();
                    }
                }
                else if (Vehicle != null)
                {
                    ChatScript.SendMessageToNearbyPlayers(Sender,
                                                          $"{Sender.FormatName} podaje klucze {Getter.FormatName}",
                                                          ChatMessageType.ServerMe);

                    Vehicle.Character = Getter.DbModel;

                    RoleplayContext ctx = Singletons.RoleplayContextFactory.Create();
                    using (VehiclesRepository repository = new VehiclesRepository(ctx))
                    {
                        repository.Update(Vehicle);
                        repository.Save();
                    }
                }
                else if (Building != null)
                {
                    ChatScript.SendMessageToNearbyPlayers(Sender,
                                                          $"{Sender.FormatName} podaje klucze {Getter.FormatName}",
                                                          ChatMessageType.ServerMe);

                    Building.Character = Getter.DbModel;

                    RoleplayContext ctx = Singletons.RoleplayContextFactory.Create();
                    using (BuildingsRepository repository = new BuildingsRepository(ctx))
                    {
                        repository.Update(Building);
                        repository.Save();
                    }
                }

                if (_moneyToGroup)
                {
                    Sender.OnDutyGroup.AddMoney(Money);
                }
                else
                {
                    Sender.AddMoney(Money, bank);
                }

                Getter.RemoveMoney(Money, bank);

                _action?.Invoke(Getter);
            }
            else
            {
                Getter.SendWarning(bank
                    ? "Nie posiadasz wystarczającej ilości środków na karcie"
                    : "Nie posiadasz wystarczającej ilości gotówki.");
                Sender.SendError("Wymiana zakończona niepowodzeniem.");
            }
        }
Ejemplo n.º 21
0
 public void RpcChat(string str)
 {
     ChatScript.ChatLocallyAndLog(str);
 }
Ejemplo n.º 22
0
    public static List <ObjFuncs.Obj> gridObjs; //Objs that the dragged object is checking against their grids

    public static void InputOrders()            //Called every frame from hl.HlObj Update
    {
        //There is a generic way to do this, but for now, I'm just going to handle each case

        //Make sure that the connection isn't null
        if (hl.hlObj == null)
        {
            return;
        }

        //Get mouse pos in the world
        Vector3    mousePos = Vector3.zero;
        Ray        ray      = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 999, xa.de.toHitFloorMask))
        {
            mousePos = hit.point;
        }

        MouseOrders mouseOrder = MouseOrders.None;

        if (Input.GetMouseButtonDown(0))        //Left click - Drag selection
        {
            //start dragging a selection box
            mouseOrder = MouseOrders.SelectionBox_StartDragging;
        }
        if (Input.GetMouseButtonUp(0))        //Left click up, release dragged object or stop selection box?
        {
            //I wasn't dragging an obj, so I must have been dragging a selection box
            mouseOrder = MouseOrders.SelectionBox_StopDragging;
        }
        SelectionScript.HandleSelection(mouseOrder);        //Handles local selection box

        //Issue a move command to all selected units of the correct player
        if (Input.GetMouseButtonDown(1))        //Move order
        {
            //Send the order to the server. Fire and forget!
            ObjFuncs.Obj o;

            //send one order per unit ordered.
            List <int> result = new List <int>();
            for (int i = 0; i < ObjFuncs.objs.Count; i++)
            {
                o = ObjFuncs.objs[i];
                if (o.isUnit && o.ownedByClId == hl.local_uId && o.selected)
                {
                    result.Add(o.uId);
                }
            }
            int[] unitIds = new int[result.Count];
            for (int i = 0; i < result.Count; i++)
            {
                unitIds[i] = result[i];
            }                                                                             //write to the array

            hl.hlObj.CmdMoveOrder(hl.local_uId, mousePos, unitIds);

            //Trigger local effect
            Effects.MoveOrderEffect(mousePos);
        }

        //This is currently hardwired to specific keys, but later players will be able to rebind.
        if (Input.GetKeyDown(KeyCode.Alpha1))        //Create a command pod!
        {
            ChatScript.ChatLocally("Detected local createObj order: Marine");
            //Send the order to the server
            hl.hlObj.CmdCreateObj(hl.local_uId, mousePos, (int)ObjFuncs.Type.Marine);

            //Trigger local effect
            //Effects.CircleBlip(mousePos, 5, 5);
        }
    }
Ejemplo n.º 23
0
    public static List <ObjFuncs.Obj> gridObjs; //Objs that the dragged object is checking against their grids

    public static void InputOrders()            //Called every frame from hl.HlObj Update
    {
        //There is a generic way to do this, but for now, I'm just going to handle each case

        //Make sure that the connection isn't null
        if (hl.hlObj == null)
        {
            return;
        }

        //Get mouse pos in the world
        Vector3    mousePos = Vector3.zero;
        Ray        ray      = xa.de.globalMainCam.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 999, xa.de.toHitFloorMask))
        {
            mousePos = hit.point;
        }

        MouseOrders mouseOrder = MouseOrders.None;

        if (Input.GetMouseButtonDown(0))        //Left click - Drag selection or drag object?
        {
            //is the mouse over a object that can be dragged?
            draggingObj = -1;
            ray         = xa.de.globalMainCam.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out hit, 999, xa.de.toHitDraggableObjs))
            {
                //An obj is under the mouse,
                int uId   = hit.collider.gameObject.GetComponent <HitboxScript>().go.GetComponent <Info>().uId;
                int index = ObjFuncs.GetObjIndexForUID(uId);

                //can it be dragged?
                if (!ObjFuncs.objs[index].isUnit && ObjFuncs.objs[index].attachedTo == -1)
                {
                    mouseOrder  = MouseOrders.DraggingObj_Start;
                    draggingObj = uId;
                    ObjFuncs.PickingUpAnObj(draggingObj);
                }
            }


            if (draggingObj == -1)
            {
                //No object under my mouse, so start dragging a selection box
                mouseOrder = MouseOrders.SelectionBox_StartDragging;
            }
        }
        if (Input.GetMouseButtonUp(0))        //Left click up, release dragged object or stop selection box?
        {
            if (draggingObj != -1)            //I was dragging an obj. Drop it.
            {
                //Dropping an object
                mouseOrder = MouseOrders.DraggingObj_Stop;

                ObjFuncs.DroppingAnObj(draggingObj);

                draggingObj = -1;
            }
            else
            {
                //I wasn't dragging an obj, so I must have been dragging a selection box
                mouseOrder = MouseOrders.SelectionBox_StopDragging;
            }
        }
        if (draggingObj != -1)        //Dragging an object
        {
            int index = ObjFuncs.GetObjIndexForUID(draggingObj);
            ObjFuncs.objs[index].go.transform.SetX(mousePos.x);
            ObjFuncs.objs[index].go.transform.SetZ(mousePos.z);

            ObjFuncs.objs[index].visualState[0] = 0;
            int result = ObjFuncs.IfOverValidPos(draggingObj);
            if (result != -1)
            {
                //change color
                ObjFuncs.objs[index].visualState[0] = 1;

                //Align to the possible gridObj's angle
                int gridObjIndex = ObjFuncs.GetObjIndexForUID(result);
                ObjFuncs.objs[index].desiredAngle = ObjFuncs.objs[gridObjIndex].go.transform.localEulerAngles.y;
            }

            //snap to this (tween later)
            ObjFuncs.objs[index].go.transform.SetAngY(ObjFuncs.objs[index].desiredAngle + ObjFuncs.objs[index].gridObjAnglesOffset);

            //detect if the player wants to rotate this object
            if (Input.GetKeyDown(KeyCode.Q))            //Rotate the object
            {
                ObjFuncs.objs[index].gridObjAnglesOffset -= 90;
            }
            if (Input.GetKeyDown(KeyCode.E))            //Rotate the object
            {
                ObjFuncs.objs[index].gridObjAnglesOffset += 90;
            }
        }

        SelectionScript.HandleSelection(mouseOrder);        //Handles local selection box

        //Issue a move command to all selected units of the correct player
        if (Input.GetMouseButtonDown(1))        //Move order
        {
            //Send the order to the server. Fire and forget!
            ObjFuncs.Obj o;

            //send one order per unit ordered.
            List <int> result = new List <int>();
            for (int i = 0; i < ObjFuncs.objs.Count; i++)
            {
                o = ObjFuncs.objs[i];
                if (o.isUnit && o.ownedByClId == hl.local_uId && o.selected)
                {
                    result.Add(o.uId);
                }
            }
            int[] unitIds = new int[result.Count];
            for (int i = 0; i < result.Count; i++)
            {
                unitIds[i] = result[i];
            }                                                                             //write to the array

            hl.hlObj.CmdMoveOrder(hl.local_uId, mousePos, unitIds);

            //Trigger local effect
            Effects.MoveOrderEffect(mousePos);
        }

        //This is currently hardwired to specific keys, but later players will be able to rebind.
        if (Input.GetKeyDown(KeyCode.Alpha1))        //Create a command pod!
        {
            ChatScript.ChatLocally("Detected local createObj order: Command Pod");
            //Send the order to the server
            hl.hlObj.CmdCreateObj(hl.local_uId, mousePos, (int)ObjFuncs.Type.CommandPod);

            //Trigger local effect
            //Effects.CircleBlip(mousePos, 5, 5);
        }
        if (Input.GetKeyDown(KeyCode.Alpha2))        //Create a hull block
        {
            ChatScript.ChatLocally("Detected local createObj order: Hull Block");
            //Send the order to the server
            hl.hlObj.CmdCreateObj(hl.local_uId, mousePos, (int)ObjFuncs.Type.HullBlock);

            //Trigger local effect
            //Effects.CircleBlip(mousePos, 5, 5);
        }
        if (Input.GetKeyDown(KeyCode.Alpha3))        //Create an engine
        {
            ChatScript.ChatLocally("Detected local createObj order: Engine");
            //Send the order to the server
            hl.hlObj.CmdCreateObj(hl.local_uId, mousePos, (int)ObjFuncs.Type.Engine);

            //Trigger local effect
            //Effects.CircleBlip(mousePos, 5, 5);
        }
        if (Input.GetKeyDown(KeyCode.Alpha4))        //Create a gun
        {
            ChatScript.ChatLocally("Detected local createObj order: Gun");
            //Send the order to the server
            hl.hlObj.CmdCreateObj(hl.local_uId, mousePos, (int)ObjFuncs.Type.Gun);

            //Trigger local effect
            //Effects.CircleBlip(mousePos, 5, 5);
        }
    }
Ejemplo n.º 24
0
 // Use this for initialization
 void Awake()
 {
     chatscript = GameObject.FindGameObjectWithTag ("ChatBox").GetComponent<ChatScript> ();
     currentCash = startingCash;
     numOfPotions = 0;
     playerAudio = GetComponent <AudioSource> ();
     GameObject feedbackObject = GameObject.FindGameObjectWithTag("Feedback");
     feedback = feedbackObject.GetComponent<Text>();
     player = GameObject.FindGameObjectWithTag("Player");
     potionUI = GameObject.FindGameObjectWithTag("potion-number");
     playerHealth = player.GetComponent<PlayerHealth>();
 }
Ejemplo n.º 25
0
 public override void UseItem(CharacterEntity sender)
 {
     ChatScript.SendMessageToNearbyPlayers(sender, $"spogląda na zegarek {DbModel.Name}", ChatMessageType.Me);
     sender.SendInfo($"Godzina: {DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second}");
 }
 private void SendFailMessage()
 {
     ChatScript.SendMessageToNearbyPlayers(Seller, "szuka narkotyku w swoim otoczeniu, błądzi wzrokiem.", ChatMessageType.ServerMe);
     SendMessageToNerbyPlayers($"popatrzył się na {Seller.FormatName} jak na debila.", ChatMessageType.ServerMe);
 }
Ejemplo n.º 27
0
 public override void UseItem(CharacterEntity sender)
 {
     ChatScript.SendMessageToNearbyPlayers(sender, $"zjada {DbModel.Name}", ChatMessageType.ServerMe);
     sender.Health += Convert.ToByte(HealthToRestore);
     Delete();
 }