Inheritance: NetworkBehaviour
Example #1
0
        public IEnumerator SetStateTest()
        {
            var state = new NetworkEntityState
            {
                EntityId        = m_networkEntity.NetworkId.ToString(),
                ComponentStates = new List <NetworkComponentState>
                {
                    new NetworkComponentState
                    {
                        Name       = nameof(NetworkTransform),
                        Properties = new List <NetworkComponentProperty>
                        {
                            new NetworkComponentProperty {
                                Name = nameof(NetworkTransform.Position), Value = JsonSerializer.Serialize(m_expectedPosition)
                            },
                            new NetworkComponentProperty {
                                Name = nameof(NetworkTransform.Rotation), Value = JsonSerializer.Serialize(m_expectedRotation)
                            },
                        }
                    }
                }
            };

            yield return(null);

            m_networkEntity.HasLocalAuthority = false;
            m_networkEntity.SetState(state, 0);

            yield return(null);

            Assert.AreEqual(m_expectedPosition, m_networkEntity.transform.position);
            Assert.AreEqual(m_expectedRotation, m_networkEntity.transform.rotation);
        }
    void Start()
    {
        _networkState = this.GetComponentInChildren <NetworkEntityState>();
        _startPos     = _networkState.transform.position;

        if (_networkState.PrefabType == PrefabType.Npc)
        {
            InvokeRepeating("chooseDestination", 0, 2);
        }
    }
    void Start()
    {
        _networkState = this.GetComponentInChildren<NetworkEntityState>();
        _startPos = _networkState.transform.position;

        if (_networkState.PrefabType == PrefabType.Npc)
        {
            InvokeRepeating("chooseDestination", 0, 2);
        }
    }
    void Start()
    {
        _networkState = this.GetComponentInChildren <NetworkEntityState>();

        var material = this.GetComponent <MeshRenderer>().material;

        if (_networkState.PrefabType == PrefabType.Player)
        {
            material.color = Color.green;
        }
        else
        {//npc
            material.color = Color.red;
        }
    }
    void Start()
    {
        _networkState = this.GetComponentInChildren<NetworkEntityState>();

        var material = this.GetComponent<MeshRenderer>().material;
        if (_networkState.PrefabType == PrefabType.Player)
        {
            material.color = Color.green;
        }
        else
        {//npc

            material.color = Color.red;
        }
    }
 void Start()
 {
     _networkState            = this.GetComponentInChildren <NetworkEntityState> ();
     _networkState.PrefabType = PrefabType.Npc;
     if (desplazamiento != null)
     {
         if (desplazamiento == true)
         {
             rg.AddForce(new Vector3(0.5f, 0f, 0f) * repulsion * Time.deltaTime);
         }
         else
         {
             rg.AddForce(new Vector3(-0.5f, 0f, 0f) * repulsion * Time.deltaTime);
         }
     }
 }
Example #7
0
 void Awake()
 {
     _networkState            = this.GetComponentInChildren <NetworkEntityState>();
     _networkState.PrefabType = PrefabType.Player;
 }