private void PlayerShoot_OnShoot(object sender, Shoot.OnShootEventArgs e) { Vector3 quadPosition = e.gunEndPointPosition; // Vector3 quadSize = new Vector3(.1f, .2f); // float rotation = 0f; Vector3 shootDir = (e.shootPosition - e.gunEndPointPosition).normalized; quadPosition += shootDir * -.2f + Vector3.up * 0.1f; Vector3 shellMoveDir = Quaternion.Euler(0, 0, Random.Range(95f, 125f)) * shootDir; // Vector3 shellMoveDir = Quaternion.AngleAxis(Random.Range(95f, 125f), Vector3.up) * shootDir; ShellParticleSystemHandler.Instance.SpawnShell(quadPosition, shellMoveDir); // int uvIndex = UnityEngine.Random.Range(0, 8); // int spawnedQuadIndex = AddQuad(quadPosition, rotation, quadSize, true, uvIndex); // FunctionUpdater.Create(() => // { // quadPosition += new Vector3(1, 1) * Time.deltaTime; // // quadSize += new Vector3(1, 1) * Time.deltaTime; // // rotation += 360f * Time.deltaTime; // UpdateQuad(spawnedQuadIndex, quadPosition, rotation, quadSize, true, uvIndex); // }); }
private void Player_OnShoot(object sender, Shoot.OnShootEventArgs e) { impulseSource.GenerateImpulse(); //mesh or vfx if (traceOption == 0) { Vector2 shootDirection = (e.shootPosition - e.gunEndPointPosition).normalized; BulletRaycast.ShootRay(e.gunEndPointPosition, shootDirection); WeaponTracer(e.gunEndPointPosition, BulletRaycast.rayEndPoint); // Debug.DrawLine(e.gunEndPointPosition, BulletRaycast.rayEndPoint, Color.white, 1); } else { playerShoot.bulletFX.Emit(1); } }