Esempio n. 1
0
    public void Shoot(BulletType type, Vector2 pos, float rot, Vector2 vel, int pID)
    {
        //Shoot bullet on server
        string s = BulletDir.toString(pos, rot, vel, pID);

        s += ":" + type;

        PhotonView pun = GetComponent <PhotonView>();

        pun.RPC("ShootServer", PhotonTargets.All, s);
        //ShootClient(type,pos,rot,vel); //Shoot bullet on client
    }
Esempio n. 2
0
	void ShootServer(string s)
	{
		BulletDir dir = new BulletDir(s);
		string[] vals = s.Split(':');
		foreach(var v in BulletOptions)
		{
			if(v.type.ToString().Equals(vals[6]))
			{
				GameObject NewBullet = (GameObject)Instantiate(v.Prefab, dir.pos, Quaternion.identity);
				NewBullet.transform.eulerAngles = new Vector3(0,0,dir.rot);
				NewBullet.GetComponent<BulletSpawn>().Init(dir.vel, true, dir.playerID);
			}
		}
	}
Esempio n. 3
0
    void ShootServer(string s)
    {
        BulletDir dir = new BulletDir(s);

        string[] vals = s.Split(':');
        foreach (var v in BulletOptions)
        {
            if (v.type.ToString().Equals(vals[6]))
            {
                GameObject NewBullet = (GameObject)Instantiate(v.Prefab, dir.pos, Quaternion.identity);
                NewBullet.transform.eulerAngles = new Vector3(0, 0, dir.rot);
                NewBullet.GetComponent <BulletSpawn>().Init(dir.vel, true, dir.playerID);
            }
        }
    }