Exemplo n.º 1
0
        public Account(string username, string password, byte charecterType)
        {
            numberOfAccounts = numberOfAccounts + 1;

            this.username = username;
            this.password = password;

            isOpen = false;

            this.charecterType = charecterType;

            if (charecterType == 1)
            {
                avatar = @".\Images\Charecters\Youssef\Down\Down2.png";
            }
            if (charecterType == 2)
            {
                avatar = @".\Images\Charecters\Moataz\Down\Down2.png";
            }
            if (charecterType == 3)
            {
                avatar = @".\Images\Charecters\Hoda\Down\Down2.png";
            }

            player = new OtherPlayer(815, 413, 0, 0, false, 0, 0, username, avatar, 0, charecterType);
        }
Exemplo n.º 2
0
        public void OnPlayerMove(NFDataList valueList)
        {
            NFGUID tar = valueList.ObjectVal(0);

            if (tar == mPlayerModule.mRoleID)
            {
                return;
            }

            GameObject  player      = GetObject(tar);
            OtherPlayer otherPlayer = player.GetComponent <OtherPlayer>();

            double    fSpeed = valueList.FloatVal(1);
            long      nType  = valueList.IntVal(2);
            NFVector3 pos    = valueList.Vector3Val(3);
            Vector3   vPos   = new Vector3(pos.X(), pos.Y(), pos.Z());

            if (nType > 0)
            {
                otherPlayer.JumpTo(vPos);
            }
            else
            {
                otherPlayer.MoveTo((float)fSpeed, vPos);
            }

            Debug.Log("Player Move:" + vPos.ToString());
        }
Exemplo n.º 3
0
        void BeginGame()
        {
            buttonChangeGameState.Text = "Try again";
            buttonReset.Visible        = false;
            buttonFillRandom.Visible   = false;

            // Init other player
            if (gameMode == GameMode.default_)
            {
                gameMode = GameMode.bot;
            }
            if (gameMode == GameMode.bot)
            {
                // Field for bot
                var fieldEnemyAlly = new Field();
                fieldEnemyAlly.Init(fieldSize, Player.ally, true);
                otherPlayer = new Bot(Level.easy, fieldEnemyAlly, this);
                setGameState(GameState.WaitPlayerChoise);
            }
            else if (gameMode == GameMode.server)
            {
                setGameState(GameState.WaitConnection);
                otherPlayer = new Server(this);
                var thr = new Thread(new ThreadStart((otherPlayer as Server).WaitConnection));
                thr.Start();
                // Server is first player
            }
            else if (gameMode == GameMode.client)
            {
                otherPlayer = new Client(textBoxIpAddress.Text, this);
                setGameState(GameState.WaitOtherPlayerPos);
            }
        }
Exemplo n.º 4
0
 private void BalanceCards(GameObject cardsContainer, OtherPlayer player, int diff, bool rotate)
 {
     //If there are more cards visually then the player has, remove the difference in card count
     if (diff < 0)
     {
         for (int i = 0; i < Math.Abs(diff); i++)
         {
             Destroy(cardsContainer.transform.GetChild(0).gameObject);
         }
         //Otherwise just add extra cards for each
     }
     else if (diff > 0)
     {
         for (int i = 0; i < diff; i++)
         {
             var card = Instantiate(cardPrefab).GetComponent <CardDisplay>();
             card.OnSelect.AddListener(playingField.OnCardSelect);
             card.ForceFlipCard();
             card.name = "Card " + Extensions.UniqueID;
             card.transform.SetParent(cardsContainer.transform, false);
             if (rotate)
             {
                 card.transform.rotation = Quaternion.Euler(0, 0, 90);
             }
             card.LockCard(false);
         }
     }
 }
Exemplo n.º 5
0
    /// <summary>
    /// 创建净数据对象
    /// </summary>
    /// <param name="_id"></param>
    /// <returns></returns>
    public static OtherPlayer CreateDummy(OtherPlayerInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyOpcPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject;
            newGO.name = "Dummy OPC [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy OPC[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Player";
        if (_info.IsActor)
        {
            newGO.SetMaskLayer(LayerMask.NameToLayer("CGPlayer"));
        }
        else
        {
            newGO.SetMaskLayer(LayerMask.NameToLayer("OtherPlayer"));
        }
        OtherPlayer newOPC = newGO.AddComponent <OtherPlayer>();

        newOPC.isDummy_  = true;
        newOPC.moveFSM   = newGO.AddComponent <ActorMoveFSM>();
        newOPC.id        = _info.ServerInstanceID;
        newOPC.actorInfo = _info;

        if (_info.Movespd != 0)
        {
            newOPC.curMoveSpeed = (float)newOPC.actorInfo.StaticSpeed * (float)_info.Movespd / 100f;        //由c002获得
        }
        else
        {
            newOPC.curMoveSpeed = newOPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE;
        }
        //Debug.Log("_info.Movespd:" + _info.Movespd + ",newOPC.actorInfo.StaticSpeed:" + newOPC.actorInfo.StaticSpeed);
        newOPC.CurRealSpeed = newOPC.curMoveSpeed;
        newOPC.RegistMoveEvent(true);
        newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0);
        GameCenter.curGameStage.PlaceGameObjectFromServer(newOPC, _info.ServerPos.x, _info.ServerPos.z, (int)newOPC.transform.localEulerAngles.y);
        GameCenter.curGameStage.AddObject(newOPC);
        if (!newOPC.actorInfo.IsActor) //过场动画演员不展示名字
        {
            newOPC.height       = newOPC.actorInfo.NameHeight;
            newOPC.nameHeight   = newOPC.height;
            newOPC.headTextCtrl = newOPC.gameObject.AddComponent <HeadTextCtrl>();
            newOPC.headTextCtrl.SetRelationship(newOPC.GetRelationship());
            newOPC.headTextCtrl.SetRelationColor(newOPC.GetRelationshipColor());
            newOPC.headTextCtrl.SetName("[b]" + (newOPC.actorInfo.Name));
            newOPC.headTextCtrl.SetGuildName(newOPC.actorInfo.GuildName);
            newOPC.headTextCtrl.SetTitleSprite(newOPC.actorInfo.TitleIcon);
            newOPC.InitNameColor();
        }
        return(newOPC);
    }
Exemplo n.º 6
0
    private static void createOtherPlayer(PlayerData player)
    {
        PackedScene nOtherScene = (PackedScene)ResourceLoader.Load($"res://prefabs/OtherPlayer.tscn");
        OtherPlayer otherPlayer = nOtherScene.Instance() as OtherPlayer;

        SceneManager.GetInstance().GetTree().Root.GetNodeOrNull(SceneManager.CurrentMapScenePath).CallDeferred("add_child", otherPlayer);
        otherPlayer.Init(player);
        visiblePlayers.Add(otherPlayer);
    }
 public override string GetDescription()
 {
     return(String.Format(
                "{0}: SHARE_KNOWLEDGE | GIVE {1} to {2}",
                Player.ToString(),
                CityCardToGive.ToString(),
                OtherPlayer.ToString()
                ));
 }
Exemplo n.º 8
0
    void teleportToPlayer(string input)
    {
        OtherPlayer otherPlayer = this.otherPlayerList.Find(x => x.getName().Equals(input));

        if (otherPlayer != null)
        {
            this.ownPlayer.transform.position = otherPlayer.getPosition();
        }
    }
 public override string GetDescription()
 {
     return(String.Format(
                "{0}: SHARE_KNOWLEDGE_TAKE {1} FROM RESEARCHER: {2}",
                Player.ToString(),
                CityCardToTake.ToString(),
                OtherPlayer.ToString()
                ));
 }
Exemplo n.º 10
0
 void deletePlayer(int playerId)
 {
     if (otherPlayers.ContainsKey(playerId))
     {
         OtherPlayer optionsOtherPlayer = otherPlayers[playerId].GetComponent <OtherPlayer>();
         playersInCells[Mathf.FloorToInt(optionsOtherPlayer.newX), Mathf.FloorToInt(optionsOtherPlayer.newY)].Remove(otherPlayers[playerId]);
         Destroy(otherPlayers[playerId]);
         otherPlayers.Remove(playerId);
     }
 }
Exemplo n.º 11
0
        private void otherLeft(PlayerData obj)
        {
            //List<OtherPlayer> others = this.Components
            //OtherPlayer playerGone = (OtherPlayer)this.Components.FirstOrDefault(c => c.GetType() == typeof(OtherPlayer));
            OtherPlayer playerGone = (OtherPlayer)this.Components.FirstOrDefault(c => c.GetType() == typeof(OtherPlayer));

            if (playerGone != null)
            {
                this.Components.Remove(playerGone);
            }
        }
Exemplo n.º 12
0
        public static void updateDatabase(Account account, OtherPlayer player)
        {
            Console.WriteLine("Updating database");

            lock (_lock)
            {
                accessDatabase(3, account.username, player);
            }

            Console.WriteLine("Database updated successfully");
        }
Exemplo n.º 13
0
    protected void OnClickNearbyPlayerBtn(GameObject go)
	{
        curNearbyPlayerInfo = UIEventListener.Get(go).parameter as OtherPlayerInfo;
        if (btnParent != null) btnParent.gameObject.SetActive(true);
        if (curNearbyPlayerInfo != null)
        {
            OtherPlayer other = GameCenter.curGameStage.GetOtherPlayer(curNearbyPlayerInfo.ServerInstanceID);
            if (GameCenter.curMainPlayer != null && other != null)
                GameCenter.curMainPlayer.CurTarget = other;
        }
	}
Exemplo n.º 14
0
        static void Brodcast(NetIncomingMessage msg)
        {
            OtherPlayer          player = Package.MsgToOtherPlayers(msg);
            List <NetConnection> all    = server.Connections; // Listar alla spelare

            all.Remove(msg.SenderConnection);
            NetOutgoingMessage om = server.CreateMessage();

            om.Write(Constants.PlayerUpdate);
            Package.PlayerToOm(om, player);
            server.SendMessage(om, all, NetDeliveryMethod.UnreliableSequenced, 0);
        }
Exemplo n.º 15
0
 public void CreateLobbyPlayer(string playerID)
 {
     if (playerID == GameFramework.Instance.MyPlayer.PlayerID)
     {
         this.lobbyPlayers.Add(CreateLobbyPlayer(GameFramework.Instance.MyPlayer));
     }
     else
     {
         Player otherPlayer = new OtherPlayer();
         otherPlayer.Initialize();
         otherPlayer.PlayerID = playerID;
         this.lobbyPlayers.Add(CreateLobbyPlayer(otherPlayer));
     }
 }
Exemplo n.º 16
0
 private void otherMovedClient(string playerID, Position newPosition)
 {
     //Iterate through all the other player components, then check to see the correct id and type...
     foreach (var player in Components)
     {
         if (player.GetType() == typeof(OtherPlayer) && ((OtherPlayer)player).opData.playerID == playerID)
         {
             OtherPlayer p = ((OtherPlayer)player);
             p.opData.playerPosition = newPosition;
             p.Position = new Point(p.opData.playerPosition.X, p.opData.playerPosition.Y);
             break;
             //Break out of the only one player position is updated and its found...
         }
     }
 }
Exemplo n.º 17
0
 public void SetPlayerName(byte playersID, string name)
 {
     if (players[playersID] == null)
     {
         players[playersID]            = new OtherPlayer();
         players[playersID].PlayerName = name;
     }
     else
     {
         if (players[playersID].PlayerName != name)
         {
             players[playersID].PlayerName = name;
         }
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// 接收
 /// </summary>
 void SocketReceive()
 {
     //进入接收循环
     while (true)
     {
         //对data清零
         recvData = new byte[1024];
         //获取客户端,获取客户端数据,用引用给客户端赋值
         recvLen = socket.ReceiveFrom(recvData, ref ep);
         //接收到一个包
         dpget = ((DgramPlayer)ConvertHelper.ByteToStructure(recvData));
         if (dpget.IP == MyIP)
         {
             continue;
         }
         else if (PlayerList.ContainsKey(dpget.IP))
         {
             //伤害数据包
             if (dpget.damage != 0 && MyIP == dpget.damageIP)
             {
                 MPlayerInfo.getins().damage(dpget.damage);
             }
             else
             {
                 //解析
                 OtherPlayer temp = PlayerList[dpget.IP];
                 GameObject  p    = temp.gobj;
                 temp.pos   = dpget.getpos();
                 temp.rot   = dpget.getrot();
                 temp.speed = dpget.speed;
                 //hp
                 temp.UpdateHp(dpget.HP);
                 //gun
                 temp.GunManage(dpget.getgunrot(), dpget.shooting);
             }
         }
         else
         {
             //加入
             //由于主线程才能使用unity的api,把添加用户的逻辑交给update;
             lock (currentjoin)
             {
                 currentjoin.join = true;
                 currentjoin.IP   = dpget.IP;
             }
         }
     }
 }
Exemplo n.º 19
0
    /// <summary>
    /// 获取路径最近指定关系玩家 by吴江
    /// </summary>
    /// <param name="_gameStage"></param>
    /// <param name="_player"></param>
    /// <param name="_needAlive"></param>
    /// <returns></returns>
    public static OtherPlayer GetClosestPlayer(this GameStage _gameStage, SmartActor _player, RelationType _relationType, ref float _distance)
    {
        List <OtherPlayer> opcs        = _gameStage.GetOtherPlayers();
        FDictionary        distanceDic = new FDictionary();
        FDictionary        opcDic      = new FDictionary();
        int       selfCamp             = _player.Camp;
        SceneType sceneType            = GameCenter.curGameStage.SceneType;
        Vector3   selfPosition         = _player.transform.position;

        for (int i = 0; i < opcs.Count; i++)
        {
            OtherPlayer opc = opcs[i];
            if (opc.isDead || opc.actorInfo.IsHide)
            {
                continue;
            }
            if (opc.gameObject != null && !opc.isDead && !opc.IsActor &&
                ConfigMng.Instance.GetRelationType(selfCamp, opc.Camp, sceneType) == _relationType)
            {
                Vector3[] path = GameStageUtility.StartPath(selfPosition, opc.transform.position);
                if (path != null)
                {
                    if (path.Length != 2)
                    {
                        distanceDic.Add(opc.id, path.CountPathDistance());//距离计算方法改变
                    }
                    else
                    {
                        distanceDic.Add(opc.id, Vector3.Distance(selfPosition, opc.transform.position));
                    }
                    opcDic.Add(opc.id, opc);
                }
            }
        }
        int   closestOne = -1;
        float distance   = -1;

        foreach (int id in distanceDic.Keys)
        {
            if (distance < 0 || distance >= (float)distanceDic[id])
            {
                closestOne = id;
                distance   = (float)distanceDic[id];
                _distance  = distance;
            }
        }
        return(opcDic.ContainsKey(closestOne) ? opcDic[closestOne] as OtherPlayer : null);
    }
Exemplo n.º 20
0
    IEnumerator CreateAsync(System.Action _callback = null)
    {
        if (isDummy_ == false)
        {
            GameSys.LogError("You can only start create other player in dummy: " + actorInfo.ServerInstanceID);
            yield break;
        }
        //
        isDownloading_ = true;                          //判断是否正在下载,防止重复创建

        OtherPlayer        opc            = null;
        PlayerRendererCtrl myRendererCtrl = null;
        bool faild = false;

        pendingDownload = Create(actorInfo, delegate(OtherPlayer _opc, EResult _result)
        {
            if (_result != EResult.Success)
            {
                faild = true;
                return;
            }

            opc             = _opc;
            pendingDownload = null;
            myRendererCtrl  = opc.gameObject.GetComponentInChildrenFast <PlayerRendererCtrl>();
            myRendererCtrl.Show(false);
        });
        while (opc == null || opc.inited == false)
        {
            if (faild)
            {
                yield break;
            }
            yield return(null);
        }

        pendingDownload = null;
        isDownloading_  = false;

        if (!actorInfo.IsAlive)
        {
            opc.Dead(true);
        }
        if (_callback != null)
        {
            _callback();
        }
    }
Exemplo n.º 21
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        OtherPlayer other = collision.transform.GetComponent <OtherPlayer>();

        if (other != null && other.borrowMoney <= 0)
        {
            if (other.natureMoney > natureMoney)
            {
                GetHurt(other);
            }
            else
            {
                Attack(other);
            }
        }
    }
Exemplo n.º 22
0
 // Deal with a newly joined player
 private void process(Joined jMessage)
 {
     // The player Data maintained by the client shoudl eb kept in sync with
     // The player Data of the game player object
     if (jMessage == null)
     {
         return;
     }
     if (playerData == null)
     {
         // Create a new player component
         Player p = new Player(Game,
                               Game.Content.Load <Texture2D>("Player"),
                               Game.GraphicsDevice.Viewport.Bounds.Center.ToVector2());
         // Fill in the new player Component Data
         p.playerData = new PlayerData("Created", "Player",
                                       jMessage.playerId, jMessage.gameTag,
                                       p.Position.X, p.Position.Y);
         // set this players player Data
         playerData = p.playerData;
     }
     else
     { // We have another player
         if (playerData.playerID != jMessage.playerId)
         {
             if (otherPlayers.FirstOrDefault(p => p.playerID == jMessage.playerId) == null)
             {
                 // Create a position for the other player
                 Vector2 otherPos = new Vector2(Game.GraphicsDevice.Viewport.Bounds.Center.X,
                                                Game.GraphicsDevice.Viewport.Bounds.Center.Y);
                 // Other players created at the centre also
                 // Create the player Data
                 PlayerData data = new PlayerData("Other", "Player",
                                                  jMessage.playerId, jMessage.gameTag,
                                                  otherPos.X, otherPos.Y);
                 // Create the game player for the other player
                 OtherPlayer p = new OtherPlayer(Game,
                                                 Game.Content.Load <Texture2D>("Player"),
                                                 Game.GraphicsDevice.Viewport.Bounds.Center.ToVector2());
                 p.playerData = data;
                 // Remember the other players
                 otherPlayers.Add(data);
                 new FadeText(Game, Vector2.Zero, jMessage.gameTag + " has Joined the game");
             }
         }
     }
 }
Exemplo n.º 23
0
 private void SomeoneJoined(string cid)
 {
     if (!OtherPlayers.ContainsKey(cid))
     {
         DelegateWork(() => {
             if (!OtherPlayers.ContainsKey(cid))
             {
                 OtherPlayer op    = new OtherPlayer(cid);
                 OtherPlayers[cid] = op;
                 op.Actor          = UnityUtils.LoadResource <GameObject>("Prefabs/OtherPlayer", true);
                 MpUtils.Log(MpUtils.LogLevel.Info, "MpHandler",
                             "Someone joined {0}, now {1} other players",
                             cid, OtherPlayers.Count);
             }
         });
     }
 }
Exemplo n.º 24
0
 private void SomeoneDropped(string cid)
 {
     if (OtherPlayers.ContainsKey(cid))
     {
         DelegateWork(() => {
             if (OtherPlayers.ContainsKey(cid))
             {
                 OtherPlayer op = OtherPlayers[cid];
                 GameObject.Destroy(op.Actor);
                 OtherPlayers.Remove(cid);
                 MpUtils.Log(MpUtils.LogLevel.Info, "MpHandler",
                             "Someone dropped out, was {0}, now {1} other players",
                             cid, OtherPlayers.Count);
             }
         });
     }
 }
Exemplo n.º 25
0
        public override void Draw(GameTime gametime, SpriteBatch g)
        {
            //Animation GrandMere Et FireBall
            GMPlayer.Draw(gametime, g, PositionGMLF, SpriteEffects.None);
            foreach (FireBall F in FireBalls)
            {
                F.Draw(gametime, g);
            }

            g.Draw(Ressources.TitreJeu, new Vector2(0, 0), Color.Green);


            //Others AnimationPlayer(joueur)
            OtherPlayer.Draw(gametime, g, PositionGMLF, SpriteEffects.None);

            Player.Draw(gametime, g);
        }
Exemplo n.º 26
0
    protected void OnClickOPC(OtherPlayer _opc)
    {
        if (_opc == null || target == null)
        {
            return;
        }
        if (_opc.isDead)
        {
            return;
        }

        target.CurTarget = _opc;
        target.SetAiFightTarget(_opc);
        if (isDragingRockerItem)
        {
            return;
        }

        SceneType curType = GameCenter.curGameStage.SceneType;

        if (curType != SceneType.CITY)
        {
            if (target.CurFSMState == MainPlayer.EventType.AI_FIGHT_CTRL) //应策划要求,自动战斗时的点击,不能直接跳转到普通,而只是临时执行。
            {
                target.BreakAutoFight();
            }
            else
            {
                target.GoNormal();
            }
            target.CancelCommands();
            // target.SetAiFightTarget(_opc);
            // target.autoAttak = MainPlayer.AttackType.FIGHT;
        }
        else
        {
            target.CancelCommands();
            Command_MoveTo cmdMoveTo = new Command_MoveTo();
            Vector3        npcPos    = _opc.gameObject.transform.position;
            Vector3        myPos     = target.transform.position;
            cmdMoveTo.destPos = npcPos - Vector3.Normalize(npcPos - myPos) * 2.0f;

            cmdMoveTo.maxDistance = 0.8f;
            target.commandMng.PushCommand(cmdMoveTo);
        }
    }
Exemplo n.º 27
0
    private void OnTriggerEnter(Collider other)
    {
        OtherPlayer somebody = other.gameObject.GetComponent <OtherPlayer>();
        NPC         npc      = other.gameObject.GetComponent <NPC>();
        Player      player   = other.gameObject.GetComponent <Player>();

        if (other.tag.Equals("Ground"))
        {
            flying = false;
            //Debug.Log("땅에떨어짐 ");
        }


        if (flying)
        {
            if (player != null)
            {
                if (!player.names.Equals(owner))
                {
                    player.health -= damage;
                    player.hatchet2.SetActive(true);
                    Destroy(hatchet);
                }
            }
            //Debug.Log("날아가다 맞음");
            if (somebody != null)
            {
                if (!somebody.names.Equals(owner))
                {
                    somebody.health -= damage;
                    somebody.hatchet2.SetActive(true);
                    Destroy(hatchet);
                }
            }

            if (npc != null)
            {
                npc.health -= damage;
                npc.hatchet2.SetActive(true);
                Destroy(hatchet);
                Debug.Log("HP" + npc.health);
                Debug.Log("Hit " + npc.name);
            }
        }
    }
Exemplo n.º 28
0
 public static void accessDatabase(int operationType, string username, object accountORplayer)
 {
     if (operationType == 1)
     {
         account = (Account)accountORplayer;
         users.Add(username, account);
     }
     else if (operationType == 2)
     {
         account = (Account)accountORplayer;
         users.Remove(username);
     }
     else if (operationType == 3)
     {
         player = (OtherPlayer)accountORplayer;
         users[username].player = player;
     }
 }
Exemplo n.º 29
0
 static void hero_moveto(string heroId, int mapId, float mapX, float mapY, float mapZ, float dirX, float dirY, float dirZ)
 {
     //Roledata data =  playerData.GetInstance().nearList[int.Parse(heroId)];
     // if (data == null)
     //     return;
     //  GameObject obj = data.model;
     //if(obj)
     {
         OtherPlayer other = GameObject.FindObjectOfType <OtherPlayer>();// (OtherPlayer)(CharacterManager.instance.transform.GetComponentsInChildren<OtherPlayer>()[0]);//obj.GetComponent<PlayerMotion>();
         if (other)
         {
             other.GetComponent <PlayerMotion>().Move(new Vector3(mapX, mapY, mapZ));
             other.GetComponent <PlayerMotion>().Rotation(new Vector3(dirX, dirY, dirZ));
         }
     }
     // data.model.
     Debug.Log(string.Format("hero_moveto:heroId={0},mapId={1},mapX={2},mapY={3},mapZ={4},dirX={5},dirY={6},dirZ={7}", heroId, mapId, mapX, mapY, mapZ, dirX, dirY, dirZ));
 }
Exemplo n.º 30
0
    private void OnTriggerEnter(Collider other)
    {
        OtherPlayer somebody = other.gameObject.GetComponent <OtherPlayer>();
        NPC         npc      = other.gameObject.GetComponent <NPC>();

        //var somebody = GameObject.FindWithTag("enemy").GetComponent<Player>();

        if (somebody != null)
        {
            somebody.health -= damage;
        }
        if (npc != null)
        {
            npc.health -= damage;
            //Debug.Log("HP" + npc.health);
            //Debug.Log("Hit " + npc.name);
        }
    }
Exemplo n.º 31
0
 private void SomeoneJoined(string cid)
 {
     if (!OtherPlayers.ContainsKey (cid)) {
         DelegateWork(() => {
             if (!OtherPlayers.ContainsKey (cid)) {
                 OtherPlayer op = new OtherPlayer(cid);
                 OtherPlayers[cid] = op;
                 op.Actor = UnityUtils.LoadResource<GameObject>("Prefabs/OtherPlayer", true);
                 MpUtils.Log (MpUtils.LogLevel.Info, "MpHandler",
                     "Someone joined {0}, now {1} other players",
                     cid, OtherPlayers.Count);
             }
         });
     }
 }