示例#1
0
 public override void _Ready()
 {
     instance     = this;
     cameraBase   = GetNode <Spatial>(CameraBasePath);
     cameraRot    = cameraBase.GetNode <Spatial>("CameraRot");
     camera       = cameraRot.GetNode <Spatial>("Camera");
     playerCamera = new PlayerCamera();
     animTree     = mesh.FindNode("AnimationTree", true, false) as AnimationTree;
     PlayerEquip.ResetEquipables();
     using (Packet packet = new Packet((int)ClientPackets.playerInstancedSignal))
     {
         packet.Write(Client.instance.getCID());
         packet.Write(Client.instance.getSessionId());
         Client.SendTCPData(packet);
     }
 }
示例#2
0
    public void Spawn()
    {
        string      raceName           = Enum.GetName(typeof(PLAYER_RACES), race).ToString().ToLower();
        string      sexName            = Enum.GetName(typeof(PLAYER_SEXES), sex).ToString().ToLower();
        PackedScene playerMeshResource = (PackedScene)ResourceLoader.Load($"res://prefabs/3d/characters/player/{raceName}/{sexName}/{sexName}.tscn");

        mesh = playerMeshResource.Instance() as PlayerMesh;
        CallDeferred("add_child", mesh);
        animTree           = mesh.FindNode("AnimationTree", true, false) as AnimationTree;
        orientation        = mesh.GlobalTransform;
        orientation.origin = new Vector3();

        Transform current = Transform;

        current.origin.x = position.x;
        current.origin.y = position.y;
        current.origin.z = position.z;
        Transform        = current;
    }