30 lines
870 B
C#
30 lines
870 B
C#
using System;
|
|
using Godot;
|
|
|
|
public partial class Bullet : RigidBody3D {
|
|
Reference _Reference;
|
|
Options _Options;
|
|
|
|
public int Creator = -1;
|
|
public float Damage = 1;
|
|
|
|
public override void _Ready() {
|
|
_Options = GetNode<Options>( "/root/Options" );
|
|
_Reference = GetNode<Reference>("/root/Reference");
|
|
}
|
|
|
|
public void _on_body_entered( Node body ) {
|
|
if (Multiplayer.GetUniqueId() == 1){
|
|
if ( body is Humanoid ) {
|
|
Humanoid player = (Humanoid)body;
|
|
_Reference.GameHandler.TakeDamage(Damage, Creator, Convert.ToInt32( player.Name.ToString().Split(new char[]{','})[0] ));
|
|
_Reference.Alert.PerformAlert("Bullet his player with ID: " + body.GetMultiplayerAuthority());
|
|
}
|
|
|
|
}
|
|
this.QueueFree();
|
|
}
|
|
|
|
|
|
}
|