SchultzGames
Para tirar dúvidas, crie um tópico especifico na área "Dúvidas em Geral" e aguarde ser respondido. Evite comentar em tópicos não relacionados a sua dúvida :D
TÓPICOS RECENTES:
Tópico:
Postado em:
Postado por:
Problema na hora de retirar vida do inimgo, ele(script) tb remove a vida do player.
Contratando pessoas da área de desenvolvimento de jogos
[____TÓPICO LIVRE____] FALE O QUE QUISER (Parte 2)
Ajuda com rotação local
Rotação em um eixo
UNITY OBJETOS COM MESMO SCRIPT DE FORMA INDEPENDENTE
[Em Desenvolvimento] Battles of Worlds
Problemas com .blend para unity
COMO MOVER UM OBJETO OU PERSONAGEM
[TUTORIAL] Inteligência artificial, inimigo e AIPoints
Loop Event Onclick
Alguém sabe explicar o que exatamente essas Opções fazem?
[RESOLVIDO] MonoDeveloper Windows 8.1
[RESOLVIDO] Playerprefs
Como percorrer por rampas sem deslizar o Rigdbody?
Ajuda em atacar
Avaliem meu APK!!!!!
Fazer a IA flanquear
fazer inimigo se movimentar para direita e esquerda jogo de plataforma
hospedagem de site gratis (link no tópico)
Solução Unity 2019 erro Text Mesh Pro
[TUTORIAL] Cena inicial de CARREGAMENTO, creditos, logo, etc [UNITY 5]
Problema com boxes colliders
Rotação
The Stack
Instalar nova versão Unity 2019
[RESOLVIDO] Alguém conhece um programa bom e simples para criar modelos 3d?
Flamehead MMORPG Indie
Comunicação entre scripts
[RESOLVIDO] Teletransporte pelo cenario Unity2D
Dúvida WEBGL
[RESOLVIDO] Problema com sistema de controle de volume.
Meu Jogo ta Travando - Quiz Unity 2D
[RESOLVIDO] Unity - Como Saber Se Botão Foi Clicado?
Quiz 2D Unity - Como esperar segundos para ir pra próxima pergunta????
Aplicativo!?!
[DUVIDA] ADS Em app WPF.NET ?
[RESOLVIDO] Renderização de Sprite renderer
[TUTORIAL] Arma tipo a do call of duty
Animação customizada com "Exit Time"
Personagem No Unity problema com colisão Como Resolver
Inimigo seguir só quando olharmos para ele.
Meu novo game
The scripts needs to derive from monobehaviour
[RESOLVIDO] Erro - animações do Mixamo na Unity
[TUTORIAL] Singleton, A melhor forma de acessar a classe!
[Asset] Repositório + Assets
Executar animação via script
[RESOLVIDO] GameObject que não Ativa
[TUTORIAL] Compilar para Android
Travar movimentação/rotação de um child.
[TUTORIAL] Android - Sistema de controle third person shooter, Joystick + Swipe camera
[RESOLVIDO] Unity 2018.2.14f1(64bit) sem audio
Como alterar propriedades em uma clip de animação mantendo o padrão em outros clips?
GIRAR EM TORNO DE ACORDO COM AS TECLAS
[DUVIDA] Como permitir que o usuario envie uma imagem e a ajeite
Mobile Camera
Collider labirinto 2D
Efeito de "Super velocidade"
girar eixo de movimento
[RESOLVIDO] List Index error
Jogo Da Velha
Projeto de lei quer criminalizar criadores de jogos violentos ?!?!?!?
[TUTORIAL] Salvar dados com playerprefs facilmente.
Conta android para desenvolvedor
[Asset] Jogo em plataforma 2D para aprendizado
Sistema de Plataforma com Rotas controlado por Touch
DIVULGAÇÃO
[RESOLVIDO] Como saber se o jogador esta vendo um certo objeto?
derrubar arvore em jogo 2d
[RESOLVIDO] Como resetar a cena em que o player estar
ESTOU COM UM PROBLEMA EM UM SCRIPT
Bool ficar verdadeira no multiplayer em script de inimigo? (Unet)
Game Mobile
[RESOLVIDO] Não consigo deixar meus áudios em 3D...
Pressionar Botão por um determinado tempo
Histórico de Input
como limitar o zoom mínimo e máximo no lean touch
Como que faço para rotacionar um objeto na posição do player como o cenario
[RESOLVIDO] Bug textura, SketchUp para Unity 3d
Unity - Excluir Ads Criado.
[RESOLVIDO] Lanterna Sumindo
Setar a posição do mouse
Medidores interativos como fazer na Unity
[RESOLVIDO] Unity - Adicionar Espaço Em Array
Pack de áudio/ efeitos sonoros gratuitos.
Game Engine
[TUTORIAL] Sistema simples para VOLTAR NO TEMPO, Unity 3D
Point Light com qualidade horrivel, o que pode ser?
PC, Mobile ou ambos?
Efeito Glowing
[RESOLVIDO] box collider conflito
[RESOLVIDO] Blender - Mancha Preta
[TUTORIAL] Unity 5- Sistema de PLATAFORMAS COM ROTAS
ESTOU COM UM PROBLEMA DE ANIMAÇÃO!!!
Câmera Orbital Modificada
[RESOLVIDO] Uma duvida sobre colliders 2d
Unity - Inspetor Personalizado
Software para testar AR no PC
Hoje à(s) 5:07 pm
Hoje à(s) 3:49 pm
Hoje à(s) 2:36 pm
Hoje à(s) 8:53 am
Hoje à(s) 1:43 am
Ontem à(s) 8:01 pm
Ontem à(s) 7:53 pm
Ontem à(s) 7:28 pm
Ontem à(s) 12:11 pm
Ontem à(s) 2:42 am
Seg Abr 22, 2019 10:40 pm
Seg Abr 22, 2019 7:08 pm
Seg Abr 22, 2019 6:49 am
Sab Abr 20, 2019 3:15 pm
Sab Abr 20, 2019 1:57 pm
Sab Abr 20, 2019 1:28 pm
Sab Abr 20, 2019 2:41 am
Sex Abr 19, 2019 9:19 pm
Sex Abr 19, 2019 6:40 pm
Sex Abr 19, 2019 6:23 pm
Sex Abr 19, 2019 2:32 am
Qui Abr 18, 2019 9:35 pm
Qui Abr 18, 2019 8:43 pm
Qui Abr 18, 2019 8:39 pm
Qui Abr 18, 2019 8:30 pm
Qui Abr 18, 2019 8:25 pm
Qui Abr 18, 2019 1:04 pm
Qui Abr 18, 2019 3:25 am
Qua Abr 17, 2019 8:26 pm
Qua Abr 17, 2019 8:16 pm
Seg Abr 15, 2019 11:27 pm
Seg Abr 15, 2019 11:24 pm
Seg Abr 15, 2019 9:53 pm
Seg Abr 15, 2019 7:15 pm
Seg Abr 15, 2019 12:29 pm
Dom Abr 14, 2019 11:26 am
Dom Abr 14, 2019 11:23 am
Dom Abr 14, 2019 1:42 am
Sab Abr 13, 2019 2:33 pm
Sab Abr 13, 2019 1:36 pm
Sex Abr 12, 2019 8:44 pm
Qui Abr 11, 2019 11:18 pm
Qui Abr 11, 2019 12:50 pm
Qua Abr 10, 2019 10:59 am
Qua Abr 10, 2019 1:01 am
Ter Abr 09, 2019 7:31 pm
Ter Abr 09, 2019 6:39 pm
Ter Abr 09, 2019 3:47 pm
Seg Abr 08, 2019 8:59 pm
Dom Abr 07, 2019 8:55 pm
Dom Abr 07, 2019 8:01 pm
Dom Abr 07, 2019 3:05 pm
Sab Abr 06, 2019 11:52 am
Sab Abr 06, 2019 12:12 am
Sex Abr 05, 2019 10:46 pm
Sex Abr 05, 2019 9:38 pm
Sex Abr 05, 2019 9:36 pm
Sex Abr 05, 2019 9:31 pm
Sex Abr 05, 2019 9:27 pm
Qui Abr 04, 2019 9:18 pm
Qui Abr 04, 2019 8:21 pm
Qui Abr 04, 2019 4:37 pm
Qui Abr 04, 2019 2:48 pm
Qua Abr 03, 2019 7:09 pm
Qua Abr 03, 2019 4:37 pm
Qua Abr 03, 2019 4:32 pm
Ter Abr 02, 2019 11:18 pm
Ter Abr 02, 2019 7:32 pm
Ter Abr 02, 2019 6:18 pm
Ter Abr 02, 2019 4:50 pm
Ter Abr 02, 2019 4:19 am
Seg Abr 01, 2019 9:22 pm
Seg Abr 01, 2019 9:19 pm
Seg Abr 01, 2019 9:15 pm
Seg Abr 01, 2019 8:58 pm
Seg Abr 01, 2019 6:12 pm
Seg Abr 01, 2019 4:00 pm
Seg Abr 01, 2019 3:35 pm
Seg Abr 01, 2019 1:23 pm
Seg Abr 01, 2019 1:09 am
Dom Mar 31, 2019 6:07 pm
Dom Mar 31, 2019 11:26 am
Sab Mar 30, 2019 9:03 pm
Sab Mar 30, 2019 6:09 pm
Sab Mar 30, 2019 5:50 pm
Sab Mar 30, 2019 4:56 pm
Sab Mar 30, 2019 8:22 am
Sab Mar 30, 2019 8:21 am
Sex Mar 29, 2019 11:56 pm
Sex Mar 29, 2019 4:31 pm
Sex Mar 29, 2019 3:57 pm
Sex Mar 29, 2019 3:39 pm
Sex Mar 29, 2019 12:29 pm
Sex Mar 29, 2019 4:54 am
Sex Mar 29, 2019 4:50 am
Sex Mar 29, 2019 4:41 am
Qui Mar 28, 2019 4:26 pm
Qui Mar 28, 2019 1:39 pm
Qui Mar 28, 2019 8:05 am
daniel123163
Fue
Tegh
Nowsfeky
MarcosSchultz
diegodiego01
dstaroski
marlon33
diegopds
MarcosSchultz
Magnatah
glauco
marlon33
Magnatah
LucasRangel
UesleiUsl
MarcosSchultz
916anderson
MarcosSchultz
Magnatah
MarcosSchultz
marlon33
MarcosSchultz
MarcosSchultz
MarcosSchultz
MarcosSchultz
glauco
ffabim
Callyde Jr
mathhBR
numb123
kraulim
MarcosSchultz
Magnatah
Akuma97
Magnatah
BRGC
ffabim
diegopds
NKKF
dstaroski
MarceloYBP
guimaraf
everton0101
Master3353
Magnatah
augustobrito
NotoriousDev
Fernando Andrey
fabricadegame
NotoriousDev
iToddy
marciosilva
LucasRangel
wagnercaragua
MarcosSchultz
MarcosSchultz
MarcosSchultz
MarcosSchultz
wagnercaragua
NotoriousDev
Unidade3d5
Tegh
rafaelllsd
JohnRambo
NKKF
edvanmelo
niao
NKKF
Tegh
niao
fecirineu
fecirineu
fecirineu
BrazaTattoo
NKKF
NKKF
Chilinger
emerson vitor
BrazaTattoo
Magnatah
Guinho3p
luiz12345
Magnatah
Magnatah
Zack2
Chilinger
Chilinger
MarcosSchultz
Magnatah
michelly
eduardonog30
Magnatah
MarcosSchultz
MarcosSchultz
MarcosSchultz
mathhBR
Magnatah
Chilinger

[RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script

Ir em baixo

Resolvido [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script

Mensagem por Samuelostgamer em Qui Set 06, 2018 10:48 pm

Código:
////////////////////////////////////////////////////////////////////////////////
//////////////////// bl_PlayerSync.cs///////////////////////////////////////////
////////////////////use this for the synchronizer position , rotation, states,//
///////////////////etc...   via photon//////////////////////////////////////////
////////////////////////////////Lovatto Studio//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[RequireComponent(typeof(PhotonView))]
public class bl_PlayerSync : bl_MonoBehaviour
{
    /// <summary>
    /// the player's team is not ours
    /// </summary>
    [HideInInspector]
    public string RemoteTeam;
    /// <summary>
    /// the current state of the current weapon
    /// </summary>
    public string WeaponState;
    /// <summary>
    /// the object to which the player looked
    /// </summary>
    public Transform HeatTarget;
    /// <summary>
    /// smooth interpolation amount
    /// </summary>
    public float SmoothingDelay = 8f;
    /// <summary>
    /// list all remote weapons
    /// </summary>
    public List<bl_NetworkGun> NetworkGuns = new List<bl_NetworkGun>();

    [SerializeField]
    PhotonTransformViewPositionModel m_PositionModel = new PhotonTransformViewPositionModel();

    [SerializeField]
    PhotonTransformViewRotationModel m_RotationModel = new PhotonTransformViewRotationModel();

    [SerializeField]
    PhotonTransformViewScaleModel m_ScaleModel = new PhotonTransformViewScaleModel();

    PhotonTransformViewPositionControl m_PositionControl;
    PhotonTransformViewRotationControl m_RotationControl;
    PhotonTransformViewScaleControl m_ScaleControl;

    bool m_ReceivedNetworkUpdate = false;
    [Space(5)]
    //Script Needed
    [Header("Necessary script")]
    public bl_GunManager GManager;
    public bl_PlayerAnimations m_PlayerAnimation;
    //Material for apply when disable a NetGun
    public Material InvicibleMat;
    //private
    private bl_FirstPersonController Controller;
    private GameObject CurrenGun;
    private bl_PlayerSettings Settings;
    private bl_PlayerDamageManager PDM;
 private DrawName DrawName;
    private bl_RoomMenu RoomMenu;
    private bool FrienlyFire = false;
    private bool SendInfo = false;
    private CharacterController m_CController;
#if UMM
     private bl_MiniMapItem MiniMapItem = null;
#endif

#pragma warning disable 0414
    [SerializeField]
    bool ObservedComponentsFoldoutOpen = true;
#pragma warning disable 0414


    protected override void Awake()
    {
        base.Awake();
        if (!PhotonNetwork.connected)
            Destroy(this);

        //FirstUpdate = false;
        if (!this.isMine)
        {
            if (HeatTarget.gameObject.activeSelf == false)
            {
                HeatTarget.gameObject.SetActive(true);
            }
        }

        m_PositionControl = new PhotonTransformViewPositionControl(m_PositionModel);
        m_RotationControl = new PhotonTransformViewRotationControl(m_RotationModel);
        m_ScaleControl = new PhotonTransformViewScaleControl(m_ScaleModel);
        Controller = GetComponent<bl_FirstPersonController>();
        Settings = GetComponent<bl_PlayerSettings>();
        PDM = GetComponent<bl_PlayerDamageManager>();
        DrawName = GetComponent<bl_DrawName>();
        RoomMenu = FindObjectOfType<bl_RoomMenu>();
        m_CController = GetComponent<CharacterController>();
        FrienlyFire = (bool)PhotonNetwork.room.CustomProperties[PropertiesKeys.RoomFriendlyFire];
#if UMM
      MiniMapItem = this.GetComponent<bl_MiniMapItem>();
#endif
    }

    /// <summary>
    /// serialization method of photon
    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {

        m_PositionControl.OnPhotonSerializeView(transform.localPosition, stream, info);
        m_RotationControl.OnPhotonSerializeView(transform.localRotation, stream, info);
        m_ScaleControl.OnPhotonSerializeView(transform.localScale, stream, info);
        if (isMine == false && m_PositionModel.DrawErrorGizmo == true)
        {
            DoDrawEstimatedPositionError();
        }
        if (stream.isWriting)
        {
            //We own this player: send the others our data
            stream.SendNext(gameObject.name);
            stream.SendNext(HeatTarget.position);
            stream.SendNext(HeatTarget.rotation);
            stream.SendNext((int)Controller.State);
            stream.SendNext(Controller.isGrounded);
            stream.SendNext(GManager.GetCurrentWeapon().GunID);
            stream.SendNext(Settings.m_Team.ToString());
            stream.SendNext(WeaponState);
            stream.SendNext(Controller.Velocity);
        }
        else
        {
            //Network player, receive data
            RemotePlayerName = (string)stream.ReceiveNext();
            HeadPos = (Vector3)stream.ReceiveNext();
            HeadRot = (Quaternion)stream.ReceiveNext();
            m_state = (int)stream.ReceiveNext();
            m_grounded = (bool)stream.ReceiveNext();
            CurNetGun = (int)stream.ReceiveNext();
            RemoteTeam = (string)stream.ReceiveNext();
            UpperState = (string)stream.ReceiveNext();
            velocity = (Vector3)stream.ReceiveNext();

            m_ReceivedNetworkUpdate = true;
        }
    }

    private Vector3 HeadPos = Vector3.zero;// Head Look to
    private Quaternion HeadRot = Quaternion.identity;
    private int m_state;
    private bool m_grounded;
    private string RemotePlayerName = string.Empty;
    private int CurNetGun;
    private string UpperState = "";
    private Vector3 velocity;

    protected override void OnDisable()
    {
        base.OnDisable();
        if (bl_GameData.Instance.DropGunOnDeath)
        {
            NetGunsRoot.gameObject.SetActive(false);
        }
    }

    /// <summary>
    ///
    /// </summary>
    public override void OnUpdate()
    {
        ///if the player is not ours, then
        if (photonView == null || isMine == true || isConnected == false)
        {
            return;
        }

        UpdatePosition();
        UpdateRotation();
        UpdateScale();
        GetTeamRemote();

        this.HeatTarget.position = Vector3.Lerp(this.HeatTarget.position, HeadPos, Time.deltaTime * this.SmoothingDelay);
        this.HeatTarget.rotation = HeadRot;
        m_PlayerAnimation.state = m_state;//send the state of player local for remote animation
        m_PlayerAnimation.grounded = m_grounded;
        m_PlayerAnimation.velocity = velocity;
        m_PlayerAnimation.UpperState = UpperState;

        gameObject.name = RemotePlayerName;
        if(DrawName != null) { DrawName.m_PlayerName = RemotePlayerName; }
        if (!isOneTeamMode)
        {
            //Determine if remote player is teamMate or enemy
            if (RemoteTeam == (string)PhotonNetwork.player.CustomProperties[PropertiesKeys.TeamKey])
            {
                TeamMate();
            }
            else
            {
                Enemy();
            }
        }
        else
        {
            Enemy();
        }

        CurrentTPVGun();
    }

    void CurrentTPVGun(bool local = false)
    {
        if (GManager == null)
            return;

        //Get the current gun ID local and sync with remote
        bool found = false;
        foreach (bl_NetworkGun guns in NetworkGuns)
        {
            int currentID = (local) ? GManager.GetCurrentWeapon().GunID : CurNetGun;
            if (guns.GetWeaponID == currentID)
            {
                guns.gameObject.SetActive(true);
                if (!local)
                {
                    CurrenGun = guns.gameObject;
                    CurrenGun.GetComponent<bl_NetworkGun>().SetUpType();
                }
                found = true;
            }
            else
            {
                guns.gameObject.SetActive(false);
            }
        }
        if (!found) { Debug.LogWarning("Net gun with id: " + CurNetGun + " is not defined!"); }
    }

    /// <summary>
    /// use this function to set all details for enemy
    /// </summary>
    void Enemy()
    {
        PDM.DamageEnabled = true;
        DrawName.enabled = RoomMenu.SpectatorMode;
#if UMM
      if (UpperState == "Firing")
        {
            MiniMapItem.ShowItem();
        }
        else
        {
            MiniMapItem.HideItem();
        }
#endif
    }

    /// <summary>
    /// use this function to set all details for teammate
    /// </summary>
    void TeamMate()
    {
        PDM.DamageEnabled = FrienlyFire;
        DrawName.enabled = true;
        m_CController.enabled = false;

        if (!SendInfo)
        {
            SendInfo = true;
            this.GetComponentInChildren<bl_BodyPartManager>().IgnorePlayerCollider();
        }

#if UMM
   MiniMapItem.ShowItem();
#endif
    }

    /// <summary>
    ///
    /// </summary>
    public void SetNetworkWeapon(GunType weaponType)
    {
        m_PlayerAnimation.SetNetworkWeapon(weaponType);
    }

    /// <summary>
    /// public method to send the RPC shot synchronization
    /// </summary>
    public void IsFire(string m_type, float t_spread, Vector3 pos, Quaternion rot)
    {
        photonView.RPC("FireSync", PhotonTargets.Others, new object[] { m_type, t_spread, pos, rot });
    }

    /// <summary>
    /// public method to send the RPC shot synchronization
    /// </summary>
    public void IsFireGrenade(float t_spread, Vector3 pos, Quaternion rot, Vector3 angular)
    {
        photonView.RPC("FireGrenadeRpc", PhotonTargets.Others, new object[] { t_spread, pos, rot, angular });
    }

    public Transform NetGunsRoot { get { if (!bl_GameData.Instance.DropGunOnDeath) { CurrentTPVGun(true); } return NetworkGuns[0].transform.parent; } }

    /// <summary>
    /// Synchronize the shot with the current remote weapon
    /// send the information necessary so that fire
    /// impact in the same direction as the local
    /// </summary>
    [PunRPC]
    void FireSync(string m_type, float m_spread, Vector3 pos, Quaternion rot)
    {
        if (CurrenGun)
        {
            if (m_type == GunType.Machinegun.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);
            }
            else if (m_type == GunType.Shotgun.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire shotgun in networkgun
            }
            else if (m_type == GunType.Sniper.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire sniper in networkgun
            }
            else if (m_type == GunType.Burst.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire burst in networkgun
            }
            else if (m_type == GunType.Knife.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().KnifeFire();//if you need add your custom fire launcher in networkgun
            }
        }
    }

    [PunRPC]
    void FireGrenadeRpc(float m_spread, Vector3 pos, Quaternion rot,Vector3 angular)
    {
        CurrenGun.GetComponent<bl_NetworkGun>().GrenadeFire(m_spread, pos, rot, angular);
    }

    /// <summary>
    ///
    /// </summary>
    public void SetActiveGrenade(bool active)
    {
        photonView.RPC("SyncOffAmmoGrenade", PhotonTargets.Others, active);
    }

    [PunRPC]
    void SyncOffAmmoGrenade(bool active)
    {
        if (CurrenGun == null)
        {
            Debug.LogError("Grenade is not active on TPS Player");
            return;
        }
        CurrenGun.GetComponent<bl_NetworkGun>().DesactiveGrenade(active, InvicibleMat);
    }

    /// <summary>
    ///
    /// </summary>
    void GetTeamRemote()
    {
        if (RemoteTeam == Team.Recon.ToString())
        {
            Settings.m_Team = Team.Recon;
        }
        else if (RemoteTeam == Team.Delta.ToString())
        {
            Settings.m_Team = Team.Delta;
        }
        else
        {
            Settings.m_Team = Team.All;
        }
    }

#if CUSTOMIZER
    [PunRPC]
    void SyncCustomizer(string info, string p)
    {
        if (CurrenGun)
        {
            if (p == this.gameObject.name)//is mine
            {
                this.CurrenGun.GetComponent<bl_NetworkGun>().ReadCustomizer(info);
            }
        }
        else
        {
            StartCoroutine(WaitForGetGUN(info, p));
        }
    }

    IEnumerator WaitForGetGUN(string info, string p)
    {
        yield return new WaitForSeconds(2);
        this.SyncCustomizer(info, p);
    }
#endif

    /// <summary>
    ///
    /// </summary>
    void UpdatePosition()
    {
        if (m_PositionModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localPosition = m_PositionControl.UpdatePosition(transform.localPosition);
    }
    /// <summary>
    ///
    /// </summary>
    void UpdateRotation()
    {
        if (m_RotationModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localRotation = m_RotationControl.GetRotation(transform.localRotation);
    }
    /// <summary>
    ///
    /// </summary>
    void UpdateScale()
    {
        if (m_ScaleModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localScale = m_ScaleControl.GetScale(transform.localScale);
    }
    /// <summary>
    ///
    /// </summary>
    void DoDrawEstimatedPositionError()
    {
        Vector3 targetPosition = m_PositionControl.GetNetworkPosition();

        Debug.DrawLine(targetPosition, transform.position, Color.red, 2f);
        Debug.DrawLine(transform.position, transform.position + Vector3.up, Color.green, 2f);
        Debug.DrawLine(targetPosition, targetPosition + Vector3.up, Color.red, 2f);
    }
    /// <summary>
    /// These values are synchronized to the remote objects if the interpolation mode
    /// or the extrapolation mode SynchronizeValues is used. Your movement script should pass on
    /// the current speed (in units/second) and turning speed (in angles/second) so the remote
    /// object can use them to predict the objects movement.
    /// </summary>
    /// <param name="speed">The current movement vector of the object in units/second.</param>
    /// <param name="turnSpeed">The current turn speed of the object in angles/second.</param>
    public void SetSynchronizedValues(Vector3 speed, float turnSpeed)
    {
        m_PositionControl.SetSynchronizedValues(speed, turnSpeed);
    }
}
Assets/MFPS/Scripts/Misc/Network/bl_PlayerSync.cs(62,10): error CS0246: The type or namespace name `DrawName' could not be found. Are you missing an assembly reference?

Samuelostgamer
Iniciante
Iniciante

PONTOS : 612
REPUTAÇÃO : 4
Respeito as regras : [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script WvDYdlf

Ver perfil do usuário

Voltar ao Topo Ir em baixo

Resolvido Re: [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script

Mensagem por NKKF em Qui Set 06, 2018 11:15 pm

Amigo, isso é um erro do próprio Asset, entre em contato com o suporte.

Recomendo também que veja se a sua versão Unity é suportada pela versão do MFPS que você baixou.
NKKF
NKKF
ProgramadorMaster

Masculino PONTOS : 2366
REPUTAÇÃO : 452
Idade : 14
Áreas de atuação : Error 404 Not Found.
Respeito as regras : [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script Aad8pUi

Ver perfil do usuário http://www.projetounity.esy.es

Voltar ao Topo Ir em baixo

Resolvido Re: [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script

Mensagem por fecirineu em Sex Set 07, 2018 9:37 am

@Samuelostgamer escreveu:
Código:
////////////////////////////////////////////////////////////////////////////////
//////////////////// bl_PlayerSync.cs///////////////////////////////////////////
////////////////////use this for the synchronizer position , rotation, states,//
///////////////////etc...   via photon//////////////////////////////////////////
////////////////////////////////Lovatto Studio//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[RequireComponent(typeof(PhotonView))]
public class bl_PlayerSync : bl_MonoBehaviour
{
    /// <summary>
    /// the player's team is not ours
    /// </summary>
    [HideInInspector]
    public string RemoteTeam;
    /// <summary>
    /// the current state of the current weapon
    /// </summary>
    public string WeaponState;
    /// <summary>
    /// the object to which the player looked
    /// </summary>
    public Transform HeatTarget;
    /// <summary>
    /// smooth interpolation amount
    /// </summary>
    public float SmoothingDelay = 8f;
    /// <summary>
    /// list all remote weapons
    /// </summary>
    public List<bl_NetworkGun> NetworkGuns = new List<bl_NetworkGun>();

    [SerializeField]
    PhotonTransformViewPositionModel m_PositionModel = new PhotonTransformViewPositionModel();

    [SerializeField]
    PhotonTransformViewRotationModel m_RotationModel = new PhotonTransformViewRotationModel();

    [SerializeField]
    PhotonTransformViewScaleModel m_ScaleModel = new PhotonTransformViewScaleModel();

    PhotonTransformViewPositionControl m_PositionControl;
    PhotonTransformViewRotationControl m_RotationControl;
    PhotonTransformViewScaleControl m_ScaleControl;

    bool m_ReceivedNetworkUpdate = false;
    [Space(5)]
    //Script Needed
    [Header("Necessary script")]
    public bl_GunManager GManager;
    public bl_PlayerAnimations m_PlayerAnimation;
    //Material for apply when disable a NetGun
    public Material InvicibleMat;
    //private
    private bl_FirstPersonController Controller;
    private GameObject CurrenGun;
    private bl_PlayerSettings Settings;
    private bl_PlayerDamageManager PDM;
 private DrawName DrawName;
    private bl_RoomMenu RoomMenu;
    private bool FrienlyFire = false;
    private bool SendInfo = false;
    private CharacterController m_CController;
#if UMM
     private bl_MiniMapItem MiniMapItem = null;
#endif

#pragma warning disable 0414
    [SerializeField]
    bool ObservedComponentsFoldoutOpen = true;
#pragma warning disable 0414


    protected override void Awake()
    {
        base.Awake();
        if (!PhotonNetwork.connected)
            Destroy(this);

        //FirstUpdate = false;
        if (!this.isMine)
        {
            if (HeatTarget.gameObject.activeSelf == false)
            {
                HeatTarget.gameObject.SetActive(true);
            }
        }

        m_PositionControl = new PhotonTransformViewPositionControl(m_PositionModel);
        m_RotationControl = new PhotonTransformViewRotationControl(m_RotationModel);
        m_ScaleControl = new PhotonTransformViewScaleControl(m_ScaleModel);
        Controller = GetComponent<bl_FirstPersonController>();
        Settings = GetComponent<bl_PlayerSettings>();
        PDM = GetComponent<bl_PlayerDamageManager>();
        DrawName = GetComponent<bl_DrawName>();
        RoomMenu = FindObjectOfType<bl_RoomMenu>();
        m_CController = GetComponent<CharacterController>();
        FrienlyFire = (bool)PhotonNetwork.room.CustomProperties[PropertiesKeys.RoomFriendlyFire];
#if UMM
      MiniMapItem = this.GetComponent<bl_MiniMapItem>();
#endif
    }

    /// <summary>
    /// serialization method of photon
    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {

        m_PositionControl.OnPhotonSerializeView(transform.localPosition, stream, info);
        m_RotationControl.OnPhotonSerializeView(transform.localRotation, stream, info);
        m_ScaleControl.OnPhotonSerializeView(transform.localScale, stream, info);
        if (isMine == false && m_PositionModel.DrawErrorGizmo == true)
        {
            DoDrawEstimatedPositionError();
        }
        if (stream.isWriting)
        {
            //We own this player: send the others our data
            stream.SendNext(gameObject.name);
            stream.SendNext(HeatTarget.position);
            stream.SendNext(HeatTarget.rotation);
            stream.SendNext((int)Controller.State);
            stream.SendNext(Controller.isGrounded);
            stream.SendNext(GManager.GetCurrentWeapon().GunID);
            stream.SendNext(Settings.m_Team.ToString());
            stream.SendNext(WeaponState);
            stream.SendNext(Controller.Velocity);
        }
        else
        {
            //Network player, receive data
            RemotePlayerName = (string)stream.ReceiveNext();
            HeadPos = (Vector3)stream.ReceiveNext();
            HeadRot = (Quaternion)stream.ReceiveNext();
            m_state = (int)stream.ReceiveNext();
            m_grounded = (bool)stream.ReceiveNext();
            CurNetGun = (int)stream.ReceiveNext();
            RemoteTeam = (string)stream.ReceiveNext();
            UpperState = (string)stream.ReceiveNext();
            velocity = (Vector3)stream.ReceiveNext();

            m_ReceivedNetworkUpdate = true;
        }
    }

    private Vector3 HeadPos = Vector3.zero;// Head Look to
    private Quaternion HeadRot = Quaternion.identity;
    private int m_state;
    private bool m_grounded;
    private string RemotePlayerName = string.Empty;
    private int CurNetGun;
    private string UpperState = "";
    private Vector3 velocity;

    protected override void OnDisable()
    {
        base.OnDisable();
        if (bl_GameData.Instance.DropGunOnDeath)
        {
            NetGunsRoot.gameObject.SetActive(false);
        }
    }

    /// <summary>
    ///
    /// </summary>
    public override void OnUpdate()
    {
        ///if the player is not ours, then
        if (photonView == null || isMine == true || isConnected == false)
        {
            return;
        }

        UpdatePosition();
        UpdateRotation();
        UpdateScale();
        GetTeamRemote();

        this.HeatTarget.position = Vector3.Lerp(this.HeatTarget.position, HeadPos, Time.deltaTime * this.SmoothingDelay);
        this.HeatTarget.rotation = HeadRot;
        m_PlayerAnimation.state = m_state;//send the state of player local for remote animation
        m_PlayerAnimation.grounded = m_grounded;
        m_PlayerAnimation.velocity = velocity;
        m_PlayerAnimation.UpperState = UpperState;

        gameObject.name = RemotePlayerName;
        if(DrawName != null) { DrawName.m_PlayerName = RemotePlayerName; }
        if (!isOneTeamMode)
        {
            //Determine if remote player is teamMate or enemy
            if (RemoteTeam == (string)PhotonNetwork.player.CustomProperties[PropertiesKeys.TeamKey])
            {
                TeamMate();
            }
            else
            {
                Enemy();
            }
        }
        else
        {
            Enemy();
        }

        CurrentTPVGun();
    }

    void CurrentTPVGun(bool local = false)
    {
        if (GManager == null)
            return;

        //Get the current gun ID local and sync with remote
        bool found = false;
        foreach (bl_NetworkGun guns in NetworkGuns)
        {
            int currentID = (local) ? GManager.GetCurrentWeapon().GunID : CurNetGun;
            if (guns.GetWeaponID == currentID)
            {
                guns.gameObject.SetActive(true);
                if (!local)
                {
                    CurrenGun = guns.gameObject;
                    CurrenGun.GetComponent<bl_NetworkGun>().SetUpType();
                }
                found = true;
            }
            else
            {
                guns.gameObject.SetActive(false);
            }
        }
        if (!found) { Debug.LogWarning("Net gun with id: " + CurNetGun + " is not defined!"); }
    }

    /// <summary>
    /// use this function to set all details for enemy
    /// </summary>
    void Enemy()
    {
        PDM.DamageEnabled = true;
        DrawName.enabled = RoomMenu.SpectatorMode;
#if UMM
      if (UpperState == "Firing")
        {
            MiniMapItem.ShowItem();
        }
        else
        {
            MiniMapItem.HideItem();
        }
#endif
    }

    /// <summary>
    /// use this function to set all details for teammate
    /// </summary>
    void TeamMate()
    {
        PDM.DamageEnabled = FrienlyFire;
        DrawName.enabled = true;
        m_CController.enabled = false;

        if (!SendInfo)
        {
            SendInfo = true;
            this.GetComponentInChildren<bl_BodyPartManager>().IgnorePlayerCollider();
        }

#if UMM
   MiniMapItem.ShowItem();
#endif
    }

    /// <summary>
    ///
    /// </summary>
    public void SetNetworkWeapon(GunType weaponType)
    {
        m_PlayerAnimation.SetNetworkWeapon(weaponType);
    }

    /// <summary>
    /// public method to send the RPC shot synchronization
    /// </summary>
    public void IsFire(string m_type, float t_spread, Vector3 pos, Quaternion rot)
    {
        photonView.RPC("FireSync", PhotonTargets.Others, new object[] { m_type, t_spread, pos, rot });
    }

    /// <summary>
    /// public method to send the RPC shot synchronization
    /// </summary>
    public void IsFireGrenade(float t_spread, Vector3 pos, Quaternion rot, Vector3 angular)
    {
        photonView.RPC("FireGrenadeRpc", PhotonTargets.Others, new object[] { t_spread, pos, rot, angular });
    }

    public Transform NetGunsRoot { get { if (!bl_GameData.Instance.DropGunOnDeath) { CurrentTPVGun(true); } return NetworkGuns[0].transform.parent; } }

    /// <summary>
    /// Synchronize the shot with the current remote weapon
    /// send the information necessary so that fire
    /// impact in the same direction as the local
    /// </summary>
    [PunRPC]
    void FireSync(string m_type, float m_spread, Vector3 pos, Quaternion rot)
    {
        if (CurrenGun)
        {
            if (m_type == GunType.Machinegun.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);
            }
            else if (m_type == GunType.Shotgun.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire shotgun in networkgun
            }
            else if (m_type == GunType.Sniper.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire sniper in networkgun
            }
            else if (m_type == GunType.Burst.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire burst in networkgun
            }
            else if (m_type == GunType.Knife.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().KnifeFire();//if you need add your custom fire launcher in networkgun
            }
        }
    }

    [PunRPC]
    void FireGrenadeRpc(float m_spread, Vector3 pos, Quaternion rot,Vector3 angular)
    {
        CurrenGun.GetComponent<bl_NetworkGun>().GrenadeFire(m_spread, pos, rot, angular);
    }

    /// <summary>
    ///
    /// </summary>
    public void SetActiveGrenade(bool active)
    {
        photonView.RPC("SyncOffAmmoGrenade", PhotonTargets.Others, active);
    }

    [PunRPC]
    void SyncOffAmmoGrenade(bool active)
    {
        if (CurrenGun == null)
        {
            Debug.LogError("Grenade is not active on TPS Player");
            return;
        }
        CurrenGun.GetComponent<bl_NetworkGun>().DesactiveGrenade(active, InvicibleMat);
    }

    /// <summary>
    ///
    /// </summary>
    void GetTeamRemote()
    {
        if (RemoteTeam == Team.Recon.ToString())
        {
            Settings.m_Team = Team.Recon;
        }
        else if (RemoteTeam == Team.Delta.ToString())
        {
            Settings.m_Team = Team.Delta;
        }
        else
        {
            Settings.m_Team = Team.All;
        }
    }

#if CUSTOMIZER
    [PunRPC]
    void SyncCustomizer(string info, string p)
    {
        if (CurrenGun)
        {
            if (p == this.gameObject.name)//is mine
            {
                this.CurrenGun.GetComponent<bl_NetworkGun>().ReadCustomizer(info);
            }
        }
        else
        {
            StartCoroutine(WaitForGetGUN(info, p));
        }
    }

    IEnumerator WaitForGetGUN(string info, string p)
    {
        yield return new WaitForSeconds(2);
        this.SyncCustomizer(info, p);
    }
#endif

    /// <summary>
    ///
    /// </summary>
    void UpdatePosition()
    {
        if (m_PositionModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localPosition = m_PositionControl.UpdatePosition(transform.localPosition);
    }
    /// <summary>
    ///
    /// </summary>
    void UpdateRotation()
    {
        if (m_RotationModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localRotation = m_RotationControl.GetRotation(transform.localRotation);
    }
    /// <summary>
    ///
    /// </summary>
    void UpdateScale()
    {
        if (m_ScaleModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localScale = m_ScaleControl.GetScale(transform.localScale);
    }
    /// <summary>
    ///
    /// </summary>
    void DoDrawEstimatedPositionError()
    {
        Vector3 targetPosition = m_PositionControl.GetNetworkPosition();

        Debug.DrawLine(targetPosition, transform.position, Color.red, 2f);
        Debug.DrawLine(transform.position, transform.position + Vector3.up, Color.green, 2f);
        Debug.DrawLine(targetPosition, targetPosition + Vector3.up, Color.red, 2f);
    }
    /// <summary>
    /// These values are synchronized to the remote objects if the interpolation mode
    /// or the extrapolation mode SynchronizeValues is used. Your movement script should pass on
    /// the current speed (in units/second) and turning speed (in angles/second) so the remote
    /// object can use them to predict the objects movement.
    /// </summary>
    /// <param name="speed">The current movement vector of the object in units/second.</param>
    /// <param name="turnSpeed">The current turn speed of the object in angles/second.</param>
    public void SetSynchronizedValues(Vector3 speed, float turnSpeed)
    {
        m_PositionControl.SetSynchronizedValues(speed, turnSpeed);
    }
}
Assets/MFPS/Scripts/Misc/Network/bl_PlayerSync.cs(62,10): error CS0246: The type or namespace name `DrawName' could not be found. Are you missing an assembly reference?

tecnicamente está faltando algum script ou uma linha foi apagada que geralmente fica em cima do nome da class: exemplo:
Código:
using UnityEngine;
using System.Collections;[size=14][/size]using System.Collections.Generic;[size=14][/size]namespace DrawName {[size=14][/size][RequireComponent(typeof(PhotonView))]public class bl_PlayerSync : bl_MonoBehaviour[size=14][/size]{}
}



fecirineu
fecirineu
ProgramadorMaster

Masculino PONTOS : 1523
REPUTAÇÃO : 136
Áreas de atuação : Programação C#,VB,VBNET,MySQL,HTML,CSS,PHP.

Respeito as regras : [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script Aad8pUi

Ver perfil do usuário http://gamesbr.cf/

Voltar ao Topo Ir em baixo

Resolvido Re: [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script

Mensagem por Samuelostgamer em Qui Out 11, 2018 2:32 pm

@fecirineu escreveu:
@Samuelostgamer escreveu:
Código:
////////////////////////////////////////////////////////////////////////////////
//////////////////// bl_PlayerSync.cs///////////////////////////////////////////
////////////////////use this for the synchronizer position , rotation, states,//
///////////////////etc...   via photon//////////////////////////////////////////
////////////////////////////////Lovatto Studio//////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

[RequireComponent(typeof(PhotonView))]
public class bl_PlayerSync : bl_MonoBehaviour
{
    /// <summary>
    /// the player's team is not ours
    /// </summary>
    [HideInInspector]
    public string RemoteTeam;
    /// <summary>
    /// the current state of the current weapon
    /// </summary>
    public string WeaponState;
    /// <summary>
    /// the object to which the player looked
    /// </summary>
    public Transform HeatTarget;
    /// <summary>
    /// smooth interpolation amount
    /// </summary>
    public float SmoothingDelay = 8f;
    /// <summary>
    /// list all remote weapons
    /// </summary>
    public List<bl_NetworkGun> NetworkGuns = new List<bl_NetworkGun>();

    [SerializeField]
    PhotonTransformViewPositionModel m_PositionModel = new PhotonTransformViewPositionModel();

    [SerializeField]
    PhotonTransformViewRotationModel m_RotationModel = new PhotonTransformViewRotationModel();

    [SerializeField]
    PhotonTransformViewScaleModel m_ScaleModel = new PhotonTransformViewScaleModel();

    PhotonTransformViewPositionControl m_PositionControl;
    PhotonTransformViewRotationControl m_RotationControl;
    PhotonTransformViewScaleControl m_ScaleControl;

    bool m_ReceivedNetworkUpdate = false;
    [Space(5)]
    //Script Needed
    [Header("Necessary script")]
    public bl_GunManager GManager;
    public bl_PlayerAnimations m_PlayerAnimation;
    //Material for apply when disable a NetGun
    public Material InvicibleMat;
    //private
    private bl_FirstPersonController Controller;
    private GameObject CurrenGun;
    private bl_PlayerSettings Settings;
    private bl_PlayerDamageManager PDM;
 private DrawName DrawName;
    private bl_RoomMenu RoomMenu;
    private bool FrienlyFire = false;
    private bool SendInfo = false;
    private CharacterController m_CController;
#if UMM
     private bl_MiniMapItem MiniMapItem = null;
#endif

#pragma warning disable 0414
    [SerializeField]
    bool ObservedComponentsFoldoutOpen = true;
#pragma warning disable 0414


    protected override void Awake()
    {
        base.Awake();
        if (!PhotonNetwork.connected)
            Destroy(this);

        //FirstUpdate = false;
        if (!this.isMine)
        {
            if (HeatTarget.gameObject.activeSelf == false)
            {
                HeatTarget.gameObject.SetActive(true);
            }
        }

        m_PositionControl = new PhotonTransformViewPositionControl(m_PositionModel);
        m_RotationControl = new PhotonTransformViewRotationControl(m_RotationModel);
        m_ScaleControl = new PhotonTransformViewScaleControl(m_ScaleModel);
        Controller = GetComponent<bl_FirstPersonController>();
        Settings = GetComponent<bl_PlayerSettings>();
        PDM = GetComponent<bl_PlayerDamageManager>();
        DrawName = GetComponent<bl_DrawName>();
        RoomMenu = FindObjectOfType<bl_RoomMenu>();
        m_CController = GetComponent<CharacterController>();
        FrienlyFire = (bool)PhotonNetwork.room.CustomProperties[PropertiesKeys.RoomFriendlyFire];
#if UMM
      MiniMapItem = this.GetComponent<bl_MiniMapItem>();
#endif
    }

    /// <summary>
    /// serialization method of photon
    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {

        m_PositionControl.OnPhotonSerializeView(transform.localPosition, stream, info);
        m_RotationControl.OnPhotonSerializeView(transform.localRotation, stream, info);
        m_ScaleControl.OnPhotonSerializeView(transform.localScale, stream, info);
        if (isMine == false && m_PositionModel.DrawErrorGizmo == true)
        {
            DoDrawEstimatedPositionError();
        }
        if (stream.isWriting)
        {
            //We own this player: send the others our data
            stream.SendNext(gameObject.name);
            stream.SendNext(HeatTarget.position);
            stream.SendNext(HeatTarget.rotation);
            stream.SendNext((int)Controller.State);
            stream.SendNext(Controller.isGrounded);
            stream.SendNext(GManager.GetCurrentWeapon().GunID);
            stream.SendNext(Settings.m_Team.ToString());
            stream.SendNext(WeaponState);
            stream.SendNext(Controller.Velocity);
        }
        else
        {
            //Network player, receive data
            RemotePlayerName = (string)stream.ReceiveNext();
            HeadPos = (Vector3)stream.ReceiveNext();
            HeadRot = (Quaternion)stream.ReceiveNext();
            m_state = (int)stream.ReceiveNext();
            m_grounded = (bool)stream.ReceiveNext();
            CurNetGun = (int)stream.ReceiveNext();
            RemoteTeam = (string)stream.ReceiveNext();
            UpperState = (string)stream.ReceiveNext();
            velocity = (Vector3)stream.ReceiveNext();

            m_ReceivedNetworkUpdate = true;
        }
    }

    private Vector3 HeadPos = Vector3.zero;// Head Look to
    private Quaternion HeadRot = Quaternion.identity;
    private int m_state;
    private bool m_grounded;
    private string RemotePlayerName = string.Empty;
    private int CurNetGun;
    private string UpperState = "";
    private Vector3 velocity;

    protected override void OnDisable()
    {
        base.OnDisable();
        if (bl_GameData.Instance.DropGunOnDeath)
        {
            NetGunsRoot.gameObject.SetActive(false);
        }
    }

    /// <summary>
    ///
    /// </summary>
    public override void OnUpdate()
    {
        ///if the player is not ours, then
        if (photonView == null || isMine == true || isConnected == false)
        {
            return;
        }

        UpdatePosition();
        UpdateRotation();
        UpdateScale();
        GetTeamRemote();

        this.HeatTarget.position = Vector3.Lerp(this.HeatTarget.position, HeadPos, Time.deltaTime * this.SmoothingDelay);
        this.HeatTarget.rotation = HeadRot;
        m_PlayerAnimation.state = m_state;//send the state of player local for remote animation
        m_PlayerAnimation.grounded = m_grounded;
        m_PlayerAnimation.velocity = velocity;
        m_PlayerAnimation.UpperState = UpperState;

        gameObject.name = RemotePlayerName;
        if(DrawName != null) { DrawName.m_PlayerName = RemotePlayerName; }
        if (!isOneTeamMode)
        {
            //Determine if remote player is teamMate or enemy
            if (RemoteTeam == (string)PhotonNetwork.player.CustomProperties[PropertiesKeys.TeamKey])
            {
                TeamMate();
            }
            else
            {
                Enemy();
            }
        }
        else
        {
            Enemy();
        }

        CurrentTPVGun();
    }

    void CurrentTPVGun(bool local = false)
    {
        if (GManager == null)
            return;

        //Get the current gun ID local and sync with remote
        bool found = false;
        foreach (bl_NetworkGun guns in NetworkGuns)
        {
            int currentID = (local) ? GManager.GetCurrentWeapon().GunID : CurNetGun;
            if (guns.GetWeaponID == currentID)
            {
                guns.gameObject.SetActive(true);
                if (!local)
                {
                    CurrenGun = guns.gameObject;
                    CurrenGun.GetComponent<bl_NetworkGun>().SetUpType();
                }
                found = true;
            }
            else
            {
                guns.gameObject.SetActive(false);
            }
        }
        if (!found) { Debug.LogWarning("Net gun with id: " + CurNetGun + " is not defined!"); }
    }

    /// <summary>
    /// use this function to set all details for enemy
    /// </summary>
    void Enemy()
    {
        PDM.DamageEnabled = true;
        DrawName.enabled = RoomMenu.SpectatorMode;
#if UMM
      if (UpperState == "Firing")
        {
            MiniMapItem.ShowItem();
        }
        else
        {
            MiniMapItem.HideItem();
        }
#endif
    }

    /// <summary>
    /// use this function to set all details for teammate
    /// </summary>
    void TeamMate()
    {
        PDM.DamageEnabled = FrienlyFire;
        DrawName.enabled = true;
        m_CController.enabled = false;

        if (!SendInfo)
        {
            SendInfo = true;
            this.GetComponentInChildren<bl_BodyPartManager>().IgnorePlayerCollider();
        }

#if UMM
   MiniMapItem.ShowItem();
#endif
    }

    /// <summary>
    ///
    /// </summary>
    public void SetNetworkWeapon(GunType weaponType)
    {
        m_PlayerAnimation.SetNetworkWeapon(weaponType);
    }

    /// <summary>
    /// public method to send the RPC shot synchronization
    /// </summary>
    public void IsFire(string m_type, float t_spread, Vector3 pos, Quaternion rot)
    {
        photonView.RPC("FireSync", PhotonTargets.Others, new object[] { m_type, t_spread, pos, rot });
    }

    /// <summary>
    /// public method to send the RPC shot synchronization
    /// </summary>
    public void IsFireGrenade(float t_spread, Vector3 pos, Quaternion rot, Vector3 angular)
    {
        photonView.RPC("FireGrenadeRpc", PhotonTargets.Others, new object[] { t_spread, pos, rot, angular });
    }

    public Transform NetGunsRoot { get { if (!bl_GameData.Instance.DropGunOnDeath) { CurrentTPVGun(true); } return NetworkGuns[0].transform.parent; } }

    /// <summary>
    /// Synchronize the shot with the current remote weapon
    /// send the information necessary so that fire
    /// impact in the same direction as the local
    /// </summary>
    [PunRPC]
    void FireSync(string m_type, float m_spread, Vector3 pos, Quaternion rot)
    {
        if (CurrenGun)
        {
            if (m_type == GunType.Machinegun.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);
            }
            else if (m_type == GunType.Shotgun.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire shotgun in networkgun
            }
            else if (m_type == GunType.Sniper.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire sniper in networkgun
            }
            else if (m_type == GunType.Burst.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().Fire(m_spread, pos, rot);//if you need add your custom fire burst in networkgun
            }
            else if (m_type == GunType.Knife.ToString())
            {
                CurrenGun.GetComponent<bl_NetworkGun>().KnifeFire();//if you need add your custom fire launcher in networkgun
            }
        }
    }

    [PunRPC]
    void FireGrenadeRpc(float m_spread, Vector3 pos, Quaternion rot,Vector3 angular)
    {
        CurrenGun.GetComponent<bl_NetworkGun>().GrenadeFire(m_spread, pos, rot, angular);
    }

    /// <summary>
    ///
    /// </summary>
    public void SetActiveGrenade(bool active)
    {
        photonView.RPC("SyncOffAmmoGrenade", PhotonTargets.Others, active);
    }

    [PunRPC]
    void SyncOffAmmoGrenade(bool active)
    {
        if (CurrenGun == null)
        {
            Debug.LogError("Grenade is not active on TPS Player");
            return;
        }
        CurrenGun.GetComponent<bl_NetworkGun>().DesactiveGrenade(active, InvicibleMat);
    }

    /// <summary>
    ///
    /// </summary>
    void GetTeamRemote()
    {
        if (RemoteTeam == Team.Recon.ToString())
        {
            Settings.m_Team = Team.Recon;
        }
        else if (RemoteTeam == Team.Delta.ToString())
        {
            Settings.m_Team = Team.Delta;
        }
        else
        {
            Settings.m_Team = Team.All;
        }
    }

#if CUSTOMIZER
    [PunRPC]
    void SyncCustomizer(string info, string p)
    {
        if (CurrenGun)
        {
            if (p == this.gameObject.name)//is mine
            {
                this.CurrenGun.GetComponent<bl_NetworkGun>().ReadCustomizer(info);
            }
        }
        else
        {
            StartCoroutine(WaitForGetGUN(info, p));
        }
    }

    IEnumerator WaitForGetGUN(string info, string p)
    {
        yield return new WaitForSeconds(2);
        this.SyncCustomizer(info, p);
    }
#endif

    /// <summary>
    ///
    /// </summary>
    void UpdatePosition()
    {
        if (m_PositionModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localPosition = m_PositionControl.UpdatePosition(transform.localPosition);
    }
    /// <summary>
    ///
    /// </summary>
    void UpdateRotation()
    {
        if (m_RotationModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localRotation = m_RotationControl.GetRotation(transform.localRotation);
    }
    /// <summary>
    ///
    /// </summary>
    void UpdateScale()
    {
        if (m_ScaleModel.SynchronizeEnabled == false || m_ReceivedNetworkUpdate == false)
        {
            return;
        }

        transform.localScale = m_ScaleControl.GetScale(transform.localScale);
    }
    /// <summary>
    ///
    /// </summary>
    void DoDrawEstimatedPositionError()
    {
        Vector3 targetPosition = m_PositionControl.GetNetworkPosition();

        Debug.DrawLine(targetPosition, transform.position, Color.red, 2f);
        Debug.DrawLine(transform.position, transform.position + Vector3.up, Color.green, 2f);
        Debug.DrawLine(targetPosition, targetPosition + Vector3.up, Color.red, 2f);
    }
    /// <summary>
    /// These values are synchronized to the remote objects if the interpolation mode
    /// or the extrapolation mode SynchronizeValues is used. Your movement script should pass on
    /// the current speed (in units/second) and turning speed (in angles/second) so the remote
    /// object can use them to predict the objects movement.
    /// </summary>
    /// <param name="speed">The current movement vector of the object in units/second.</param>
    /// <param name="turnSpeed">The current turn speed of the object in angles/second.</param>
    public void SetSynchronizedValues(Vector3 speed, float turnSpeed)
    {
        m_PositionControl.SetSynchronizedValues(speed, turnSpeed);
    }
}
Assets/MFPS/Scripts/Misc/Network/bl_PlayerSync.cs(62,10): error CS0246: The type or namespace name `DrawName' could not be found. Are you missing an assembly reference?

tecnicamente está faltando algum script ou uma linha foi apagada que geralmente fica em cima do nome da class: exemplo:
Código:
using UnityEngine;
using System.Collections;[size=14][/size]using System.Collections.Generic;[size=14][/size]namespace DrawName {[size=14][/size][RequireComponent(typeof(PhotonView))]public class bl_PlayerSync : bl_MonoBehaviour[size=14][/size]{}
}


simplesmente era um erro da versao do photon pun mas obrigado pela atenção




Samuelostgamer
Iniciante
Iniciante

PONTOS : 612
REPUTAÇÃO : 4
Respeito as regras : [RESOLVIDO] Alguem pode me ajudar? tenho esse erro aqui em um script WvDYdlf

Ver perfil do usuário

Voltar ao Topo Ir em baixo

Voltar ao Topo

- Tópicos similares

 
Permissão deste fórum:
Você não pode responder aos tópicos neste fórum