diff --git a/Assets/MultiplayerPrefab/Projectiles_magic.prefab b/Assets/MultiplayerPrefab/Projectiles_magic.prefab index c4dd6326..c08be48a 100644 --- a/Assets/MultiplayerPrefab/Projectiles_magic.prefab +++ b/Assets/MultiplayerPrefab/Projectiles_magic.prefab @@ -4833,15 +4833,13 @@ ParticleSystemRenderer: m_RenderAlignment: 2 m_Pivot: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 m_EnableGPUInstancing: 1 m_ApplyActiveColorSpace: 1 m_AllowRoll: 1 m_FreeformStretching: 0 m_RotateWithStretchDirection: 1 - m_UseCustomVertexStreams: 0 m_VertexStreams: 00010304 - m_UseCustomTrailVertexStreams: 0 - m_TrailVertexStreams: 00010304 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} m_Mesh2: {fileID: 0} @@ -9751,15 +9749,13 @@ ParticleSystemRenderer: m_RenderAlignment: 3 m_Pivot: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 m_EnableGPUInstancing: 1 m_ApplyActiveColorSpace: 1 m_AllowRoll: 1 m_FreeformStretching: 0 m_RotateWithStretchDirection: 1 - m_UseCustomVertexStreams: 0 m_VertexStreams: 00010304 - m_UseCustomTrailVertexStreams: 0 - m_TrailVertexStreams: 00010304 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} m_Mesh2: {fileID: 0} @@ -14763,15 +14759,13 @@ ParticleSystemRenderer: m_RenderAlignment: 3 m_Pivot: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 m_EnableGPUInstancing: 1 m_ApplyActiveColorSpace: 1 m_AllowRoll: 1 m_FreeformStretching: 0 m_RotateWithStretchDirection: 1 - m_UseCustomVertexStreams: 0 m_VertexStreams: 00010304 - m_UseCustomTrailVertexStreams: 0 - m_TrailVertexStreams: 00010304 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} m_Mesh2: {fileID: 0} @@ -19681,15 +19675,13 @@ ParticleSystemRenderer: m_RenderAlignment: 3 m_Pivot: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 m_EnableGPUInstancing: 1 m_ApplyActiveColorSpace: 1 m_AllowRoll: 1 m_FreeformStretching: 0 m_RotateWithStretchDirection: 1 - m_UseCustomVertexStreams: 0 m_VertexStreams: 00010304 - m_UseCustomTrailVertexStreams: 0 - m_TrailVertexStreams: 00010304 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} m_Mesh2: {fileID: 0} @@ -24589,15 +24581,13 @@ ParticleSystemRenderer: m_RenderAlignment: 0 m_Pivot: {x: 0, y: 0, z: 0} m_Flip: {x: 0, y: 0, z: 0} + m_UseCustomVertexStreams: 0 m_EnableGPUInstancing: 1 m_ApplyActiveColorSpace: 1 m_AllowRoll: 1 m_FreeformStretching: 0 m_RotateWithStretchDirection: 1 - m_UseCustomVertexStreams: 0 m_VertexStreams: 00010304 - m_UseCustomTrailVertexStreams: 0 - m_TrailVertexStreams: 00010304 m_Mesh: {fileID: 0} m_Mesh1: {fileID: 0} m_Mesh2: {fileID: 0} @@ -24649,7 +24639,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3} m_Name: m_EditorClassIdentifier: - clientStarted: 1 + clientStarted: 0 sceneId: 0 _assetId: 1059374897 serverOnly: 0 @@ -24667,7 +24657,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a553cb17010b2403e8523b558bffbc14, type: 3} m_Name: m_EditorClassIdentifier: - syncDirection: 1 + syncDirection: 0 syncMode: 0 syncInterval: 0 target: {fileID: 7706410961180048727} diff --git a/Assets/MultiplayerPrefab/char1.prefab b/Assets/MultiplayerPrefab/char1.prefab index d6184053..6b8f097c 100644 --- a/Assets/MultiplayerPrefab/char1.prefab +++ b/Assets/MultiplayerPrefab/char1.prefab @@ -9131,6 +9131,7 @@ MonoBehaviour: currentQuest: {fileID: 0} questActions: [] completedQuests: [] + projectile: {fileID: 8407628868844321581, guid: 845dd5352c7714440a8d537e79b36ed1, type: 3} isLoaded: 0 playerAttack: {fileID: 0} isDead: 0 diff --git a/Assets/Script/PlayerAttack.cs b/Assets/Script/PlayerAttack.cs index 163298a9..79ef08e0 100755 --- a/Assets/Script/PlayerAttack.cs +++ b/Assets/Script/PlayerAttack.cs @@ -78,38 +78,22 @@ public class PlayerAttack : NetworkBehaviour{ if(pnet.health<=0){return;} Vector3 direction = GetPlayerLookDir(); - if(isServer){ - magicalAttack(direction); - }else{ + //if(isServer){ + pnet.MagicalAttack(direction, magicalProjectileSpawnOffset, damage); + /*}else{ + Debug.Log(direction); CmdMagicalAttack(direction); - } - return; - Debug.Log("direction Magic"+ direction); - GameObject projectileSpawned = Instantiate(projectile , transform.position + (direction * magicalProjectileSpawnOffset) , Quaternion.identity); - projectileSpawned.GetComponent().direction = direction; - projectileSpawned.GetComponent().OnHit.AddListener(OnMagicalHit); + }*/ } - [Command] + /* [Command] void CmdMagicalAttack(Vector3 direction){ magicalAttack(direction); - } + }*/ - void magicalAttack(Vector3 direction){ -GameObject projectileSpawned = Instantiate(projectile , transform.position + (direction * magicalProjectileSpawnOffset) , Quaternion.identity); - RangeProjectile _projectile = projectileSpawned.GetComponent(); - _projectile.direction = direction; - _projectile.OnHit.AddListener(OnMagicalHit); - _projectile.shooterId = netId; + - NetworkServer.Spawn(projectileSpawned); - } - - void OnMagicalHit(enemyScript victim){ - int damageamount = damage + (pnet.lvl*5); - - victim.TakeMagicalDamage(damageamount, netId); - } + Vector3 GetPlayerLookDir(){ Vector3 direction = Vector3.right; diff --git a/Assets/Script/RangeProjectile.cs b/Assets/Script/RangeProjectile.cs index bc02e553..561dc377 100644 --- a/Assets/Script/RangeProjectile.cs +++ b/Assets/Script/RangeProjectile.cs @@ -77,10 +77,26 @@ public class RangeProjectile : NetworkBehaviour void DestroyProjectile(){ //Instantiate hit effect - Instantiate(hitEffectVfx , transform.position , Quaternion.identity); - Destroy(gameObject); + if (isServer) + { + RpcDestroyProjectile(); + destroyProjectile(); + } //Destroy(hitEffectVfx, hitLifetime); } + + [ClientRpc] + void RpcDestroyProjectile() + { + destroyProjectile(); + } + + + void destroyProjectile() + { + Instantiate(hitEffectVfx, transform.position, Quaternion.identity); + Destroy(gameObject); + } void OnDrawGizmos(){ Gizmos.DrawWireSphere(transform.position, castRadius); diff --git a/Assets/Script/playerNetwork.cs b/Assets/Script/playerNetwork.cs index 473db7f0..6e88c21c 100755 --- a/Assets/Script/playerNetwork.cs +++ b/Assets/Script/playerNetwork.cs @@ -148,6 +148,8 @@ public class playerNetwork : NetworkBehaviour public List questActions; public List completedQuests; + public GameObject projectile; + public void QuestFunction(QuestScriptable questData){ currentQuest = questData; questText.text = questData.questTitle; @@ -690,11 +692,60 @@ public class playerNetwork : NetworkBehaviour void CmdDropPickup(string type){ GameManager.instance.SpawnPickup(type,transform.position + new Vector3(4,0)); } - public void GoBackMenu(){ + + + int magicalDmg = 0; + + + public void MagicalAttack(Vector3 direction, float magicalProjectileSpawnOffset, int dmg) + { + if (isServer) + { + magicalAttack(direction, magicalProjectileSpawnOffset, dmg); + } + else + { + CmdMagicalAttack(direction, magicalProjectileSpawnOffset, dmg); + } + } + + + [Command] + void CmdMagicalAttack(Vector3 direction, float magicalProjectileSpawnOffset, int dmg) + { + magicalAttack(direction, magicalProjectileSpawnOffset, dmg); + } + + void magicalAttack(Vector3 direction, float magicalProjectileSpawnOffset, int dmg) + { + magicalDmg = dmg; + GameObject projectileSpawned = Instantiate(projectile, transform.position + (direction * magicalProjectileSpawnOffset), Quaternion.identity); + RangeProjectile _projectile = projectileSpawned.GetComponent(); + _projectile.direction = direction; + _projectile.OnHit.AddListener(OnMagicalHit); + _projectile.shooterId = netId; + + NetworkServer.Spawn(projectileSpawned); + } + + + + void OnMagicalHit(enemyScript victim) + { + int damageamount = magicalDmg + (lvl * 5); + + victim.TakeMagicalDamage(damageamount, netId); + } + + + + + + public void GoBackMenu(){ startClient.instance.networkManager.StopClient(); SceneManager.LoadScene("GameLogin"); -#if UNITY_EDITOR || UNITY_SERVER +#if UNITY_EDITOR || UNITY_SERVER || UNITY_STANDALONE_WIN #else PlayGamesPlatform.Instance.SignOut(); Firebase.Auth.FirebaseAuth.DefaultInstance.SignOut(); diff --git a/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/ProjectSettings/BurstAotSettings_StandaloneWindows.json new file mode 100644 index 00000000..58cf25f2 --- /dev/null +++ b/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -0,0 +1,18 @@ +{ + "MonoBehaviour": { + "Version": 4, + "EnableBurstCompilation": true, + "EnableOptimisations": true, + "EnableSafetyChecks": false, + "EnableDebugInAllBuilds": false, + "DebugDataKind": 1, + "EnableArmv9SecurityFeatures": false, + "CpuMinTargetX32": 0, + "CpuMaxTargetX32": 0, + "CpuMinTargetX64": 0, + "CpuMaxTargetX64": 0, + "CpuTargetsX32": 6, + "CpuTargetsX64": 72, + "OptimizeFor": 0 + } +}