Example #1
0
    void CmdThrowFireball()
    {
        GameObject instance = Instantiate(FireBall, transform.position + transform.up * 0.4f, transform.rotation) as GameObject;

        instance.GetComponent <Rigidbody> ().velocity = instance.transform.forward * 10f;
        FireBall ballScript = instance.GetComponent <FireBall>();

        ballScript.initDamage(damage);
        ballScript.InitID(gameObject.GetComponent <NetworkIdentity>().netId);
        ballScript.SetOrigin(gameObject);
        NetworkServer.Spawn(instance);
        Destroy(instance, 5f);
    }