·
This commit is contained in:
parent
8866aa0e4b
commit
73e6e23b25
@ -105,6 +105,7 @@ MonoBehaviour:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 100
|
||||
m_enableAdvanceTextProcess: 0
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
|
||||
@ -643,7 +643,7 @@ MonoBehaviour:
|
||||
muzzleFlare: {fileID: 4000010921236120, guid: 6a0a0f7a97e0e7747accda091cb14743,
|
||||
type: 3}
|
||||
bullet: {fileID: 4010437552377404, guid: 3e8f90cf5ace53541b8523ce5200cdc5, type: 3}
|
||||
continueShotCount: 2
|
||||
continueShotCount: 3
|
||||
turret: {fileID: 1898544591301130533}
|
||||
gun: {fileID: 5342608149001152939}
|
||||
shotAudioClip: {fileID: 8300000, guid: 038911361e37ae84b8fdc585b7b83895, type: 3}
|
||||
|
||||
@ -359,7 +359,7 @@ public class Shot : MonoBehaviour
|
||||
if ((isAutoLock || initBulletPos != null) && lockEnemy != null && !lockEnemy.IsDestroyed())
|
||||
{
|
||||
bulletComp.LockTarget = lockEnemy;
|
||||
bulletComp.ShotTargetPosition = bulletComp.LockTarget.transform.position;
|
||||
bulletComp.ShotTargetPosition = lockEnemy.transform.position;
|
||||
//bulletObj.transform.LookAt(targetPos);
|
||||
}
|
||||
else
|
||||
@ -381,9 +381,9 @@ public class Shot : MonoBehaviour
|
||||
|
||||
muzzleObj.transform.LookAt(bulletComp.ShotTargetPosition);
|
||||
}
|
||||
Vector3? lockTargetPos = null;
|
||||
|
||||
|
||||
var worldTop = _cam.ScreenToWorldPoint(new Vector3(0, Screen.height, _cam.nearClipPlane));
|
||||
//var worldTop = _cam.ScreenToWorldPoint(new Vector3(0, Screen.height, _cam.nearClipPlane));
|
||||
//var yDistance = worldTop.z - transform.position.z;
|
||||
//float shotDuration = 1f / shotSpeed;
|
||||
// DOTween.To:动态更新弹体位置(每帧计算目标位置)
|
||||
@ -391,7 +391,10 @@ public class Shot : MonoBehaviour
|
||||
() => bulletObj == null ? transform.position : bulletObj.position, // 当前位置(Getter)
|
||||
(Vector3 pos) =>
|
||||
{
|
||||
if (bulletObj != null) { bulletObj.position = Vector3.MoveTowards(bulletObj.position, bulletComp.ShotTargetPosition, Time.deltaTime * shotSpeed); } // 更新位置(Setter)
|
||||
if (bulletObj != null)
|
||||
{
|
||||
bulletObj.position = Vector3.MoveTowards(bulletObj.position, bulletComp.ShotTargetPosition, Time.deltaTime * shotSpeed);
|
||||
} // 更新位置(Setter)
|
||||
},
|
||||
tmpTargetPos,
|
||||
shotSpeed
|
||||
@ -446,9 +449,10 @@ public class Shot : MonoBehaviour
|
||||
//非自动锁定状态,在轨迹更新过程中也判断是否击中
|
||||
if (!isAutoLock)
|
||||
{
|
||||
CheckBulletBoom(bulletComp, bulletComp.LockTarget);
|
||||
CalcBulletBoom(bulletComp, bulletComp.LockTarget);
|
||||
}
|
||||
|
||||
//暂存击中的目标位置
|
||||
lockTargetPos = CheckBulletBoom(bulletComp, true);
|
||||
})
|
||||
.OnPlay(() =>
|
||||
{
|
||||
@ -459,7 +463,8 @@ public class Shot : MonoBehaviour
|
||||
//{
|
||||
//Debug.Log(currentShotCount);
|
||||
//}
|
||||
bulletComp.LockTarget = CheckBulletBoom(bulletComp, bulletComp.LockTarget);
|
||||
|
||||
bulletComp.LockTarget = CalcBulletBoom(bulletComp, bulletComp.LockTarget);
|
||||
|
||||
if (bulletComp.LockTarget != null && hitAudioClip != null)
|
||||
{
|
||||
@ -477,18 +482,22 @@ public class Shot : MonoBehaviour
|
||||
{
|
||||
//SingleShot(nextLockTarget, bulletComp.transform.position, bulletComp.transform);//弹射
|
||||
|
||||
PoolTool.RecycleBulletToPool(bulletObj, this.bulletPool, this.activeBulletPool);
|
||||
lockTargetPos = CheckBulletBoom(bulletComp, false);
|
||||
//InitBulletPos = lockTargetPos,从击中的目标位置开始弹射
|
||||
nextShotInfos.Enqueue(new NextShotInfo { CurrentShotCount = currentShotCount, Enemy = nextLockTarget, InitBulletPos = lockTargetPos });
|
||||
|
||||
nextShotInfos.Enqueue(new NextShotInfo { CurrentShotCount = currentShotCount, Enemy = nextLockTarget, InitBulletPos = bulletObj.position });
|
||||
PoolTool.RecycleBulletToPool(bulletObj, this.bulletPool, this.activeBulletPool);
|
||||
//SingleShot(nextLockTarget, true, currentShotCount, bulletObj.position, null);//连线射击
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckBulletBoom(bulletComp, false);
|
||||
PoolTool.RecycleBulletToPool(bulletObj, this.bulletPool, this.activeBulletPool);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CheckBulletBoom(bulletComp, false);
|
||||
PoolTool.RecycleTarget(bulletObj, muzzleObj, this.bulletPool, this.activeBulletPool, this.muzzlePool, this.activeImpactPool);
|
||||
}
|
||||
});
|
||||
@ -541,15 +550,39 @@ public class Shot : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private Enemy CheckBulletBoom(Bullet bulletComp, Enemy lockTarget)
|
||||
private Vector3? CheckBulletBoom(Bullet bulletComp, bool withCallback)
|
||||
{
|
||||
if (!isAutoLock)
|
||||
Vector3? hitPosition = null;
|
||||
Enemy hittedEnemy = bulletComp.hittedEnemy;
|
||||
if (hittedEnemy != null)
|
||||
{
|
||||
if (bulletComp.hittedEnemy != null)
|
||||
//Calc is Boom
|
||||
hitPosition = hittedEnemy.transform.position;
|
||||
bool isDestroyed = hittedEnemy.TakeDamage(bulletComp.power);//对敌方造成伤害
|
||||
Vector3 targetDir = (bulletComp.transform.position - hitPosition.Value).normalized;
|
||||
|
||||
var impact = PoolTool.GetFromPool(this.impactPool, this.activeBulletPool, this.activeImpactPool); //Instantiate(impactPrefab, point, rot);
|
||||
bulletComp.InitImpact(hitPosition.Value, targetDir, impact);//爆炸效果
|
||||
if (isDestroyed)
|
||||
{
|
||||
lockTarget = bulletComp.hittedEnemy;
|
||||
if (bulletComp.Tweener != null)
|
||||
{
|
||||
bulletComp.Tweener.Complete(withCallback);
|
||||
}
|
||||
bulletComp.transform.DOKill();
|
||||
lockEnemy = null;
|
||||
}
|
||||
}
|
||||
return hitPosition;
|
||||
}
|
||||
|
||||
|
||||
private Enemy CalcBulletBoom(Bullet bulletComp, Enemy lockTarget)
|
||||
{
|
||||
if (bulletComp.hittedEnemy != null)
|
||||
{
|
||||
lockTarget = bulletComp.hittedEnemy;
|
||||
}
|
||||
// 命中检测(距离达标则触发效果)
|
||||
if (bulletComp.gameObject != null)
|
||||
{
|
||||
@ -572,22 +605,7 @@ public class Shot : MonoBehaviour
|
||||
float currentDistance = Vector3.Distance(bulletComp.transform.position, lockTarget.transform.position);
|
||||
isNeedDestroy = currentDistance < hitDistance;
|
||||
}
|
||||
var lockTargetPosition = lockTarget.transform.position;
|
||||
bulletComp.currentHitPosition = lockTargetPosition;
|
||||
bool isDestroyed = lockTarget.TakeDamage(bulletComp.power);//对敌方造成伤害
|
||||
Vector3 targetDir = (bulletComp.transform.position - lockTargetPosition).normalized;
|
||||
|
||||
var impact = PoolTool.GetFromPool(this.impactPool, this.activeBulletPool, this.activeImpactPool); //Instantiate(impactPrefab, point, rot);
|
||||
bulletComp.InitImpact(lockTargetPosition, targetDir, impact);//爆炸效果
|
||||
if (isDestroyed)
|
||||
{
|
||||
if (bulletComp.Tweener != null)
|
||||
{
|
||||
bulletComp.Tweener.Complete(true);
|
||||
}
|
||||
bulletComp.transform.DOKill();
|
||||
lockEnemy = null;
|
||||
}
|
||||
bulletComp.currentHitPosition = lockTarget.transform.position;
|
||||
}
|
||||
//if (isDestroyed)
|
||||
//{
|
||||
@ -662,15 +680,7 @@ public class Shot : MonoBehaviour
|
||||
float distance = Vector3.Distance(enemy.transform.position, targetPosition);
|
||||
if (distance < minDistance && distance <= shotDistance)// && (ringManager == null || distance > ringManager.radius * 1.2f))// && !Global.LockedEnemies.ContainsKey(enemy.GetHashCode()))
|
||||
{
|
||||
if (_cam.orthographic)
|
||||
{
|
||||
if (VisibilityTool.IsObjectInFrustum(enemy.gameObject, _cam))
|
||||
{
|
||||
minDistance = distance;
|
||||
result = enemy;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (VisibilityTool.IsObjectInFrustum(enemy.gameObject, _cam))
|
||||
{
|
||||
minDistance = distance;
|
||||
result = enemy;
|
||||
|
||||
@ -29,7 +29,7 @@ MonoBehaviour:
|
||||
HideAfterCallMain: 1
|
||||
preloadFiles:
|
||||
Orientation: 0
|
||||
bgImageSrc: Assets/TowerDefence/Images/SplashScreen/SplashScreen.jpg
|
||||
bgImageSrc: Assets/Game1/Images/SplashScreen/SplashScreen2.jpg
|
||||
dataFileSubPrefix:
|
||||
maxStorage: 200
|
||||
defaultReleaseSize: 31457280
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
"com.unity.inputsystem": "1.14.0",
|
||||
"com.unity.render-pipelines.universal": "14.1.0",
|
||||
"com.unity.test-framework": "1.1.33",
|
||||
"com.unity.textmeshpro": "3.0.7",
|
||||
"com.unity.textmeshpro": "3.0.9",
|
||||
"com.unity.timeline": "1.7.7",
|
||||
"com.unity.ugui": "1.0.0",
|
||||
"com.unity.visualeffectgraph": "14.1.0",
|
||||
|
||||
@ -164,7 +164,7 @@
|
||||
"url": "https://packages.tuanjie.cn"
|
||||
},
|
||||
"com.unity.textmeshpro": {
|
||||
"version": "3.0.7",
|
||||
"version": "3.0.9",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
@ -177,9 +177,9 @@
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.modules.audio": "1.0.0",
|
||||
"com.unity.modules.director": "1.0.0",
|
||||
"com.unity.modules.animation": "1.0.0",
|
||||
"com.unity.modules.audio": "1.0.0",
|
||||
"com.unity.modules.particlesystem": "1.0.0"
|
||||
},
|
||||
"url": "https://packages.tuanjie.cn"
|
||||
|
||||
@ -42,7 +42,7 @@ PlayerSettings:
|
||||
height: 1
|
||||
m_SplashScreenLogos: []
|
||||
m_VirtualRealitySplashScreen: {fileID: 0}
|
||||
expectedBundleIdentifier: com.xsoft.UMiniGame
|
||||
expectedBundleIdentifier: com.Unity-Technologies.com.unity.template.urp-blank
|
||||
integrityHash:
|
||||
m_HolographicTrackingLossScreen: {fileID: 0}
|
||||
defaultScreenWidth: 1024
|
||||
@ -1020,7 +1020,7 @@ PlayerSettings:
|
||||
-s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=256MB -s EXPORTED_RUNTIME_METHODS=''["ccall","cwrap","stackTrace","addRunDependency","removeRunDependency","FS_createPath","FS_createDataFile","stackTrace","writeStackCookie","checkStackCookie","lengthBytesUTF8","stringToUTF8"]''
|
||||
--profiling-funcs '
|
||||
weixinMiniGameModulesDirectory:
|
||||
weixinMiniGameTemplate: PATH:E:\Dev3\UMiniGame\Library\PackageCache\com.qq.weixin.minigame@4443e5a9bc\WebGLTemplates\WXTemplate2022TJ
|
||||
weixinMiniGameTemplate: PATH:H:\Dev\UMiniGame\Library\PackageCache\com.qq.weixin.minigame@4443e5a9bc\WebGLTemplates\WXTemplate2022TJ
|
||||
weixinMiniGameAnalyzeBuildSize: 0
|
||||
weixinMiniGameUseEmbeddedResources: 0
|
||||
weixinMiniGameCompressionFormat: 2
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
m_EditorVersion: 2022.3.61t8
|
||||
m_EditorVersionWithRevision: 2022.3.61t8 (4d1c4dc33c81)
|
||||
m_TuanjieEditorVersion: 1.6.7
|
||||
m_EditorVersion: 2022.3.61t9
|
||||
m_EditorVersionWithRevision: 2022.3.61t9 (2e9db1b79d2d)
|
||||
m_TuanjieEditorVersion: 1.6.8
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user