示例#1
0
    void Fire()
    {
        if (fire_pressed)
        {
            var groupID = manager.AllocateID();
            var clone   = (GameObject)Network.Instantiate(projectile, spawnPoint.position, spawnPoint.rotation, groupID);
            clone.GetComponent <Projectile>().groupID = groupID;
            Debug.Log("Group: " + clone.networkView.group);

            clone.rigidbody.velocity = rigidbody.velocity;
            clone.rigidbody.AddForce(spawnPoint.forward * force);
            fire_timer   = 1 / fire_rate;
            fire_pressed = false;
        }
    }