Exemplo n.º 1
0
    public void Shoot(string bulletname, Vector3 position, Vector3 direction, int bulletNumber, string shooter, PhotonMessageInfo info)
    {
        bulletNum++;
        float      angle         = Mathf.Atan2(direction.y, direction.x);
        GameObject spawnedBullet = Instantiate(Resources.Load <GameObject>(bulletname), position, Quaternion.Euler(0, 0, angle * Mathf.Rad2Deg - 90));
        //GameObject spawnedBullet = Instantiate(bullets[Random.Range(0, bullets.Count)], position, Quaternion.Euler(direction));
        BulletMove bulletMoveScript = spawnedBullet.GetComponent <BulletMove>();

        bulletMoveScript.setStartPosition(position);
        bulletMoveScript.SetDirection(direction.normalized);
        bulletMoveScript.setPlayer(shooter);
        bulletMoveScript.setBulletNumber(bulletNumber);
        bulletMoveScript.setCreateTime(Mathf.Abs((float)Time.time));//info.SentServerTime
        spawnedProjectiles.Add(spawnedBullet);
    }