コード例 #1
0
    public static void SpawnProjectile(Packet packet)
    {
        int            id             = packet.ReadInt();
        ProjectileType type           = (ProjectileType)packet.ReadInt();
        int            boatId         = packet.ReadInt();
        int            boatEntityId   = packet.ReadInt();
        BoatEntityType boatEntityType = (BoatEntityType)packet.ReadInt();


        Boat               boat               = BoatManager.Boats[boatId];
        BoatEntity         boatEntity         = boat.boatEntitiesByType[boatEntityType][boatEntityId];
        ProjectileLauncher projectileLauncher = boatEntity as ProjectileLauncher;
        Transform          launcher           = projectileLauncher != null?projectileLauncher.GetLauncher() : boatEntity.transform;

        Projectile projectile = GameObject.Instantiate <Projectile>(ProjectileByType[(ProjectileType)type], launcher.position, launcher.rotation);

        projectile.TargetPosition = launcher.position;
        Projectiles.Add(id, projectile);
    }