Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SandwormAI
- public override void OnCollideWithPlayer(Collider other)
- {
- base.OnCollideWithPlayer(other);
- if (!isEnemyDead && emerged)
- {
- PlayerControllerB component = other.gameObject.GetComponent<PlayerControllerB>();
- if (component != null && component.inAnimationWithEnemy == null && component == GameNetworkManager.Instance.localPlayerController)
- {
- EatPlayer(component);
- }
- }
- }
- public void EatPlayer(PlayerControllerB playerScript)
- {
- if (playerScript.inSpecialInteractAnimation && playerScript.currentTriggerInAnimationWith != null)
- {
- playerScript.currentTriggerInAnimationWith.CancelAnimationExternally();
- }
- playerScript.inAnimationWithEnemy = null;
- playerScript.inSpecialInteractAnimation = false;
- playerScript.KillPlayer(Vector3.zero, spawnBody: false);
- }
- public override void OnCollideWithEnemy(Collider other, EnemyAI enemyScript = null)
- {
- base.OnCollideWithEnemy(other);
- if (base.IsServer && emerged)
- {
- enemyScript.KillEnemyOnOwnerClient(overrideDestroy: true);
- }
- }
- // EnemyAI
- public void KillEnemyOnOwnerClient(bool overrideDestroy = false)
- {
- if (!enemyType.canDie || !base.IsOwner) // <-- only killable entities
- {
- return;
- }
- // ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement