@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:7abdd52fffdae58812a259189e853c543358c7c219c21b883aa0a70a621cd3bf | |||||
size 1313 | |||||
oid sha256:3fb94665e70a106a7e0a4ca21efd8c70634b208c2c9bcc75a6601c8a846c559b | |||||
size 1186 |
@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:14a02c7122e6f6e41dded7d660f2ebfb079e12d62f6ed497703aedb690d199bf | |||||
size 652 | |||||
oid sha256:1c5150ee7821bd6752635df7a4e75e522e5c83949bf6a3b2b8fdcd6d29b41b9a | |||||
size 579 |
@ -0,0 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | |||||
oid sha256:1407c67c7a52ce8f47e9373bd2c3663187ab8993f107ef768d5db368c59bc873 | |||||
size 573 |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 8e35fa076afd0b64490ee8a934237e40 | |||||
NativeFormatImporter: | |||||
externalObjects: {} | |||||
mainObjectFileID: 11400000 | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:29eb5a502a740f7952ebc9213d321f98813c16fbd20cd57fd5ba49e29ffc03b3 | |||||
size 629 | |||||
oid sha256:cf1896bd1ad950c5c2fee7f7eeb876eff9e417c4c2eb98d306ff0b934bbc58a2 | |||||
size 553 |
@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:f51e51a8146405e8694589cab181e716a7163fc9b631e1735bf212abb5aed33a | |||||
size 630 | |||||
oid sha256:6bdd547d763d7db6d48e22fcb947601c11bc5adca2e6e02550e96e25d40a4de1 | |||||
size 566 |
@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:d4dc2709949a4748e68da5170dd7c30cfd67987f109ad28214561d6eddc46dd1 | |||||
size 631 | |||||
oid sha256:3ea01fc0d3ad9bf270994843c6d532111ce194ac30849cc9a7336f94cb11da44 | |||||
size 571 |
@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:dc8815845149e2879b2e1fc3a0a8dc47e3b28887cdd28481eadf66824476be0b | |||||
oid sha256:0f523990c61fcbf64c1b736d9c37e0253db2a84eef7d517857b173d2adc7f9ba | |||||
size 561 | size 561 |
@ -0,0 +1,7 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 0cf1a8d5531d3eb44bb52de9028f95f2 | |||||
PrefabImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,82 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using System.Linq; | |||||
using UnityEngine; | |||||
using Networking.Server; | |||||
public class HomingMissile : Projectile | |||||
{ | |||||
[SerializeField] | |||||
ClientList Clients; | |||||
public override IEnumerator ProjectileLogic(Character player, float animationTime, Vector3 direction) | |||||
{ | |||||
Character target = findPlayer(player); | |||||
yield return StartCoroutine(LerpTo(transform.position + Vector3.up * 2, 0.5f)); | |||||
yield return new WaitForSeconds(0.5f); | |||||
if (target != null) | |||||
{ | |||||
yield return StartCoroutine(LerpTo(target.transform.position, 1f)); | |||||
yield return PushPlayer(target); | |||||
} | |||||
} | |||||
private IEnumerator PushPlayer(Character player) | |||||
{ | |||||
Direction[] possibleDirections = DirectionExtras.RandomOrder(); | |||||
for (int i = 0; i < 4; i++) | |||||
{ | |||||
if (Block.isBlockAtPosition( player.transform.position + possibleDirections[i].ToVector() + Vector3.up, 1, ~0)) | |||||
continue; | |||||
yield return StartCoroutine(player.CurrentBlock.DoPush(player, possibleDirections[i].ToVector())); | |||||
break; | |||||
} | |||||
} | |||||
private Character findPlayer(Character thisCharacter) | |||||
{ | |||||
Character retVal = null; | |||||
foreach (ClientData client in Clients) | |||||
{ | |||||
if (client.Lives == 0 || client.playerCharacter.stuck || client.playerCharacter == thisCharacter) | |||||
continue; | |||||
if (retVal == null) | |||||
retVal = client.playerCharacter; | |||||
if (retVal.transform.position.x <= client.playerCharacter.transform.position.x) | |||||
retVal = client.playerCharacter; | |||||
} | |||||
return retVal; | |||||
} | |||||
private IEnumerator LerpTo(Vector3 endPosition,float animationTime) | |||||
{ | |||||
Vector3 startPosition = transform.position; | |||||
float elapsedTime = 0; | |||||
while (elapsedTime < animationTime) | |||||
{ | |||||
transform.position = Vector3.Lerp(startPosition, endPosition, elapsedTime / animationTime); | |||||
transform.LookAt(endPosition, Vector3.up); | |||||
yield return new WaitForEndOfFrame(); | |||||
elapsedTime += Time.deltaTime; | |||||
} | |||||
transform.position = endPosition; | |||||
} | |||||
} |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: ede68cce804b6624cb4c368d5c511f49 | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |