Exemple #1
0
        /// <summary>
        /// Player with local authority fires by calling this. This tells the NST to create a custom message and attach your data to it.
        /// </summary>
        /// <param name="wid"></param>
        public void PlayerFire()
        {
            PlayerFireCustomMsg customMsg = new PlayerFireCustomMsg
            {
                weaponId = (byte)weaponId,
                color    = new Color(Random.value,
                                     Random.value, Random.value),
            };

            NetworkSyncTransform.SendCustomEventSimple(customMsg);
        }
Exemple #2
0
    /// <summary>
    /// Player with local authority fires by calling this. This tells the NST to create a custom message and attach your data to it.
    /// </summary>
    /// <param name="wid"></param>
    public void PlayerFire(WeaponType w)
    {
        int  hitId   = 0;
        uint hitmask = 0;

        if (w == WeaponType.Hitscan)
        {
            hitmask = CastRay(transform.position, transform.rotation, out hitId);
        }

        PlayerFireCustomMsg customMsg = new PlayerFireCustomMsg
        {
            weaponId = (byte)w,
            color    = new Color(Random.value,
                                 Random.value, Random.value), hitmask = hitmask
        };

        NetworkSyncTransform.SendCustomEventSimple(customMsg);
    }