using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;
public class MPPLayer : NetworkBehaviour
{
private Rigidbody2D rig;
[SerializeField] private float Speed = 5;
public static GameObject bullet;
void Start()
{
rig = GetComponent<Rigidbody2D>();
}
private void FixedUpdate()
{
if(!isLocalPlayer){
return;
}
float H = Input.GetAxis("Horizontal");
rig.velocity = new Vector2(H*Speed, 0);
if(Input.GetKeyDown("space"))
{
GameObject BulletPR = (GameObject)Resources.Load("Prefabs/MP/Bullet", typeof(GameObject));
NetworkServer.Spawn(BulletPR);
//Vector2 wruseyr = transform.position + new Vector3(0,1.5f,0);
//Quaternion qweqwe = Quaternion.Euler(0,0,90);
//Instantiate(BulletPR,transform.position + new Vector3(0,1.5f,0),Quaternion.Euler(0,0,-90));
}
}
public override void OnStartLocalPlayer()
{
GetComponent<SpriteRenderer>().color = Color.red;
gameObject.tag = "Player";
base.OnStartLocalPlayer();
}
}