Ejemplo n.º 1
0
 void InstantiateWeapon(GameObject obj, Data_ItemFile data)
 {
     if (obj)
     {
         GameObject    go   = Instantiate(obj);
         Player_Weapon weap = go.GetComponent <Player_Weapon>();
         if (data.droped)
         {
             go.transform.position = data.pos;
             go.transform.rotation = data.rotate;
         }
         else
         {
             if (data.owner != -1)
             {
                 Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(data.owner);
                 if (controll)
                 {
                     weap.TakeWeapon(controll.rightHand, controll);
                 }
             }
         }
         weap.index = data.index;
         Data_ListPlayerOnScene.WriteNewItem(weap, data.index);
     }
     else
     {
         Debug.Log("mobel not found!");
     }
 }
Ejemplo n.º 2
0
    void MeSpawn(Data_PlayerFile player)
    {
        GameObject camera = GameObject.FindGameObjectWithTag("MainCamera");
        GameObject Me     = (GameObject)Instantiate(Player, player.position, player.rotate);

        Me.name = player.nick;
        SphereCollider sphere = Me.AddComponent <SphereCollider>();

        sphere.isTrigger   = true;
        sphere.radius      = 1.5f;
        Data_MyData.roomID = player.sceneID;

        Player_AnimateControl controll = Me.GetComponent <Player_AnimateControl>();

        controll.index = player.charID;
        controll.canvas.SetNick(player.nick);
        controll.canvas.SetTitle(player.title);
        controll.canvas.SetRang(player.rang);

        camera.GetComponent <Camera>().enabled        = true;
        camera.GetComponent <AudioListener>().enabled = true;
        Player_PlayerLocate locate = camera.GetComponent <Player_PlayerLocate>();

        locate.enabled = true;
        locate.GameStart(Me.transform);

        Data_ListPlayerOnScene.WriteGameObject(Me, player.charID);
        Data_MyData.charID = player.charID;
        Data_MyData.Me     = player;
    }
Ejemplo n.º 3
0
 public override void TakeWeapon(Transform parent, Player_AnimateControl controll)
 {
     transform.SetParent(parent);
     transform.localPosition = PositionInModel;
     transform.localRotation = RotateInModel;
     controll.TakeWeapon(this);
     dropped = false;
 }
Ejemplo n.º 4
0
    void HandleZombieAttack(NetworkMessage netMsg)
    {
        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(netMsg.reader.ReadInt32());

        if (controll != null)
        {
            controll.ZombieAttack();
        }
    }
Ejemplo n.º 5
0
    void HandleDropWeapon(NetworkMessage netMsg)
    {
        Message.DropWeapon drop = netMsg.ReadMessage <Message.DropWeapon>();

        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(drop.index);

        if (controll)
        {
            controll.DropWeapon();
        }
    }
Ejemplo n.º 6
0
    void HandleNewPlayerTitle(NetworkMessage netMsg)
    {
        int    index = netMsg.reader.ReadInt32();
        string title = netMsg.reader.ReadString();

        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(index);

        if (controll)
        {
            controll.canvas.SetTitle(title);
        }
    }
Ejemplo n.º 7
0
    void HandleNewPlayerRang(NetworkMessage netMsg)
    {
        int index = netMsg.reader.ReadInt32();
        int rang  = netMsg.reader.ReadInt32();

        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(index);

        if (controll)
        {
            controll.canvas.SetRang(rang);
        }
    }
 void HandleOnMovePlayer(NetworkMessage netMsg)
 {
     Message.PlayerGoTo go = netMsg.ReadMessage <Message.PlayerGoTo> ();
     if (go.vect != Vector3.zero)
     {
         Player_AnimateControl pl = Data_ListPlayerOnScene.GetPlayerControll(go.index);
         if (pl != null)
         {
             pl.Move(go.vect, go.rotate);
         }
     }
 }
    void HandleFire(NetworkMessage netMsg)
    {
        Message.Shot          shot     = netMsg.ReadMessage <Message.Shot>();
        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(shot.index);

        if (controll)
        {
            controll.Fire(shot.vect, shot.type);
        }
        if (shot.thisPlayer)
        {
            Chat.AmmoValue(shot.ammo);
        }
    }
    void HandleReload(NetworkMessage netMsg)
    {
        int   id   = netMsg.reader.ReadInt32();
        float time = (float)netMsg.reader.ReadDouble();
        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(id);

        if (controll)
        {
            controll.Reload(time);
            if (controll.index == Data_MyData.charID)
            {
                Chat.ReloadStart(time);
            }
        }
    }
Ejemplo n.º 11
0
    void HandleRespawn(NetworkMessage netMsg)
    {
        int id = netMsg.reader.ReadInt32();
        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(id);

        if (controll != null)
        {
            controll.transform.position = netMsg.reader.ReadVector3();
            controll.transform.rotation = netMsg.reader.ReadQuaternion();
            controll.gameObject.SetActive(true);
            controll.Respawn();
            if (id == Data_MyData.charID)
            {
                Player_PlayerLocate.death = false;
            }
        }
    }
Ejemplo n.º 12
0
    public static Player_AnimateControl GetPlayerControll(int index)
    {
        Player_AnimateControl d = null;

        foreach (Player_AnimateControl controll in playerControll)
        {
            if (controll)
            {
                if (controll.index == index)
                {
                    d = controll;
                    break;
                }
            }
        }
        return(d);
    }
Ejemplo n.º 13
0
    void Spawn(Data_PlayerFile player)
    {
        GameObject Enemy = (GameObject)Instantiate(Player, player.position, player.rotate);

        Data_ListPlayerOnScene.WriteGameObject(Enemy, player.charID);
        Enemy.name = player.nick;
        Player_AnimateControl en = Enemy.GetComponent <Player_AnimateControl>();

        en.index = player.charID;
        en.canvas.SetNick(player.nick);
        en.canvas.SetTitle(player.title);
        en.canvas.SetRang(player.rang);
        en.enabled = true;
        if (player.death)
        {
            en.Death();
        }
    }
Ejemplo n.º 14
0
    void HandlePickUpItem(NetworkMessage netMsg)
    {
        Message.PickUpItem up = netMsg.ReadMessage <Message.PickUpItem>();

        Player_AnimateControl controll = Data_ListPlayerOnScene.GetPlayerControll(up.index);

        if (controll)
        {
            Player_Item item = Data_ListPlayerOnScene.GetItem(up.itemIndex);
            if (item)
            {
                item.TakeWeapon(controll.rightHand, controll);
            }
            if (up.thisPlayer)
            {
                Chat.AmmoMax(up.ammo, up.ammoMax);
            }
        }
    }
Ejemplo n.º 15
0
    void ZombieSpawn(Data_PlayerFile zombie)
    {
        GameObject model = null;

        switch (zombie.nick)
        {
        case "zombie":
            model = (GameObject)Resources.Load("Zombie/Zombie");
            break;

        case "policezombie":
            model = (GameObject)Resources.Load("Zombie/PoliceZombie");
            break;

        case "sickzombie":
            model = (GameObject)Resources.Load("Zombie/SickZombie");
            break;

        case "mutantzombie":
            model = (GameObject)Resources.Load("Zombie/MutantZombie");
            break;

        case "strongzombie":
            model = (GameObject)Resources.Load("Zombie/StrongZombie");
            break;
        }
        if (model != null)
        {
            GameObject Zombie = (GameObject)Instantiate(model, zombie.position, zombie.rotate);
            Data_ListPlayerOnScene.WriteGameObject(Zombie, zombie.charID);
            Zombie.name = zombie.nick;
            Player_AnimateControl zm = Zombie.GetComponent <Player_AnimateControl>();
            zm.index  = zombie.charID;
            zm.zombie = true;
            if (zombie.death)
            {
                Zombie.SetActive(false);
            }
        }
    }
Ejemplo n.º 16
0
 public abstract void TakeWeapon(Transform parent, Player_AnimateControl controll);