You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
759 B
31 lines
759 B
using Photon.Realtime;
|
|
using UnityEngine;
|
|
|
|
namespace Photon.Pun.Demo.Asteroids
|
|
{
|
|
public class Bullet : MonoBehaviour
|
|
{
|
|
public Player Owner { get; private set; }
|
|
|
|
public void Start()
|
|
{
|
|
Destroy(gameObject, 3.0f);
|
|
}
|
|
|
|
public void OnCollisionEnter(Collision collision)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
|
|
public void InitializeBullet(Player owner, Vector3 originalDirection, float lag)
|
|
{
|
|
Owner = owner;
|
|
|
|
transform.forward = originalDirection;
|
|
|
|
Rigidbody rigidbody = GetComponent<Rigidbody>();
|
|
rigidbody.velocity = originalDirection * 200.0f;
|
|
rigidbody.position += rigidbody.velocity * lag;
|
|
}
|
|
}
|
|
} |